electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 4d5615b8a88a189c4b15ca499dca62a930315e57
parent 49aec96e1ec39b09698ad96ecf3c4a2fa20ef19a
Author: Amir Taaki <genjix@riseup.net>
Date:   Sat, 18 Aug 2012 08:23:57 +0100

Show and change themes via GUI.

Diffstat:
Mlib/gui_lite.py | 29++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/lib/gui_lite.py b/lib/gui_lite.py @@ -185,7 +185,24 @@ class MiniWindow(QDialog): view_menu = menubar.addMenu(_("&View")) expert_gui = view_menu.addAction(_("&Pro Mode")) expert_gui.triggered.connect(expand_callback) - view_menu.addMenu(_("&Themes")) + themes_menu = view_menu.addMenu(_("&Themes")) + selected_theme = self.actuator.selected_theme() + theme_group = QActionGroup(self) + for theme_name in self.actuator.theme_names(): + theme_action = themes_menu.addAction(theme_name) + theme_action.setCheckable(True) + if selected_theme == theme_name: + theme_action.setChecked(True) + class SelectThemeFunctor: + def __init__(self, theme_name, toggle_theme): + self.theme_name = theme_name + self.toggle_theme = toggle_theme + def __call__(self, checked): + if checked: + self.toggle_theme(self.theme_name) + delegate = SelectThemeFunctor(theme_name, self.toggle_theme) + theme_action.toggled.connect(delegate) + theme_group.addAction(theme_action) view_menu.addSeparator() show_history = view_menu.addAction(_("Show History")) show_history.setCheckable(True) @@ -212,8 +229,10 @@ class MiniWindow(QDialog): self.layout().setSizeConstraint(QLayout.SetFixedSize) self.setObjectName("main_window") self.show() - - def recompute_style(self): + + def toggle_theme(self, theme_name): + self.actuator.change_theme(theme_name) + # Recompute style globally qApp.style().unpolish(self) qApp.style().polish(self) @@ -482,6 +501,10 @@ class MiniActuator: def selected_theme(self): return self.theme_name + def change_theme(self, theme_name): + self.wallet.theme = self.theme_name = theme_name + self.load_theme() + def set_configured_currency(self, set_quote_currency): currency = self.wallet.conversion_currency # currency can be none when Electrum is used for the first