kivy: add invoice details dialog

This commit is contained in:
ThomasV 2016-02-11 11:40:23 +01:00
parent dddc79addd
commit 24560e03a9
4 changed files with 59 additions and 5 deletions

View File

@ -676,6 +676,7 @@ class ElectrumWindow(App):
popup.ids.date_label.text = _('Date') + ': '+ time_str
popup.open()
def address_dialog(self, screen):
pass

View File

@ -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():

View File

@ -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()

View File

@ -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'