kivy: display status of invoices and requests
This commit is contained in:
parent
84ac33f589
commit
6b13ed1f45
|
@ -350,6 +350,18 @@ class ContactsScreen(CScreen):
|
|||
contact_list.add_widget(ci)
|
||||
|
||||
|
||||
pr_text = {
|
||||
PR_UNPAID:_('Pending'),
|
||||
PR_PAID:_('Paid'),
|
||||
PR_EXPIRED:_('Expired')
|
||||
}
|
||||
pr_icon = {
|
||||
PR_UNPAID: 'atlas://gui/kivy/theming/light/important',
|
||||
PR_PAID: 'atlas://gui/kivy/theming/light/confirmed',
|
||||
PR_EXPIRED: 'atlas://gui/kivy/theming/light/close'
|
||||
}
|
||||
|
||||
|
||||
class InvoicesScreen(CScreen):
|
||||
kvname = 'invoices'
|
||||
|
||||
|
@ -366,12 +378,8 @@ class InvoicesScreen(CScreen):
|
|||
ci.memo = pr.memo
|
||||
ci.amount = self.app.format_amount_and_units(pr.get_amount())
|
||||
status = self.app.invoices.get_status(ci.key)
|
||||
if status == PR_PAID:
|
||||
ci.icon = "atlas://gui/kivy/theming/light/confirmed"
|
||||
elif status == PR_EXPIRED:
|
||||
ci.icon = "atlas://gui/kivy/theming/light/important"
|
||||
else:
|
||||
ci.icon = "atlas://gui/kivy/theming/light/important"
|
||||
ci.status = pr_text[status]
|
||||
ci.icon = pr_icon[status]
|
||||
exp = pr.get_expiration_date()
|
||||
ci.date = format_time(exp) if exp else _('Never')
|
||||
ci.screen = self
|
||||
|
@ -409,12 +417,8 @@ class RequestsScreen(CScreen):
|
|||
ci.address = req['address']
|
||||
ci.memo = self.app.wallet.get_label(address)
|
||||
status = req.get('status')
|
||||
if status == PR_PAID:
|
||||
ci.icon = "atlas://gui/kivy/theming/light/confirmed"
|
||||
elif status == PR_EXPIRED:
|
||||
ci.icon = "atlas://gui/kivy/theming/light/important"
|
||||
else:
|
||||
ci.icon = "atlas://gui/kivy/theming/light/important"
|
||||
ci.status = pr_text[status]
|
||||
ci.icon = pr_icon[status]
|
||||
ci.amount = self.app.format_amount_and_units(amount) if amount else ''
|
||||
ci.date = format_time(timestamp)
|
||||
ci.screen = self
|
||||
|
|
|
@ -25,18 +25,31 @@
|
|||
InvoicesLabel:
|
||||
text: root.requestor
|
||||
shorten: True
|
||||
Widget
|
||||
InvoicesLabel:
|
||||
text: root.memo
|
||||
color: .699, .699, .699, 1
|
||||
font_size: '13sp'
|
||||
shorten: True
|
||||
Widget
|
||||
BoxLayout:
|
||||
spacing: '8dp'
|
||||
height: '32dp'
|
||||
orientation: 'vertical'
|
||||
Widget
|
||||
InvoicesLabel:
|
||||
halign: 'right'
|
||||
font_size: '15sp'
|
||||
size_hint: None, 1
|
||||
width: '110sp'
|
||||
text: root.amount
|
||||
font_size: '15sp'
|
||||
halign: 'right'
|
||||
width: '110sp'
|
||||
Widget
|
||||
InvoicesLabel:
|
||||
text: root.status
|
||||
font_size: '13sp'
|
||||
halign: 'right'
|
||||
color: .699, .699, .699, 1
|
||||
Widget
|
||||
|
||||
|
||||
InvoicesScreen:
|
||||
name: 'invoices'
|
||||
|
|
|
@ -25,18 +25,30 @@
|
|||
RequestLabel:
|
||||
text: root.address
|
||||
shorten: True
|
||||
Widget
|
||||
RequestLabel:
|
||||
text: root.memo
|
||||
color: .699, .699, .699, 1
|
||||
font_size: '13sp'
|
||||
shorten: True
|
||||
Widget
|
||||
BoxLayout:
|
||||
spacing: '8dp'
|
||||
height: '32dp'
|
||||
orientation: 'vertical'
|
||||
Widget
|
||||
RequestLabel:
|
||||
text: root.amount
|
||||
halign: 'right'
|
||||
font_size: '15sp'
|
||||
size_hint: None, 1
|
||||
width: '110sp'
|
||||
text: root.amount
|
||||
Widget
|
||||
RequestLabel:
|
||||
text: root.status
|
||||
halign: 'right'
|
||||
font_size: '13sp'
|
||||
color: .699, .699, .699, 1
|
||||
Widget
|
||||
|
||||
|
||||
|
||||
RequestsScreen:
|
||||
|
|
Loading…
Reference in New Issue