Browse Source

kivy: do not display internal id of onchain invoice, show address instead

master
ThomasV 5 years ago
parent
commit
2904615211
  1. 7
      electrum/gui/kivy/uix/screens.py
  2. 3
      electrum/gui/kivy/uix/ui_screens/send.kv
  3. 2
      electrum/invoices.py

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

@ -230,6 +230,7 @@ class SendScreen(CScreen, Logger):
if is_lightning: if is_lightning:
assert isinstance(item, LNInvoice) assert isinstance(item, LNInvoice)
key = item.rhash key = item.rhash
address = key
log = self.app.wallet.lnworker.logs.get(key) log = self.app.wallet.lnworker.logs.get(key)
if status == PR_INFLIGHT and log: if status == PR_INFLIGHT and log:
status_str += '... (%d)'%len(log) status_str += '... (%d)'%len(log)
@ -237,6 +238,7 @@ class SendScreen(CScreen, Logger):
else: else:
assert isinstance(item, OnchainInvoice) assert isinstance(item, OnchainInvoice)
key = item.id key = item.id
address = item.get_address()
is_bip70 = bool(item.bip70) is_bip70 = bool(item.bip70)
return { return {
'is_lightning': is_lightning, 'is_lightning': is_lightning,
@ -245,7 +247,8 @@ class SendScreen(CScreen, Logger):
'status': status, 'status': status,
'status_str': status_str, 'status_str': status_str,
'key': key, 'key': key,
'memo': item.message, 'memo': item.message or _('No Description'),
'address': address,
'amount': self.app.format_amount_and_units(item.get_amount_sat() or 0), 'amount': self.app.format_amount_and_units(item.get_amount_sat() or 0),
} }
@ -505,7 +508,7 @@ class ReceiveScreen(CScreen):
ci['is_lightning'] = is_lightning ci['is_lightning'] = is_lightning
ci['key'] = key ci['key'] = key
ci['amount'] = self.app.format_amount_and_units(amount) if amount else '' ci['amount'] = self.app.format_amount_and_units(amount) if amount else ''
ci['memo'] = description ci['memo'] = description or _('No Description')
ci['status'] = status ci['status'] = status
ci['status_str'] = status_str ci['status_str'] = status_str
return ci return ci

3
electrum/gui/kivy/uix/ui_screens/send.kv

@ -15,6 +15,7 @@
<PaymentItem@CardItem> <PaymentItem@CardItem>
key: '' key: ''
address: ''
memo: '' memo: ''
amount: '' amount: ''
status: PR_UNKNOWN status: PR_UNKNOWN
@ -31,7 +32,7 @@
shorten_from: 'right' shorten_from: 'right'
Widget Widget
PaymentLabel: PaymentLabel:
text: root.key text: root.address
color: .699, .699, .699, 1 color: .699, .699, .699, 1
font_size: '13sp' font_size: '13sp'
shorten: True shorten: True

2
electrum/invoices.py

@ -120,7 +120,7 @@ class OnchainInvoice(Invoice):
requestor = attr.ib(type=str, kw_only=True) # type: Optional[str] requestor = attr.ib(type=str, kw_only=True) # type: Optional[str]
def get_address(self) -> str: def get_address(self) -> str:
assert len(self.outputs) == 1 """returns the first address, to be displayed in GUI"""
return self.outputs[0].address return self.outputs[0].address
def get_amount_sat(self) -> Union[int, str]: def get_amount_sat(self) -> Union[int, str]:

Loading…
Cancel
Save