add 'sat' as base unit option
This commit is contained in:
@@ -44,14 +44,19 @@ Builder.load_string('''
|
||||
|
||||
class ChoiceDialog(Factory.Popup):
|
||||
|
||||
def __init__(self, title, choices, key, callback):
|
||||
def __init__(self, title, choices, key, callback, keep_choice_order=False):
|
||||
Factory.Popup.__init__(self)
|
||||
print(choices, type(choices))
|
||||
if keep_choice_order:
|
||||
orig_index = {choice: i for (i, choice) in enumerate(choices)}
|
||||
sort_key = lambda x: orig_index[x[0]]
|
||||
else:
|
||||
sort_key = lambda x: x
|
||||
if type(choices) is list:
|
||||
choices = dict(map(lambda x: (x,x), choices))
|
||||
layout = self.ids.choices
|
||||
layout.bind(minimum_height=layout.setter('height'))
|
||||
for k, v in sorted(choices.items()):
|
||||
for k, v in sorted(choices.items(), key=sort_key):
|
||||
l = Label(text=v)
|
||||
l.height = '48dp'
|
||||
l.size_hint_x = 4
|
||||
|
||||
@@ -3,7 +3,7 @@ from kivy.factory import Factory
|
||||
from kivy.properties import ObjectProperty
|
||||
from kivy.lang import Builder
|
||||
|
||||
from electrum.util import base_units
|
||||
from electrum.util import base_units_list
|
||||
from electrum.i18n import languages
|
||||
from electrum_gui.kivy.i18n import _
|
||||
from electrum.plugins import run_hook
|
||||
@@ -136,7 +136,8 @@ class SettingsDialog(Factory.Popup):
|
||||
def cb(text):
|
||||
self.app._set_bu(text)
|
||||
item.bu = self.app.base_unit
|
||||
self._unit_dialog = ChoiceDialog(_('Denomination'), list(base_units.keys()), self.app.base_unit, cb)
|
||||
self._unit_dialog = ChoiceDialog(_('Denomination'), base_units_list,
|
||||
self.app.base_unit, cb, keep_choice_order=True)
|
||||
self._unit_dialog.open()
|
||||
|
||||
def coinselect_status(self):
|
||||
|
||||
Reference in New Issue
Block a user