kivy: group network calback registrations

This commit is contained in:
ThomasV 2017-07-21 10:38:50 +02:00
parent ce977e0385
commit 732679aa3d
1 changed files with 7 additions and 11 deletions

View File

@ -448,12 +448,8 @@ class ElectrumWindow(App):
self.load_wallet_by_name(self.electrum_config.get_wallet_path()) self.load_wallet_by_name(self.electrum_config.get_wallet_path())
# init plugins # init plugins
run_hook('init_kivy', self) run_hook('init_kivy', self)
# fiat currency # fiat currency
self.fiat_unit = self.fx.ccy if self.fx.is_enabled() else '' self.fiat_unit = self.fx.ccy if self.fx.is_enabled() else ''
self.network.register_callback(self.on_quotes, ['on_quotes'])
self.network.register_callback(self.on_history, ['on_history'])
# default tab # default tab
self.switch_to('history') self.switch_to('history')
# bind intent for bitcoin: URI scheme # bind intent for bitcoin: URI scheme
@ -464,12 +460,18 @@ class ElectrumWindow(App):
mactivity = PythonActivity.mActivity mactivity = PythonActivity.mActivity
self.on_new_intent(mactivity.getIntent()) self.on_new_intent(mactivity.getIntent())
activity.bind(on_new_intent=self.on_new_intent) activity.bind(on_new_intent=self.on_new_intent)
# connect callbacks
if self.network:
interests = ['updated', 'status', 'new_transaction', 'verified', 'interfaces']
self.network.register_callback(self.on_network_event, interests)
self.network.register_callback(self.on_quotes, ['on_quotes'])
self.network.register_callback(self.on_history, ['on_history'])
# URI passed in config # URI passed in config
uri = self.electrum_config.get('url') uri = self.electrum_config.get('url')
if uri: if uri:
self.set_URI(uri) self.set_URI(uri)
def get_wallet_path(self): def get_wallet_path(self):
if self.wallet: if self.wallet:
return self.wallet.storage.path return self.wallet.storage.path
@ -585,13 +587,7 @@ class ElectrumWindow(App):
self.invoices_screen = None self.invoices_screen = None
self.receive_screen = None self.receive_screen = None
self.requests_screen = None self.requests_screen = None
self.icon = "icons/electrum.png" self.icon = "icons/electrum.png"
# connect callbacks
if self.network:
interests = ['updated', 'status', 'new_transaction', 'verified', 'interfaces']
self.network.register_callback(self.on_network_event, interests)
self.tabs = self.root.ids['tabs'] self.tabs = self.root.ids['tabs']
def update_interfaces(self, dt): def update_interfaces(self, dt):