Browse Source

kivy: button that rotates base_unit

283
ThomasV 9 years ago
parent
commit
59948d725c
  1. 6
      gui/kivy/main_window.py
  2. 8
      gui/kivy/uix/ui_screens/settings.kv

6
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'))

8
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'

Loading…
Cancel
Save