show 'server lagging' icon if server lags and client does not use auto-connect

This commit is contained in:
thomasv 2013-10-03 18:43:33 +02:00
parent e462ef48cd
commit 50c9830f79
5 changed files with 11 additions and 4 deletions

View File

@ -535,6 +535,9 @@ class ElectrumWindow(QMainWindow):
if not self.wallet.up_to_date:
text = _("Synchronizing...")
icon = QIcon(":icons/status_waiting.png")
elif self.network.is_lagging:
text = _("Server is lagging")
icon = QIcon(":icons/status_lagging.png")
else:
c, u = self.wallet.get_account_balance(self.current_account)
text = _( "Balance" ) + ": %s "%( self.format_amount(c) ) + self.base_unit()

View File

@ -15,6 +15,7 @@
<file>icons/status_connected.png</file>
<file>icons/status_disconnected.png</file>
<file>icons/status_waiting.png</file>
<file>icons/status_lagging.png</file>
<file>icons/switchgui.png</file>
<file>icons/unconfirmed.png</file>
<file>icons/network.png</file>

BIN
icons/status_lagging.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -37,6 +37,7 @@ class Blockchain(threading.Thread):
self.set_local_height()
self.queue = Queue.Queue()
self.servers_height = {}
self.is_lagging = False
def stop(self):
@ -91,15 +92,17 @@ class Blockchain(threading.Thread):
print_error("error", i.server)
# todo: dismiss that server
self.network.trigger_callback('updated')
h = self.servers_height.get(self.network.interface.server)
if h is not None and h < height - 1:
print_error( "Server is lagging", height, h)
if self.config.get('auto_cycle'):
self.network.set_server(i.server)
else:
self.network.interface.stop()
self.network.is_lagging = True
else:
self.network.is_lagging = False
self.network.trigger_callback('updated')

View File

@ -10,7 +10,7 @@ if __name__ == '__main__':
sys.exit()
os.system("python mki18n.py")
os.system("pyrcc4 icons.qrc -o gui/icons_rc.py")
os.system("pyrcc4 icons.qrc -o gui/qt/icons_rc.py")
os.system("python setup.py sdist --format=zip,gztar")
_tgz="Electrum-%s.tar.gz"%version