kivy: cleanup update_status

This commit is contained in:
ThomasV 2015-09-04 10:23:56 +02:00
parent 76c93b2b61
commit 31a4f38db4
1 changed files with 11 additions and 23 deletions

View File

@ -497,36 +497,24 @@ class ElectrumWindow(App):
if self.network is None or not self.network.is_running(): if self.network is None or not self.network.is_running():
text = _("Offline") text = _("Offline")
#icon = QIcon(":icons/status_disconnected.png")
elif self.network.is_connected(): elif self.network.is_connected():
if not self.wallet.up_to_date: server_height = self.network.get_server_height()
server_lag = self.network.get_local_height() - server_height
if not self.wallet.up_to_date or server_height == 0:
text = _("Synchronizing...") text = _("Synchronizing...")
#icon = QIcon(":icons/status_waiting.png") elif server_lag > 1:
elif self.network.server_lag > 1: text = _("Server is lagging (%d blocks)"%server_lag)
text = _("Server is lagging (%d blocks)"%self.network.server_lag)
#icon = QIcon(":icons/status_lagging.png")
else: else:
c, u = self.wallet.get_account_balance(self.current_account) c, u, x = self.wallet.get_account_balance(self.current_account)
text = self.format_amount(c) text = self.format_amount(c)
if u: if u:
unconfirmed = " [%s unconfirmed]"\ unconfirmed = " [%s unconfirmed]" %( self.format_amount(u, True).strip())
%( self.format_amount(u, True).strip()) if x:
quote_text = self.create_quote_text(Decimal(c+u)/100000000, unmatured = " [%s unmatured]"%(self.format_amount(x, True).strip())
mode='symbol') or '' quote_text = self.create_quote_text(Decimal(c+u+x)/100000000, mode='symbol') or ''
#r = {}
#run_hook('set_quote_text', c+u, r)
#quote = r.get(0)
#if quote:
# text += " (%s)"%quote
#self.notify(_("Balance: ") + text)
#icon = QIcon(":icons/status_connected.png")
else: else:
text = _("Not connected") text = _("Not connected")
#icon = QIcon(":icons/status_disconnected.png")
try: try:
status_card = self.root.main_screen.ids.tabs.ids.\ status_card = self.root.main_screen.ids.tabs.ids.\
screen_dashboard.ids.status_card screen_dashboard.ids.status_card