commit 024de7afa559f643641b2e6480d8933d28cd8b46
parent f5083b46dea25a8c35ca52c8fd1b152d854a4fc3
Author: ThomasV <thomasv@electrum.org>
Date: Mon, 13 Mar 2017 15:07:35 +0100
kivy: trigger_update_history
Diffstat:
2 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py
@@ -90,15 +90,17 @@ class ElectrumWindow(App):
Logger.info('language: {}'.format(language))
_.switch_lang(language)
+ def update_history(self, *dt):
+ if self.history_screen:
+ self.history_screen.update()
+
def on_quotes(self, d):
Logger.info("on_quotes")
- if self.history_screen:
- Clock.schedule_once(lambda dt: self.history_screen.update())
+ self._trigger_update_history()
def on_history(self, d):
Logger.info("on_history")
- if self.history_screen:
- Clock.schedule_once(lambda dt: self.history_screen.update())
+ self._trigger_update_history()
def _get_bu(self):
return self.electrum_config.get('base_unit', 'mBTC')
@@ -106,17 +108,15 @@ class ElectrumWindow(App):
def _set_bu(self, value):
assert value in base_units.keys()
self.electrum_config.set_key('base_unit', value, True)
- self.update_status()
- if self.history_screen:
- self.history_screen.update()
+ self._trigger_update_status()
+ self._trigger_update_history()
base_unit = AliasProperty(_get_bu, _set_bu)
status = StringProperty('')
fiat_unit = StringProperty('')
def on_fiat_unit(self, a, b):
- if self.history_screen:
- self.history_screen.update()
+ self._trigger_update_history()
def decimal_point(self):
return base_units[self.base_unit]
@@ -201,10 +201,9 @@ class ElectrumWindow(App):
self.fx = self.daemon.fx
# create triggers so as to minimize updation a max of 2 times a sec
- self._trigger_update_wallet =\
- Clock.create_trigger(self.update_wallet, .5)
- self._trigger_update_status =\
- Clock.create_trigger(self.update_status, .5)
+ self._trigger_update_wallet = Clock.create_trigger(self.update_wallet, .5)
+ self._trigger_update_status = Clock.create_trigger(self.update_status, .5)
+ self._trigger_update_history = Clock.create_trigger(self.update_history, .5)
# cached dialogs
self._settings_dialog = None
self._password_dialog = None
@@ -254,9 +253,6 @@ class ElectrumWindow(App):
# show error
self.show_error("Unable to decode QR data")
- def update_history_tab(self):
- Clock.schedule_once(lambda dt: self.update_tab('history'))
-
def update_tab(self, name):
s = getattr(self, name + '_screen', None)
if s:
diff --git a/plugins/labels/kivy.py b/plugins/labels/kivy.py
@@ -10,5 +10,5 @@ class Plugin(LabelsPlugin):
def on_pulled(self, wallet):
self.print_error('on pulled')
- self.window.update_history_tab()
+ self.window._trigger_update_history()