commit d08a0388b6b6550b6067820615dc10346864cb7d
parent 34ca6baf73f95940b7d4c6373a801c97d3ae5e3f
Author: ThomasV <thomasv@gitorious>
Date: Thu, 17 May 2012 13:15:55 +0200
display kilobytes received
Diffstat:
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/gui_qt.py b/lib/gui_qt.py
@@ -1202,10 +1202,12 @@ class ElectrumGui():
w.setLayout(vbox)
w.show()
def f():
- if self.wallet.up_to_date: w.close()
+ if self.wallet.up_to_date:
+ w.close()
else:
- l.setText("Please wait...\nGenerating addresses: %d"%len(self.wallet.all_addresses()))
- pass
+ l.setText("Please wait...\nAddresses generated: %d\nKilobytes received: %.1f"\
+ %(len(self.wallet.all_addresses()), self.wallet.interface.bytes_received/1024.))
+
w.connect(s, QtCore.SIGNAL('timersignal'), f)
self.wallet.interface.poke()
w.exec_()
diff --git a/lib/interface.py b/lib/interface.py
@@ -44,6 +44,7 @@ class Interface(threading.Thread):
self.servers = [] # actual list from IRC
self.rtime = 0
+ self.bytes_received = 0
self.is_connected = True
self.poll_interval = 1
@@ -188,6 +189,7 @@ class HttpStratumInterface(PollingInterface):
self.session_id = cookie.value
response = response_stream.read()
+ self.bytes_received += len(response)
if response:
response = json.loads( response )
if type(response) is not type([]):
@@ -238,6 +240,7 @@ class TcpStratumInterface(Interface):
self.send([('server.version', [ELECTRUM_VERSION])])
continue
out += msg
+ self.bytes_received += len(msg)
if msg == '':
self.is_connected = False
print "disconnected."