tnetwork dialog: refresh display on each new header - electrum - Electrum Bitcoin wallet (HTM) git clone https://git.parazyd.org/electrum (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules --- (DIR) commit ba2211f52e6cfafaac468e9635210a5eb2a96f5c (DIR) parent bf7deaa1fb2ac3b608305db3e30b32ff7c7d05ce (HTM) Author: ThomasV <thomasv@electrum.org> Date: Thu, 13 Jul 2017 17:23:24 +0200 network dialog: refresh display on each new header Diffstat: M gui/qt/network_dialog.py | 3 +-- M lib/network.py | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) --- (DIR) diff --git a/gui/qt/network_dialog.py b/gui/qt/network_dialog.py t@@ -46,9 +46,8 @@ class NetworkDialog(QDialog): vbox = QVBoxLayout(self) vbox.addLayout(self.nlayout.layout()) vbox.addLayout(Buttons(CloseButton(self))) - self.connect(self, QtCore.SIGNAL('updated'), self.on_update) - network.register_callback(self.on_network, ['updated']) + network.register_callback(self.on_network, ['updated', 'interfaces']) def on_network(self, event, *args): self.emit(QtCore.SIGNAL('updated'), event, *args) (DIR) diff --git a/lib/network.py b/lib/network.py t@@ -205,7 +205,7 @@ class Network(util.DaemonThread): config = {} # Do not use mutables as default values! util.DaemonThread.__init__(self) self.config = SimpleConfig(config) if type(config) == type({}) else config - self.num_server = 18 if not self.config.get('oneserver') else 0 + self.num_server = 10 if not self.config.get('oneserver') else 0 self.blockchains = { 0:Blockchain(self.config, 'blockchain_headers', None) } for x in os.listdir(self.config.path): if x.startswith('blockchain_fork_'): t@@ -215,7 +215,6 @@ class Network(util.DaemonThread): self.blockchain_index = config.get('blockchain_index', 0) if self.blockchain_index not in self.blockchains.keys(): self.blockchain_index = 0 - # Server for addresses and transactions self.default_server = self.config.get('server') # Sanitize default server t@@ -512,6 +511,7 @@ class Network(util.DaemonThread): if filtered: choice = random.choice(filtered) self.switch_to_interface(choice) + self.notify('updated') def switch_to_interface(self, server): '''Switch to server as our interface. If no connection exists nor t@@ -1004,9 +1004,8 @@ class Network(util.DaemonThread): self.request_header(interface, height - 1) else: pass - if interface == self.interface: - self.switch_lagging_interface() - self.notify('updated') + self.switch_lagging_interface() + self.notify('interfaces') def blockchain(self): if self.interface and self.interface.blockchain is not None: