display kilobytes received
authorThomasV <thomasv@gitorious>
Thu, 17 May 2012 11:15:55 +0000 (13:15 +0200)
committerThomasV <thomasv@gitorious>
Thu, 17 May 2012 11:15:55 +0000 (13:15 +0200)
lib/gui_qt.py
lib/interface.py

index aab4577..5d76c0f 100644 (file)
@@ -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_()
index e19cccf..b58b6cb 100644 (file)
@@ -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."