URI: 
       tkivy: trigger_update_interfaces - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 2bb980c84c9e2fefd4685d48ffc47df63ad2d672
   DIR parent dd0d85b4f29792f9d6a0c3c4c839253055ecd331
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Fri, 21 Jul 2017 00:09:47 +0200
       
       kivy: trigger_update_interfaces
       
       Diffstat:
         M gui/kivy/main_window.py             |      20 +++++++++++++-------
       
       1 file changed, 13 insertions(+), 7 deletions(-)
       ---
   DIR diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py
       t@@ -268,6 +268,7 @@ class ElectrumWindow(App):
                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)
       +        self._trigger_update_interfaces = Clock.create_trigger(self.update_interfaces, .5)
                # cached dialogs
                self._settings_dialog = None
                self._password_dialog = None
       t@@ -589,20 +590,24 @@ class ElectrumWindow(App):
        
                # connect callbacks
                if self.network:
       -            interests = ['updated', 'status', 'new_transaction', 'verified']
       -            self.network.register_callback(self.on_network, interests)
       +            interests = ['updated', 'status', 'new_transaction', 'verified', 'interfaces']
       +            self.network.register_callback(self.on_network_event, interests)
                self.tabs = self.root.ids['tabs']
        
       -    def on_network(self, event, *args):
       -        chain = self.network.blockchain()
       +    def update_interfaces(self, dt):
       +        self.num_nodes = len(self.network.get_interfaces())
                self.num_chains = len(self.network.get_blockchains())
       +        chain = self.network.blockchain()
                self.blockchain_checkpoint = chain.get_checkpoint()
                self.blockchain_name = chain.get_name()
                if self.network.interface:
                    self.server_host = self.network.interface.host
       -        if event == 'updated':
       -            self.num_blocks = self.network.get_local_height()
       -            self.num_nodes = len(self.network.get_interfaces())
       +
       +    def on_network_event(self, event, *args):
       +        Logger.info('network event: '+ event)
       +        if event == 'interfaces':
       +            self._trigger_update_interfaces()
       +        elif event == 'updated':
                    self._trigger_update_wallet()
                    self._trigger_update_status()
                elif event == 'status':
       t@@ -624,6 +629,7 @@ class ElectrumWindow(App):
                run_hook('load_wallet', wallet, self)
        
            def update_status(self, *dt):
       +        self.num_blocks = self.network.get_local_height()
                if not self.wallet:
                    self.status = _("No Wallet")
                    return