From b07bc06a4b94bf438b90df65735efcdcc3688f4e Mon Sep 17 00:00:00 2001 From: Oliver Hartmann Date: Fri, 6 Jan 2023 01:40:57 +0100 Subject: [PATCH] added icons --- icons/material_close.svg | 1 + icons/material_info.svg | 1 + icons/material_invite.svg | 1 + icons/material_thank.svg | 1 + icons/material_trade.svg | 1 + icons/material_wait.svg | 1 + icons/material_wait2.svg | 1 + icons/material_whisper.svg | 1 + src/pyside6/gui_pyside6.py | 9 +++++++-- src/pyside6/trade_widget.py | 20 ++++++++++++-------- 10 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 icons/material_close.svg create mode 100644 icons/material_info.svg create mode 100644 icons/material_invite.svg create mode 100644 icons/material_thank.svg create mode 100644 icons/material_trade.svg create mode 100644 icons/material_wait.svg create mode 100644 icons/material_wait2.svg create mode 100644 icons/material_whisper.svg diff --git a/icons/material_close.svg b/icons/material_close.svg new file mode 100644 index 0000000..69eb6ff --- /dev/null +++ b/icons/material_close.svg @@ -0,0 +1 @@ + diff --git a/icons/material_info.svg b/icons/material_info.svg new file mode 100644 index 0000000..abb27db --- /dev/null +++ b/icons/material_info.svg @@ -0,0 +1 @@ + diff --git a/icons/material_invite.svg b/icons/material_invite.svg new file mode 100644 index 0000000..d37ae9f --- /dev/null +++ b/icons/material_invite.svg @@ -0,0 +1 @@ + diff --git a/icons/material_thank.svg b/icons/material_thank.svg new file mode 100644 index 0000000..d3e4a40 --- /dev/null +++ b/icons/material_thank.svg @@ -0,0 +1 @@ + diff --git a/icons/material_trade.svg b/icons/material_trade.svg new file mode 100644 index 0000000..8518075 --- /dev/null +++ b/icons/material_trade.svg @@ -0,0 +1 @@ + diff --git a/icons/material_wait.svg b/icons/material_wait.svg new file mode 100644 index 0000000..c13d14d --- /dev/null +++ b/icons/material_wait.svg @@ -0,0 +1 @@ + diff --git a/icons/material_wait2.svg b/icons/material_wait2.svg new file mode 100644 index 0000000..0f3c309 --- /dev/null +++ b/icons/material_wait2.svg @@ -0,0 +1 @@ + diff --git a/icons/material_whisper.svg b/icons/material_whisper.svg new file mode 100644 index 0000000..11d1e5c --- /dev/null +++ b/icons/material_whisper.svg @@ -0,0 +1 @@ + diff --git a/src/pyside6/gui_pyside6.py b/src/pyside6/gui_pyside6.py index fa96f46..3ead8ce 100644 --- a/src/pyside6/gui_pyside6.py +++ b/src/pyside6/gui_pyside6.py @@ -71,7 +71,7 @@ class MainWindow(QMainWindow): def __init__(self): super().__init__() - # self.setWindowFlag(QtCore.Qt.FramelessWindowHint) + self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setWindowFlag(QtCore.Qt.WindowStaysOnTopHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) @@ -96,7 +96,12 @@ class MainWindow(QMainWindow): def start_app(): app = QApplication(sys.argv) - qdarktheme.setup_theme() + qss = """QToolTip { + background-color: black; + color: white; + border: black solid 1px + }""" + qdarktheme.setup_theme(additional_qss=qss, custom_colors={"primary": "#eda65a"}) # app.setStyle('Material') window = MainWindow() diff --git a/src/pyside6/trade_widget.py b/src/pyside6/trade_widget.py index 85ea24e..6921005 100644 --- a/src/pyside6/trade_widget.py +++ b/src/pyside6/trade_widget.py @@ -1,5 +1,6 @@ from PySide6.QtWidgets import QPushButton, QHBoxLayout, QVBoxLayout, QWidget, QLabel, QSizePolicy, QFrame from PySide6 import QtCore +from PySide6.QtGui import QIcon from src.data import Message from src import sendkeys from src.data import log @@ -23,18 +24,21 @@ class TradeWidget(QWidget): self.setLayout(self.main_layout) assert message.trade - self.inv_button = self.new_button('inv', self.inv_callback) - self.trade_button = self.new_button('trade', self.trade_callback) - self.thank_button = self.new_button('thank', self.thank_callback) - self.wait_button = self.new_button('wait', self.wait_callback) - self.close_button = self.new_button('X', self.close_callback) + self.inv_button = self.new_button('icons/material_invite.svg', 'Invite', self.inv_callback) + self.trade_button = self.new_button('icons/material_trade.svg', 'Trade', self.trade_callback) + self.thank_button = self.new_button('icons/material_thank.svg', 'Thank you', self.thank_callback) + self.wait_button = self.new_button('icons/material_wait2.svg', 'Busy', self.wait_callback) + self.close_button = self.new_button('icons/material_close.svg', 'Dismiss', self.close_callback) self.label_item = self.new_Label(message.trade.item) self.label_price = self.new_Label(f'{message.trade.amount} {message.trade.currency}') self.label_user = self.new_Label(message.user) + self.label_tab = self.new_Label(message.trade.tab) - def new_button(self, text: str, callback: Callable[[], None]) -> QPushButton: - button = QPushButton(text) + def new_button(self, icon_filename: str, tooltip: str, callback: Callable[[], None]) -> QPushButton: + icon = QIcon(icon_filename) + button = QPushButton(icon=icon, text='', parent=self) + button.setToolTip(tooltip) button.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed) button.setContentsMargins(0, 0, 0, 0) button.clicked.connect(callback) @@ -42,7 +46,7 @@ class TradeWidget(QWidget): return button def new_Label(self, text: str) -> QLabel: - label = QLabel(text) + label = QLabel(text, self) label.setFrameStyle(QFrame.Panel | QFrame.Sunken) label.setAlignment(QtCore.Qt.AlignLeft) self.main_layout.addWidget(label)