diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py index 3c46a1d07..647417f88 100644 --- a/electrum/gui/qt/__init__.py +++ b/electrum/gui/qt/__init__.py @@ -133,7 +133,10 @@ class ElectrumGui(BaseElectrumGui, Logger): self._init_tray() self.app.new_window_signal.connect(self.start_new_window) self.app.quit_signal.connect(self.app.quit, Qt.QueuedConnection) - self.set_dark_theme_if_needed() + # maybe set dark theme + self._default_qtstylesheet = self.app.styleSheet() + self.reload_app_stylesheet() + run_hook('init_qt', self) def _init_tray(self): @@ -143,7 +146,7 @@ class ElectrumGui(BaseElectrumGui, Logger): self.build_tray_menu() self.tray.show() - def set_dark_theme_if_needed(self): + def reload_app_stylesheet(self): use_dark_theme = self.config.get('qt_gui_color_theme', 'default') == 'dark' if use_dark_theme: try: @@ -152,6 +155,8 @@ class ElectrumGui(BaseElectrumGui, Logger): except BaseException as e: use_dark_theme = False self.logger.warning(f'Error setting dark theme: {repr(e)}') + else: + self.app.setStyleSheet(self._default_qtstylesheet) # Apply any necessary stylesheet patches patch_qt_stylesheet(use_dark_theme=use_dark_theme) # Even if we ourselves don't set the dark theme, diff --git a/electrum/gui/qt/settings_dialog.py b/electrum/gui/qt/settings_dialog.py index 02a5734b9..82ad5f406 100644 --- a/electrum/gui/qt/settings_dialog.py +++ b/electrum/gui/qt/settings_dialog.py @@ -259,7 +259,7 @@ 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.need_restart = True + self.window.gui_object.reload_app_stylesheet() colortheme_combo.currentIndexChanged.connect(on_colortheme) gui_widgets.append((colortheme_label, colortheme_combo))