Browse Source

show pruning level in network dialog (expert mode)

283
ecdsa 12 years ago
parent
commit
dbe981a89b
  1. 7
      gui/gui_classic.py
  2. 9
      lib/interface.py

7
gui/gui_classic.py

@ -2182,12 +2182,13 @@ class ElectrumWindow(QMainWindow):
label = _('Active Servers') if wallet.interface.servers else _('Default Servers') label = _('Active Servers') if wallet.interface.servers else _('Default Servers')
servers_list_widget = QTreeWidget(parent) 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.setMaximumHeight(150)
servers_list_widget.setColumnWidth(0, 240) servers_list_widget.setColumnWidth(0, 240)
for _host in servers_list.keys(): for _host in servers_list.keys():
_type = 'P' if servers_list[_host].get('pruning') else 'F' pruning_level = servers_list[_host].get('pruning')
servers_list_widget.addTopLevelItem(QTreeWidgetItem( [ _host, _type ] )) 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): def change_server(host, protocol=None):
pp = plist.get(host,DEFAULT_PORTS) pp = plist.get(host,DEFAULT_PORTS)

9
lib/interface.py

@ -123,7 +123,7 @@ class Interface(threading.Thread):
host = item[1] host = item[1]
ports = [] ports = []
version = None version = None
pruning = False pruning_level = '-'
if len(item) > 2: if len(item) > 2:
for v in item[2]: for v in item[2]:
if re.match("[stgh]\d*", v): if re.match("[stgh]\d*", v):
@ -132,14 +132,15 @@ class Interface(threading.Thread):
ports.append((protocol, port)) ports.append((protocol, port))
elif re.match("v(.?)+", v): elif re.match("v(.?)+", v):
version = v[1:] version = v[1:]
elif v == 'p': elif re.match("p\d*", v):
pruning = True pruning_level = v[1:]
if pruning_level == '': pruning_level = '0'
try: try:
is_recent = float(version)>=float(PROTOCOL_VERSION) is_recent = float(version)>=float(PROTOCOL_VERSION)
except: except:
is_recent = False is_recent = False
if ports and is_recent: if ports and is_recent:
servers[host] = {'ports':ports, 'pruning':pruning} servers[host] = {'ports':ports, 'pruning':pruning_level}
self.servers = servers self.servers = servers
self.trigger_callback('peers') self.trigger_callback('peers')

Loading…
Cancel
Save