Automatic theme (#29)

* add "automatic" theme

set the theme and icons based on the system theme

* update the default icons based on system theme

* update pyqt to 6.5.0 to get the colorSchemeChanged callback

* rename style to theme

* remove unused svg files for default theme

* ServerInfoDialog: update feedback colors in dark mode
This commit is contained in:
seird
2023-05-21 11:41:01 +02:00
committed by GitHub
parent 34d81ef6d0
commit bc221d6c8f
17 changed files with 105 additions and 272 deletions

View File

@@ -26,7 +26,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
activated = QtCore.pyqtSignal()
def __init__(
self, application_model: ApplicationModel, messages_model: MessagesModel
self, app: QtWidgets.QApplication,
application_model: ApplicationModel, messages_model: MessagesModel
):
super(MainWindow, self).__init__()
self.setupUi(self)
@@ -35,6 +36,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.setWindowTitle(__title__)
self.app = app
self.application_model = application_model
self.messages_model = messages_model
@@ -47,7 +50,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
# Do not collapse the message list
self.splitter.setCollapsible(1, False)
self.status_widget = StatusWidget()
self.status_widget = StatusWidget(app)
self.horizontalLayout.insertWidget(0, self.status_widget)
self.set_icons()
@@ -70,8 +73,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def set_icons(self):
# Set button icons
self.pb_refresh.setIcon(QtGui.QIcon(get_theme_file("refresh.svg")))
self.pb_delete_all.setIcon(QtGui.QIcon(get_theme_file("trashcan.svg")))
self.pb_refresh.setIcon(QtGui.QIcon(get_theme_file(self.app, "refresh.svg")))
self.pb_delete_all.setIcon(QtGui.QIcon(get_theme_file(self.app, "trashcan.svg")))
# Resize the labels and icons
size = settings.value("MainWindow/label/size", type=int)
@@ -105,7 +108,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self, message_item: MessagesModelItem, image_path: str = ""
):
message_widget = MessageWidget(
self.listView_messages, message_item, image_path=image_path
self.app, self.listView_messages, message_item, image_path=image_path
)
self.listView_messages.setIndexWidget(
self.messages_model.indexFromItem(message_item), message_widget