commit dbe981a89b26430d7ec2c8d1fd157fdf4546845a
parent 2d613a497efa5eb366637346273fbf76b61d520e
Author: ecdsa <ecdsa@github>
Date: Sat, 6 Apr 2013 16:06:15 +0200
show pruning level in network dialog (expert mode)
Diffstat:
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/gui/gui_classic.py b/gui/gui_classic.py
@@ -2182,12 +2182,13 @@ class ElectrumWindow(QMainWindow):
label = _('Active Servers') if wallet.interface.servers else _('Default Servers')
servers_list_widget = QTreeWidget(parent)
- servers_list_widget.setHeaderLabels( [ label, _('Type') ] )
+ servers_list_widget.setHeaderLabels( [ label, _('Pruning') ] )
servers_list_widget.setMaximumHeight(150)
servers_list_widget.setColumnWidth(0, 240)
for _host in servers_list.keys():
- _type = 'P' if servers_list[_host].get('pruning') else 'F'
- servers_list_widget.addTopLevelItem(QTreeWidgetItem( [ _host, _type ] ))
+ pruning_level = servers_list[_host].get('pruning')
+ servers_list_widget.addTopLevelItem(QTreeWidgetItem( [ _host, pruning_level ] ))
+ servers_list_widget.setColumnHidden(1, not parent.expert_mode if parent else True)
def change_server(host, protocol=None):
pp = plist.get(host,DEFAULT_PORTS)
diff --git a/lib/interface.py b/lib/interface.py
@@ -123,7 +123,7 @@ class Interface(threading.Thread):
host = item[1]
ports = []
version = None
- pruning = False
+ pruning_level = '-'
if len(item) > 2:
for v in item[2]:
if re.match("[stgh]\d*", v):
@@ -132,14 +132,15 @@ class Interface(threading.Thread):
ports.append((protocol, port))
elif re.match("v(.?)+", v):
version = v[1:]
- elif v == 'p':
- pruning = True
+ elif re.match("p\d*", v):
+ pruning_level = v[1:]
+ if pruning_level == '': pruning_level = '0'
try:
is_recent = float(version)>=float(PROTOCOL_VERSION)
except:
is_recent = False
if ports and is_recent:
- servers[host] = {'ports':ports, 'pruning':pruning}
+ servers[host] = {'ports':ports, 'pruning':pruning_level}
self.servers = servers
self.trigger_callback('peers')