From 7a47eb990683eea706cb9e52eefd8231afc8e38f Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 18 Feb 2022 22:17:44 +0100 Subject: [PATCH] qt: again disable changing light/dark theme at runtime partially reverts 11a04c0d72e92089a0ae1443b8ac2ed37b4b9b19 related https://github.com/spesmilo/electrum/issues/7209 --- electrum/gui/qt/__init__.py | 9 +++++++++ electrum/gui/qt/settings_dialog.py | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py index 647417f88..05e89d4d7 100644 --- a/electrum/gui/qt/__init__.py +++ b/electrum/gui/qt/__init__.py @@ -147,6 +147,15 @@ class ElectrumGui(BaseElectrumGui, Logger): self.tray.show() def reload_app_stylesheet(self): + """Set the Qt stylesheet and custom colors according to the user-selected + light/dark theme. + TODO this can ~almost be used to change the theme at runtime (without app restart), + except for util.ColorScheme... widgets already created with colors set using + ColorSchemeItem.as_stylesheet() and similar will not get recolored. + See e.g. + - in Coins tab, the color for "frozen" UTXOs, or + - in TxDialog, the receiving/change address colors + """ use_dark_theme = self.config.get('qt_gui_color_theme', 'default') == 'dark' if use_dark_theme: try: diff --git a/electrum/gui/qt/settings_dialog.py b/electrum/gui/qt/settings_dialog.py index 82ad5f406..e451fe6d1 100644 --- a/electrum/gui/qt/settings_dialog.py +++ b/electrum/gui/qt/settings_dialog.py @@ -259,7 +259,8 @@ class SettingsDialog(WindowModalDialog): colortheme_label = QLabel(_('Color theme') + ':') def on_colortheme(x): self.config.set_key('qt_gui_color_theme', colortheme_combo.itemData(x), True) - self.window.gui_object.reload_app_stylesheet() + #self.window.gui_object.reload_app_stylesheet() + self.need_restart = True colortheme_combo.currentIndexChanged.connect(on_colortheme) gui_widgets.append((colortheme_label, colortheme_combo))