Usage of QtClipboard
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
pyside2~=5.13
|
pyside2~=5.13
|
||||||
pyinstaller
|
pyinstaller
|
||||||
clipboard
|
|
||||||
toml~=0.10
|
toml~=0.10
|
||||||
requests~=2.22
|
requests~=2.22
|
||||||
./backend
|
./backend
|
||||||
+2
-1
@@ -28,8 +28,9 @@ def run():
|
|||||||
app.setStyleSheet(style)
|
app.setStyleSheet(style)
|
||||||
|
|
||||||
geometry = app.screens()[0].size()
|
geometry = app.screens()[0].size()
|
||||||
|
clipboard = app.clipboard()
|
||||||
|
|
||||||
widget = MainWidget()
|
widget = MainWidget(clipboard)
|
||||||
widget.setWindowOpacity(window_config['opacity'])
|
widget.setWindowOpacity(window_config['opacity'])
|
||||||
widget.resize(WIDTH, HEIGHT)
|
widget.resize(WIDTH, HEIGHT)
|
||||||
widget.move(0, geometry.height() - HEIGHT - 280)
|
widget.move(0, geometry.height() - HEIGHT - 280)
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ from PySide2.QtWidgets import QComboBox
|
|||||||
from PySide2 import QtGui
|
from PySide2 import QtGui
|
||||||
from PySide2 import QtCore
|
from PySide2 import QtCore
|
||||||
|
|
||||||
import clipboard
|
|
||||||
|
|
||||||
from .dmg_list import DmgList
|
from .dmg_list import DmgList
|
||||||
from . import about
|
from . import about
|
||||||
from . import engine
|
from . import engine
|
||||||
@@ -29,13 +27,14 @@ class Mode:
|
|||||||
|
|
||||||
|
|
||||||
class InteractiveBar(QWidget):
|
class InteractiveBar(QWidget):
|
||||||
def __init__(self, table):
|
def __init__(self, table, clipboard):
|
||||||
QWidget.__init__(self)
|
QWidget.__init__(self)
|
||||||
self.mode = ModeWidget()
|
self.mode = ModeWidget()
|
||||||
self.table = table
|
self.table = table
|
||||||
self.layout = QHBoxLayout()
|
self.layout = QHBoxLayout()
|
||||||
self.about = about.About()
|
self.about = about.About()
|
||||||
self.fame_per_minute = 0.0
|
self.fame_per_minute = 0.0
|
||||||
|
self.clipboard = clipboard
|
||||||
|
|
||||||
self.copy_button = QPushButton(self)
|
self.copy_button = QPushButton(self)
|
||||||
self.copy_button.setIcon(QtGui.QIcon(os.path.join(assets_path, 'copy.png')))
|
self.copy_button.setIcon(QtGui.QIcon(os.path.join(assets_path, 'copy.png')))
|
||||||
@@ -72,7 +71,9 @@ class InteractiveBar(QWidget):
|
|||||||
clip += '{}. {}-{}-{}%'.format(index+1, i.name, i.damage, i.percentage)
|
clip += '{}. {}-{}-{}%'.format(index+1, i.name, i.damage, i.percentage)
|
||||||
clip += "\n"
|
clip += "\n"
|
||||||
clip += "(AOStats https://git.io/JeBD1)"
|
clip += "(AOStats https://git.io/JeBD1)"
|
||||||
clipboard.copy(clip)
|
|
||||||
|
self.clipboard.clear(mode=self.clipboard.Clipboard )
|
||||||
|
self.clipboard.setText(clip, mode=self.clipboard.Clipboard)
|
||||||
|
|
||||||
def set_fame_per_minute(self, fpm):
|
def set_fame_per_minute(self, fpm):
|
||||||
self.fame_per_minute = fpm
|
self.fame_per_minute = fpm
|
||||||
@@ -99,14 +100,14 @@ class ModeWidget(QComboBox):
|
|||||||
|
|
||||||
|
|
||||||
class MainWidget(QWidget):
|
class MainWidget(QWidget):
|
||||||
def __init__(self):
|
def __init__(self, clipboard):
|
||||||
QWidget.__init__(self)
|
QWidget.__init__(self)
|
||||||
|
|
||||||
self.mouse_pos = None
|
self.mouse_pos = None
|
||||||
self.table = DmgList()
|
self.table = DmgList()
|
||||||
self.fame_label = QLabel()
|
self.fame_label = QLabel()
|
||||||
self.fame_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignHCenter)
|
self.fame_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignHCenter)
|
||||||
self.bar = InteractiveBar(self.table)
|
self.bar = InteractiveBar(self.table, clipboard)
|
||||||
|
|
||||||
self.layout = QVBoxLayout()
|
self.layout = QVBoxLayout()
|
||||||
self.layout.addWidget(self.bar)
|
self.layout.addWidget(self.bar)
|
||||||
|
|||||||
Reference in New Issue
Block a user