kivy: add invoice details dialog
This commit is contained in:
parent
dddc79addd
commit
24560e03a9
|
@ -676,6 +676,7 @@ class ElectrumWindow(App):
|
||||||
popup.ids.date_label.text = _('Date') + ': '+ time_str
|
popup.ids.date_label.text = _('Date') + ': '+ time_str
|
||||||
popup.open()
|
popup.open()
|
||||||
|
|
||||||
|
|
||||||
def address_dialog(self, screen):
|
def address_dialog(self, screen):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ class InvoicesScreen(CScreen):
|
||||||
kvname = 'invoices'
|
kvname = 'invoices'
|
||||||
|
|
||||||
def update(self):
|
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 = self.screen.ids.invoices_container
|
||||||
invoices_list.clear_widgets()
|
invoices_list.clear_widgets()
|
||||||
|
|
||||||
|
@ -410,6 +410,20 @@ class InvoicesScreen(CScreen):
|
||||||
def do_pay(self, obj):
|
def do_pay(self, obj):
|
||||||
self.app.do_pay(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):
|
def do_delete(self, obj):
|
||||||
from dialogs.question import Question
|
from dialogs.question import Question
|
||||||
def cb():
|
def cb():
|
||||||
|
|
|
@ -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()
|
|
@ -1,11 +1,8 @@
|
||||||
#:import Decimal decimal.Decimal
|
#:import Decimal decimal.Decimal
|
||||||
|
|
||||||
|
|
||||||
Popup:
|
Popup:
|
||||||
id: popup
|
id: popup
|
||||||
title: _('Transaction')
|
title: _('Transaction')
|
||||||
tx_hash: ''
|
|
||||||
|
|
||||||
AnchorLayout:
|
AnchorLayout:
|
||||||
anchor_x: 'center'
|
anchor_x: 'center'
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
|
@ -32,7 +29,6 @@ Popup:
|
||||||
size_hint: 1, 0.3
|
size_hint: 1, 0.3
|
||||||
Widget:
|
Widget:
|
||||||
size_hint: 1, 0.3
|
size_hint: 1, 0.3
|
||||||
|
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
|
|
Loading…
Reference in New Issue