kivy: improve transaction details dialog
This commit is contained in:
parent
135eafd966
commit
dddc79addd
|
@ -642,8 +642,38 @@ class ElectrumWindow(App):
|
||||||
info_bubble.show(pos, duration, width, modal=modal, exit=exit)
|
info_bubble.show(pos, duration, width, modal=modal, exit=exit)
|
||||||
|
|
||||||
def tx_details_dialog(self, obj):
|
def tx_details_dialog(self, obj):
|
||||||
|
tx_hash = obj.tx_hash
|
||||||
popup = Builder.load_file('gui/kivy/uix/ui_screens/transaction.kv')
|
popup = Builder.load_file('gui/kivy/uix/ui_screens/transaction.kv')
|
||||||
popup.tx_hash = obj.tx_hash
|
tx = self.wallet.transactions.get(tx_hash)
|
||||||
|
if not tx:
|
||||||
|
return
|
||||||
|
conf, timestamp = self.wallet.get_confirmations(tx_hash)
|
||||||
|
is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(tx)
|
||||||
|
if is_relevant:
|
||||||
|
if is_mine:
|
||||||
|
if fee is not None:
|
||||||
|
amount_str = _("Amount sent:")+' %s'% self.format_amount_and_units(-v+fee)
|
||||||
|
fee_str = _("Transaction fee")+': %s'% self.format_amount_and_units(-fee)
|
||||||
|
else:
|
||||||
|
amount_str = _("Amount sent:")+' %s'% self.format_amount_and_units(-v)
|
||||||
|
fee_str = _("Transaction fee")+': '+ _("unknown")
|
||||||
|
else:
|
||||||
|
amount_str = _("Amount received:")+' %s'% self.format_amount_and_units(v)
|
||||||
|
fee_str = ''
|
||||||
|
else:
|
||||||
|
amount_str = _("Transaction unrelated to your wallet")
|
||||||
|
fee_str = ''
|
||||||
|
if timestamp:
|
||||||
|
time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
|
||||||
|
else:
|
||||||
|
time_str = _('Pending')
|
||||||
|
status_str = _("%d confirmations")%conf
|
||||||
|
# update popup
|
||||||
|
popup.ids.txid_label.text = _('Transaction ID') + ' :\n' + ' '.join(map(''.join, zip(*[iter(tx_hash)]*4)))
|
||||||
|
popup.ids.amount_label.text = amount_str
|
||||||
|
popup.ids.fee_label.text = fee_str
|
||||||
|
popup.ids.status_label.text = _('Status') + ': ' + status_str
|
||||||
|
popup.ids.date_label.text = _('Date') + ': '+ time_str
|
||||||
popup.open()
|
popup.open()
|
||||||
|
|
||||||
def address_dialog(self, screen):
|
def address_dialog(self, screen):
|
||||||
|
|
|
@ -8,33 +8,39 @@ Popup:
|
||||||
|
|
||||||
AnchorLayout:
|
AnchorLayout:
|
||||||
anchor_x: 'center'
|
anchor_x: 'center'
|
||||||
|
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
|
Label:
|
||||||
GridLayout:
|
id: txid_label
|
||||||
size_hint: 1, None
|
text_size: self.width, None
|
||||||
height: '300dp'
|
size: self.texture_size
|
||||||
cols: 2
|
Label:
|
||||||
|
id: status_label
|
||||||
Label:
|
text_size: self.width, None
|
||||||
text: "txid"
|
size_hint: 1, 0.3
|
||||||
Label:
|
Label:
|
||||||
text: popup.tx_hash
|
id: date_label
|
||||||
size_hint_y: None
|
text_size: self.width, None
|
||||||
text_size: self.width, None
|
size_hint: 1, 0.3
|
||||||
|
Label:
|
||||||
|
id: amount_label
|
||||||
|
text_size: self.width, None
|
||||||
|
size_hint: 1, 0.3
|
||||||
|
Label:
|
||||||
|
id: fee_label
|
||||||
|
text_size: self.width, None
|
||||||
|
size_hint: 1, 0.3
|
||||||
|
Widget:
|
||||||
|
size_hint: 1, 0.3
|
||||||
|
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
Widget:
|
Widget:
|
||||||
size_hint: 0.7, None
|
size_hint: 0.5, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
Button:
|
Button:
|
||||||
size_hint: 0.3, None
|
size_hint: 0.5, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
text: _('OK')
|
text: _('OK')
|
||||||
on_release: popup.dismiss()
|
on_release: popup.dismiss()
|
||||||
|
|
||||||
Widget:
|
|
||||||
size_hint: 1, None
|
|
||||||
|
|
Loading…
Reference in New Issue