Browse Source

kivy: fix: when changing units or ccy, history list was not updated

When changing e.g. from mBTC to BTC, the history list was only
partially updated: the displayed amounts got updated but the
displayed unit did not, so incorrect information was shown.
patch-4
SomberNight 4 years ago
parent
commit
2881d1e62c
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 6
      electrum/gui/kivy/uix/screens.py
  2. 5
      electrum/gui/kivy/uix/ui_screens/history.kv

6
electrum/gui/kivy/uix/screens.py

@ -113,7 +113,6 @@ class HistoryScreen(CScreen):
timestamp = tx_item['timestamp'] timestamp = tx_item['timestamp']
key = tx_item.get('txid') or tx_item['payment_hash'] key = tx_item.get('txid') or tx_item['payment_hash']
if is_lightning: if is_lightning:
status = 0
status_str = 'unconfirmed' if timestamp is None else format_time(int(timestamp)) status_str = 'unconfirmed' if timestamp is None else format_time(int(timestamp))
icon = f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/lightning' icon = f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/lightning'
message = tx_item['label'] message = tx_item['label']
@ -122,7 +121,6 @@ class HistoryScreen(CScreen):
fee_text = '' if fee is None else 'fee: %d sat'%fee fee_text = '' if fee is None else 'fee: %d sat'%fee
else: else:
tx_hash = tx_item['txid'] tx_hash = tx_item['txid']
conf = tx_item['confirmations']
tx_mined_info = TxMinedInfo(height=tx_item['height'], tx_mined_info = TxMinedInfo(height=tx_item['height'],
conf=tx_item['confirmations'], conf=tx_item['confirmations'],
timestamp=tx_item['timestamp']) timestamp=tx_item['timestamp'])
@ -141,9 +139,11 @@ class HistoryScreen(CScreen):
value = tx_item['value'].value value = tx_item['value'].value
if value is not None: if value is not None:
ri['is_mine'] = value <= 0 ri['is_mine'] = value <= 0
ri['amount'] = self.app.format_amount(value, is_diff = True) ri['amount'] = self.app.format_amount(value, is_diff=True)
ri['base_unit'] = self.app.base_unit
if 'fiat_value' in tx_item: if 'fiat_value' in tx_item:
ri['quote_text'] = str(tx_item['fiat_value']) ri['quote_text'] = str(tx_item['fiat_value'])
ri['fx_ccy'] = tx_item['fiat_value'].ccy
return ri return ri
def update(self, see_all=False): def update(self, see_all=False):

5
electrum/gui/kivy/uix/ui_screens/history.kv

@ -22,11 +22,12 @@
is_mine: True is_mine: True
amount: '--' amount: '--'
amount_color: '#FF6657' if self.is_mine else '#2EA442' amount_color: '#FF6657' if self.is_mine else '#2EA442'
confirmations: 0
date: '' date: ''
quote_text: '' quote_text: ''
amount_str: self.quote_text if app.is_fiat else self.amount amount_str: self.quote_text if app.is_fiat else self.amount
unit_str: app.fx.ccy if app.is_fiat else app.base_unit base_unit: ''
fx_ccy: ''
unit_str: self.fx_ccy if app.is_fiat else self.base_unit
Image: Image:
id: icon id: icon
source: root.icon source: root.icon

Loading…
Cancel
Save