commit dddc79adddb8871ea654250fed41300f988d06e4
parent 135eafd966d18f93d15abc54280a6c91a4159ebe
Author: ThomasV <thomasv@electrum.org>
Date: Thu, 11 Feb 2016 10:52:32 +0100
kivy: improve transaction details dialog
Diffstat:
2 files changed, 55 insertions(+), 19 deletions(-)
diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py
@@ -642,8 +642,38 @@ class ElectrumWindow(App):
info_bubble.show(pos, duration, width, modal=modal, exit=exit)
def tx_details_dialog(self, obj):
+ tx_hash = obj.tx_hash
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()
def address_dialog(self, screen):
diff --git a/gui/kivy/uix/ui_screens/transaction.kv b/gui/kivy/uix/ui_screens/transaction.kv
@@ -8,33 +8,39 @@ Popup:
AnchorLayout:
anchor_x: 'center'
-
BoxLayout:
orientation: 'vertical'
-
- GridLayout:
- size_hint: 1, None
- height: '300dp'
- cols: 2
-
- Label:
- text: "txid"
- Label:
- text: popup.tx_hash
- size_hint_y: None
- text_size: self.width, None
+ Label:
+ id: txid_label
+ text_size: self.width, None
+ size: self.texture_size
+ Label:
+ id: status_label
+ text_size: self.width, None
+ size_hint: 1, 0.3
+ Label:
+ id: date_label
+ 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:
size_hint: 1, None
height: '48dp'
Widget:
- size_hint: 0.7, None
+ size_hint: 0.5, None
height: '48dp'
Button:
- size_hint: 0.3, None
+ size_hint: 0.5, None
height: '48dp'
text: _('OK')
on_release: popup.dismiss()
-
- Widget:
- size_hint: 1, None