electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 2385cc3ad8f1a72cafca42137272735bd1fdc2a1
parent 50064d20fd46c827e88cc4bee82d3d7d7a58eba9
Author: thomasv <thomasv@gitorious>
Date:   Tue, 20 Nov 2012 13:33:36 +0100

show server type (pruning or full)

Diffstat:
Mlib/gui_qt.py | 9+++++----
Mlib/interface.py | 19+++++++++++--------
2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/lib/gui_qt.py b/lib/gui_qt.py @@ -1430,11 +1430,12 @@ class ElectrumWindow(QMainWindow): label = _('Active Servers') if wallet.interface.servers else _('Default Servers') servers_list_widget = QTreeWidget(parent) - servers_list_widget.setHeaderLabels( [ label ] ) + servers_list_widget.setHeaderLabels( [ label, _('Type') ] ) servers_list_widget.setMaximumHeight(150) - for _host, _x in servers_list: - servers_list_widget.addTopLevelItem(QTreeWidgetItem( [ _host ] )) - + servers_list_widget.setColumnWidth(0, 250) + for _host in servers_list.keys(): + _type = 'pruning' if servers_list[_host].get('pruning') else 'full' + servers_list_widget.addTopLevelItem(QTreeWidgetItem( [ _host, _type ] )) def change_server(host, protocol=None): pp = plist.get(host,DEFAULT_PORTS) diff --git a/lib/interface.py b/lib/interface.py @@ -101,24 +101,27 @@ class Interface(threading.Thread): self.server_version = result elif method == 'server.peers.subscribe': - servers = [] + servers = {} for item in result: s = [] host = item[1] ports = [] version = None + pruning = False if len(item) > 2: for v in item[2]: if re.match("[stgh]\d+", v): ports.append((v[0], v[1:])) - if re.match("v(.?)+", v): + elif re.match("v(.?)+", v): version = v[1:] + elif v == 'p': + pruning = True try: is_recent = float(version)>=float(PROTOCOL_VERSION) except: is_recent = False if ports and is_recent: - servers.append((host, ports)) + servers[host] = {'ports':ports, 'pruning':pruning} self.servers = servers self.trigger_callback('peers') @@ -367,7 +370,7 @@ class Interface(threading.Thread): self.callbacks = {} self.lock = threading.Lock() - self.servers = [] # actual list from IRC + self.servers = {} # actual list from IRC self.rtime = 0 self.bytes_received = 0 @@ -494,15 +497,15 @@ class Interface(threading.Thread): def get_servers_list(self): plist = {} if not self.servers: - servers_list = [] + servers_list = {} for x in DEFAULT_SERVERS: h,port,protocol = x.split(':') - servers_list.append( (h,[(protocol,port)] ) ) + servers_list[h] = {'ports':[(protocol,port)]} else: servers_list = self.servers - for item in servers_list: - _host, pp = item + for _host, v in servers_list.items(): + pp = v['ports'] z = {} for item2 in pp: _protocol, _port = item2