commit 24560e03a92ad5d4100ff1625c5f2c82edb6d035
parent dddc79adddb8871ea654250fed41300f988d06e4
Author: ThomasV <thomasv@electrum.org>
Date: Thu, 11 Feb 2016 11:40:23 +0100
kivy: add invoice details dialog
Diffstat:
4 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py
@@ -676,6 +676,7 @@ class ElectrumWindow(App):
popup.ids.date_label.text = _('Date') + ': '+ time_str
popup.open()
+
def address_dialog(self, screen):
pass
diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py
@@ -378,7 +378,7 @@ class InvoicesScreen(CScreen):
kvname = 'invoices'
def update(self):
- self.menu_actions = [('Pay', self.do_pay), ('Delete', self.do_delete)]
+ self.menu_actions = [('Pay', self.do_pay), ('Details', self.do_view), ('Delete', self.do_delete)]
invoices_list = self.screen.ids.invoices_container
invoices_list.clear_widgets()
@@ -410,6 +410,20 @@ class InvoicesScreen(CScreen):
def do_pay(self, obj):
self.app.do_pay(obj)
+ def do_view(self, obj):
+ pr = self.app.invoices.get(obj.key)
+ pr.verify({})
+ exp = pr.get_expiration_date()
+ popup = Builder.load_file('gui/kivy/uix/ui_screens/invoice.kv')
+ popup.ids.requestor_label.text = _("Requestor") + ': ' + pr.get_requestor()
+ popup.ids.expiration_label.text = _('Expires') + ': ' + (format_time(exp) if exp else _('Never'))
+ popup.ids.memo_label.text = _("Description") + ': ' + pr.get_memo()
+ popup.ids.signature_label.text = _("Signature") + ': ' + pr.get_verify_status()
+ if pr.tx:
+ popup.ids.txid_label.text = _("Transaction ID") + ':\n' + ' '.join(map(''.join, zip(*[iter(pr.tx)]*4)))
+
+ popup.open()
+
def do_delete(self, obj):
from dialogs.question import Question
def cb():
diff --git a/gui/kivy/uix/ui_screens/invoice.kv b/gui/kivy/uix/ui_screens/invoice.kv
@@ -0,0 +1,43 @@
+#:import Decimal decimal.Decimal
+
+Popup:
+ id: popup
+ title: _('Invoice')
+ AnchorLayout:
+ anchor_x: 'center'
+ BoxLayout:
+ orientation: 'vertical'
+ Label:
+ id: requestor_label
+ text_size: self.width, None
+ size_hint: 1, 0.3
+ Label:
+ id: expiration_label
+ text_size: self.width, None
+ size_hint: 1, 0.3
+ Label:
+ id: memo_label
+ text_size: self.width, None
+ size_hint: 1, 0.3
+ Label:
+ id: signature_label
+ text_size: self.width, None
+ size_hint: 1, 0.3
+ Label:
+ id: txid_label
+ text_size: self.width, None
+ size: self.texture_size
+ Widget:
+ size_hint: 1, 0.3
+
+ BoxLayout:
+ size_hint: 1, None
+ height: '48dp'
+ Widget:
+ size_hint: 0.5, None
+ height: '48dp'
+ Button:
+ size_hint: 0.5, None
+ height: '48dp'
+ text: _('OK')
+ on_release: popup.dismiss()
diff --git a/gui/kivy/uix/ui_screens/transaction.kv b/gui/kivy/uix/ui_screens/transaction.kv
@@ -1,11 +1,8 @@
#:import Decimal decimal.Decimal
-
Popup:
id: popup
title: _('Transaction')
- tx_hash: ''
-
AnchorLayout:
anchor_x: 'center'
BoxLayout:
@@ -32,7 +29,6 @@ Popup:
size_hint: 1, 0.3
Widget:
size_hint: 1, 0.3
-
BoxLayout:
size_hint: 1, None
height: '48dp'