commit 05a9718b7c27d6c69165935c995e61c265f379de
parent 125247df8138cb2c4e5d6f5eaa612e98d1e25498
Author: ThomasV <thomasv@electrum.org>
Date: Fri, 14 Jul 2017 18:24:33 +0200
network dialog: show only populated chains
Diffstat:
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/gui/qt/network_dialog.py b/gui/qt/network_dialog.py
@@ -98,19 +98,20 @@ class NodesListWidget(QTreeWidget):
n_chains = len(network.blockchains)
if n_chains > 1:
for b in network.blockchains.values():
- name = network.get_blockchain_name(b)
- x = QTreeWidgetItem([name + '@%d'%checkpoint, '%d'%b.height()])
- x.setData(0, Qt.UserRole, 1)
- x.setData(1, Qt.UserRole, b.checkpoint)
- for i in network.interfaces.values():
- if i.blockchain == b:
+ items = filter(lambda i: i.blockchain==b, network.interfaces.values())
+ if items:
+ name = network.get_blockchain_name(b)
+ x = QTreeWidgetItem([name + '@%d'%checkpoint, '%d'%b.height()])
+ x.setData(0, Qt.UserRole, 1)
+ x.setData(1, Qt.UserRole, b.checkpoint)
+ for i in items:
star = ' *' if i == network.interface else ''
item = QTreeWidgetItem([i.host + star, '%d'%i.tip])
item.setData(0, Qt.UserRole, 0)
item.setData(1, Qt.UserRole, i.server)
x.addChild(item)
- self.addTopLevelItem(x)
- x.setExpanded(True)
+ self.addTopLevelItem(x)
+ x.setExpanded(True)
else:
for i in network.interfaces.values():
star = ' *' if i == network.interface else ''