1
0

kivy: update fiat amounts when changed

This commit is contained in:
ThomasV
2016-01-21 16:29:46 +01:00
parent a1d55fac4e
commit 5a03caf051
4 changed files with 18 additions and 37 deletions

View File

@@ -78,6 +78,10 @@ class ElectrumWindow(App):
status = StringProperty('')
fiat_unit = StringProperty('')
def on_fiat_unit(self, a, b):
if self.history_screen:
self.history_screen.update()
def decimal_point(self):
return base_units[self.base_unit]
@@ -548,36 +552,9 @@ class ElectrumWindow(App):
#Logger.info('orientation: {}'.format(self._orientation))
#Logger.info('ui_mode: {}'.format(self._ui_mode))
def save_new_contact(self, address, label):
address = unicode(address)
label = unicode(label)
global is_valid
if not is_valid:
from electrum.bitcoin import is_valid
if is_valid(address):
if label:
self.set_label(address, text=label)
self.wallet.add_contact(address)
self.update_contacts_tab()
self.update_history_tab()
else:
self.show_error(_('Invalid Address'))
def set_send(self, address, amount, label, message):
self.send_payment(address, amount=amount, label=label, message=message)
def set_frozen(self, entry, frozen):
if frozen:
entry.disabled = True
Factory.Animation(opacity=0).start(content)
else:
entry.disabled = False
Factory.Animation(opacity=1).start(content)
def show_error(self, error, width='200dp', pos=None, arrow_pos=None,
exit=False, icon='atlas://gui/kivy/theming/light/error', duration=0,
modal=False):

View File

@@ -131,7 +131,7 @@ class SettingsDialog(Factory.Popup):
def cb(text):
self.app._set_bu(text)
item.bu = self.app.base_unit
d = ChoiceDialog(_('Denomination'), base_units, self.app.base_unit, cb)
d = ChoiceDialog(_('Denomination'), base_units.keys(), self.app.base_unit, cb)
d.open()
def fiat_currency_dialog(self, item):
@@ -140,10 +140,11 @@ class SettingsDialog(Factory.Popup):
if not p:
return
def cb(text):
self.config.set_key('currency', text, True)
p.set_currency(text)
item.status = text
self.app.fiat_unit = text
l = sorted(p.exchange.quotes.keys()) if p else []
d = ChoiceDialog(_('Fiat Currency'), l, '', cb)
d = ChoiceDialog(_('Fiat Currency'), l, p.get_currency(), cb)
d.open()
def fiat_source(self):