|
@ -268,6 +268,7 @@ class ElectrumWindow(App): |
|
|
self._trigger_update_wallet = Clock.create_trigger(self.update_wallet, .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_status = Clock.create_trigger(self.update_status, .5) |
|
|
self._trigger_update_history = Clock.create_trigger(self.update_history, .5) |
|
|
self._trigger_update_history = Clock.create_trigger(self.update_history, .5) |
|
|
|
|
|
self._trigger_update_interfaces = Clock.create_trigger(self.update_interfaces, .5) |
|
|
# cached dialogs |
|
|
# cached dialogs |
|
|
self._settings_dialog = None |
|
|
self._settings_dialog = None |
|
|
self._password_dialog = None |
|
|
self._password_dialog = None |
|
@ -589,20 +590,24 @@ class ElectrumWindow(App): |
|
|
|
|
|
|
|
|
# connect callbacks |
|
|
# connect callbacks |
|
|
if self.network: |
|
|
if self.network: |
|
|
interests = ['updated', 'status', 'new_transaction', 'verified'] |
|
|
interests = ['updated', 'status', 'new_transaction', 'verified', 'interfaces'] |
|
|
self.network.register_callback(self.on_network, interests) |
|
|
self.network.register_callback(self.on_network_event, interests) |
|
|
self.tabs = self.root.ids['tabs'] |
|
|
self.tabs = self.root.ids['tabs'] |
|
|
|
|
|
|
|
|
def on_network(self, event, *args): |
|
|
def update_interfaces(self, dt): |
|
|
chain = self.network.blockchain() |
|
|
self.num_nodes = len(self.network.get_interfaces()) |
|
|
self.num_chains = len(self.network.get_blockchains()) |
|
|
self.num_chains = len(self.network.get_blockchains()) |
|
|
|
|
|
chain = self.network.blockchain() |
|
|
self.blockchain_checkpoint = chain.get_checkpoint() |
|
|
self.blockchain_checkpoint = chain.get_checkpoint() |
|
|
self.blockchain_name = chain.get_name() |
|
|
self.blockchain_name = chain.get_name() |
|
|
if self.network.interface: |
|
|
if self.network.interface: |
|
|
self.server_host = self.network.interface.host |
|
|
self.server_host = self.network.interface.host |
|
|
if event == 'updated': |
|
|
|
|
|
self.num_blocks = self.network.get_local_height() |
|
|
def on_network_event(self, event, *args): |
|
|
self.num_nodes = len(self.network.get_interfaces()) |
|
|
Logger.info('network event: '+ event) |
|
|
|
|
|
if event == 'interfaces': |
|
|
|
|
|
self._trigger_update_interfaces() |
|
|
|
|
|
elif event == 'updated': |
|
|
self._trigger_update_wallet() |
|
|
self._trigger_update_wallet() |
|
|
self._trigger_update_status() |
|
|
self._trigger_update_status() |
|
|
elif event == 'status': |
|
|
elif event == 'status': |
|
@ -624,6 +629,7 @@ class ElectrumWindow(App): |
|
|
run_hook('load_wallet', wallet, self) |
|
|
run_hook('load_wallet', wallet, self) |
|
|
|
|
|
|
|
|
def update_status(self, *dt): |
|
|
def update_status(self, *dt): |
|
|
|
|
|
self.num_blocks = self.network.get_local_height() |
|
|
if not self.wallet: |
|
|
if not self.wallet: |
|
|
self.status = _("No Wallet") |
|
|
self.status = _("No Wallet") |
|
|
return |
|
|
return |
|
|