mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 01:11:35 +00:00
kivy: show synchronization status in the balance field
This commit is contained in:
parent
75f6ab9133
commit
27caa683fe
3 changed files with 13 additions and 17 deletions
|
@ -435,7 +435,7 @@ BoxLayout:
|
|||
size_hint: 1, 1
|
||||
bold: True
|
||||
color: 0.7, 0.7, 0.7, 1
|
||||
text: app.status
|
||||
text: app.wallet_name
|
||||
font_size: '22dp'
|
||||
#minimum_width: '1dp'
|
||||
on_release: app.popup_dialog('status')
|
||||
|
|
|
@ -193,8 +193,8 @@ class ElectrumWindow(App):
|
|||
self._trigger_update_status()
|
||||
self._trigger_update_history()
|
||||
|
||||
wallet_name = StringProperty(_('No Wallet'))
|
||||
base_unit = AliasProperty(_get_bu, _set_bu)
|
||||
status = StringProperty('')
|
||||
fiat_unit = StringProperty('')
|
||||
|
||||
def on_fiat_unit(self, a, b):
|
||||
|
@ -308,9 +308,6 @@ class ElectrumWindow(App):
|
|||
self._password_dialog = None
|
||||
self.fee_status = self.electrum_config.get_fee_status()
|
||||
|
||||
def wallet_name(self):
|
||||
return os.path.basename(self.wallet.storage.path) if self.wallet else ' '
|
||||
|
||||
def on_pr(self, pr):
|
||||
if not self.wallet:
|
||||
self.show_error(_('No wallet loaded.'))
|
||||
|
@ -547,8 +544,6 @@ class ElectrumWindow(App):
|
|||
else:
|
||||
self.load_wallet(wallet)
|
||||
else:
|
||||
Logger.debug('Electrum: Wallet not found or action needed. Launching install wizard')
|
||||
|
||||
def launch_wizard():
|
||||
storage = WalletStorage(path, manual_upgrades=True)
|
||||
wizard = Factory.InstallWizard(self.electrum_config, self.plugins, storage)
|
||||
|
@ -559,7 +554,6 @@ class ElectrumWindow(App):
|
|||
launch_wizard()
|
||||
else:
|
||||
from .uix.dialogs.question import Question
|
||||
|
||||
def handle_answer(b: bool):
|
||||
if b:
|
||||
launch_wizard()
|
||||
|
@ -705,6 +699,7 @@ class ElectrumWindow(App):
|
|||
if self.wallet:
|
||||
self.stop_wallet()
|
||||
self.wallet = wallet
|
||||
self.wallet_name = wallet.basename()
|
||||
self.update_wallet()
|
||||
# Once GUI has been initialized check if we want to announce something
|
||||
# since the callback has been called before the GUI was initialized
|
||||
|
@ -719,13 +714,12 @@ class ElectrumWindow(App):
|
|||
send_exception_to_crash_reporter(e)
|
||||
|
||||
def update_status(self, *dt):
|
||||
self.num_blocks = self.network.get_local_height()
|
||||
if not self.wallet:
|
||||
self.status = _("No Wallet")
|
||||
return
|
||||
if self.network is None or not self.network.is_connected():
|
||||
status = _("Offline")
|
||||
elif self.network.is_connected():
|
||||
self.num_blocks = self.network.get_local_height()
|
||||
server_height = self.network.get_server_height()
|
||||
server_lag = self.num_blocks - server_height
|
||||
if not self.wallet.up_to_date or server_height == 0:
|
||||
|
@ -736,12 +730,14 @@ class ElectrumWindow(App):
|
|||
status = ''
|
||||
else:
|
||||
status = _("Disconnected")
|
||||
self.status = self.wallet.basename() + (' [size=15dp](%s)[/size]'%status if status else '')
|
||||
# balance
|
||||
c, u, x = self.wallet.get_balance()
|
||||
text = self.format_amount(c+x+u)
|
||||
self.balance = str(text.strip()) + ' [size=22dp]%s[/size]'% self.base_unit
|
||||
self.fiat_balance = self.fx.format_amount(c+u+x) + ' [size=22dp]%s[/size]'% self.fx.ccy
|
||||
if status:
|
||||
self.balance = status
|
||||
self.fiat_balance = status
|
||||
else:
|
||||
c, u, x = self.wallet.get_balance()
|
||||
text = self.format_amount(c+x+u)
|
||||
self.balance = str(text.strip()) + ' [size=22dp]%s[/size]'% self.base_unit
|
||||
self.fiat_balance = self.fx.format_amount(c+u+x) + ' [size=22dp]%s[/size]'% self.fx.ccy
|
||||
|
||||
def get_max_amount(self):
|
||||
from electrum.transaction import TxOutput
|
||||
|
|
|
@ -25,7 +25,7 @@ Popup:
|
|||
spacing: '10dp'
|
||||
BoxLabel:
|
||||
text: _('Wallet Name')
|
||||
value: app.wallet_name()
|
||||
value: app.wallet_name
|
||||
BoxLabel:
|
||||
text: _("Wallet type:")
|
||||
value: app.wallet.wallet_type
|
||||
|
|
Loading…
Add table
Reference in a new issue