Browse Source

fix amount_sat in kivy invoice/request dialogs. (follow-up d5f368c584)

bip39-recovery
ThomasV 5 years ago
parent
commit
01202ed3eb
  1. 5
      electrum/gui/kivy/uix/dialogs/invoice_dialog.py
  2. 7
      electrum/gui/kivy/uix/dialogs/request_dialog.py

5
electrum/gui/kivy/uix/dialogs/invoice_dialog.py

@ -17,7 +17,7 @@ if TYPE_CHECKING:
Builder.load_string(''' Builder.load_string('''
<InvoiceDialog@Popup> <InvoiceDialog@Popup>
id: popup id: popup
amount: None amount_str: ''
title: '' title: ''
data: '' data: ''
description:'' description:''
@ -44,7 +44,7 @@ Builder.load_string('''
RefLabel: RefLabel:
data: root.description or _('No description') data: root.description or _('No description')
TopLabel: TopLabel:
text: _('Amount') + ': ' + app.format_amount_and_units(root.amount_sat) text: _('Amount') + ': ' + root.amount_str
TopLabel: TopLabel:
text: _('Status') + ': ' + root.status_str text: _('Status') + ': ' + root.status_str
color: root.status_color color: root.status_color
@ -94,6 +94,7 @@ class InvoiceDialog(Factory.Popup):
self.key = key self.key = key
invoice = self.app.wallet.get_invoice(key) invoice = self.app.wallet.get_invoice(key)
self.amount_sat = invoice.get_amount_sat() self.amount_sat = invoice.get_amount_sat()
self.amount_str = self.app.format_amount_and_units(self.amount_sat)
self.description = invoice.message self.description = invoice.message
self.is_lightning = invoice.is_lightning() self.is_lightning = invoice.is_lightning()
self.update_status() self.update_status()

7
electrum/gui/kivy/uix/dialogs/request_dialog.py

@ -17,7 +17,7 @@ if TYPE_CHECKING:
Builder.load_string(''' Builder.load_string('''
<RequestDialog@Popup> <RequestDialog@Popup>
id: popup id: popup
amount: 0 amount_str: ''
title: '' title: ''
description:'' description:''
is_lightning: False is_lightning: False
@ -44,7 +44,7 @@ Builder.load_string('''
TopLabel: TopLabel:
text: _('Description') + ': ' + root.description or _('None') text: _('Description') + ': ' + root.description or _('None')
TopLabel: TopLabel:
text: _('Amount') + ': ' + app.format_amount_and_units(root.amount_sat) text: _('Amount') + ': ' + root.amount_str
TopLabel: TopLabel:
text: (_('Address') if not root.is_lightning else _('Payment hash')) + ': ' text: (_('Address') if not root.is_lightning else _('Payment hash')) + ': '
RefLabel: RefLabel:
@ -93,7 +93,8 @@ class RequestDialog(Factory.Popup):
r = self.app.wallet.get_request(key) r = self.app.wallet.get_request(key)
self.is_lightning = r.is_lightning() self.is_lightning = r.is_lightning()
self.data = r.invoice if self.is_lightning else self.app.wallet.get_request_URI(r) self.data = r.invoice if self.is_lightning else self.app.wallet.get_request_URI(r)
self.amount_sat = r.get_amount_sat() or 0 self.amount_sat = r.get_amount_sat()
self.amount_str = self.app.format_amount_and_units(self.amount_sat)
self.description = r.message self.description = r.message
self.update_status() self.update_status()

Loading…
Cancel
Save