electrum

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

commit 59948d725c243dd6fd289561ada9ec23c587ed7b
parent 069a6455c7ba909bdf216bdcb29c8ec5ff9d2fbe
Author: ThomasV <thomasv@electrum.org>
Date:   Thu, 15 Oct 2015 11:35:32 +0200

kivy: button that rotates base_unit

Diffstat:
Mgui/kivy/main_window.py | 6+++++-
Mgui/kivy/uix/ui_screens/settings.kv | 8++++----
2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py @@ -52,6 +52,8 @@ base_units = {'BTC':8, 'mBTC':5, 'uBTC':2} class ElectrumWindow(App): + electrum_config = ObjectProperty(None) + def _get_bu(self): return self.electrum_config.get('base_unit', 'mBTC') @@ -64,7 +66,9 @@ class ElectrumWindow(App): base_unit = AliasProperty(_get_bu, _set_bu) - electrum_config = ObjectProperty(None) + def _rotate_bu(self): + keys = sorted(base_units.keys()) + self.base_unit = keys[ (keys.index(self.base_unit) + 1) % len(keys)] status = StringProperty(_('Not Connected')) diff --git a/gui/kivy/uix/ui_screens/settings.kv b/gui/kivy/uix/ui_screens/settings.kv @@ -13,13 +13,13 @@ Popup: text: _('Base unit') height: '48dp' size_hint: 1, None - Spinner: + Button: text: app.base_unit - values: ('BTC', 'mBTC') size_hint: 1, None height: '48dp' - on_text: app.base_unit = self.text - + on_release: + app._rotate_bu() + self.text = app.base_unit Label: size_hint: 1, None text: 'OpenAlias'