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)
|
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):
|
class InvoicesScreen(CScreen):
|
||||||
kvname = 'invoices'
|
kvname = 'invoices'
|
||||||
|
|
||||||
|
@ -366,12 +378,8 @@ class InvoicesScreen(CScreen):
|
||||||
ci.memo = pr.memo
|
ci.memo = pr.memo
|
||||||
ci.amount = self.app.format_amount_and_units(pr.get_amount())
|
ci.amount = self.app.format_amount_and_units(pr.get_amount())
|
||||||
status = self.app.invoices.get_status(ci.key)
|
status = self.app.invoices.get_status(ci.key)
|
||||||
if status == PR_PAID:
|
ci.status = pr_text[status]
|
||||||
ci.icon = "atlas://gui/kivy/theming/light/confirmed"
|
ci.icon = pr_icon[status]
|
||||||
elif status == PR_EXPIRED:
|
|
||||||
ci.icon = "atlas://gui/kivy/theming/light/important"
|
|
||||||
else:
|
|
||||||
ci.icon = "atlas://gui/kivy/theming/light/important"
|
|
||||||
exp = pr.get_expiration_date()
|
exp = pr.get_expiration_date()
|
||||||
ci.date = format_time(exp) if exp else _('Never')
|
ci.date = format_time(exp) if exp else _('Never')
|
||||||
ci.screen = self
|
ci.screen = self
|
||||||
|
@ -409,12 +417,8 @@ class RequestsScreen(CScreen):
|
||||||
ci.address = req['address']
|
ci.address = req['address']
|
||||||
ci.memo = self.app.wallet.get_label(address)
|
ci.memo = self.app.wallet.get_label(address)
|
||||||
status = req.get('status')
|
status = req.get('status')
|
||||||
if status == PR_PAID:
|
ci.status = pr_text[status]
|
||||||
ci.icon = "atlas://gui/kivy/theming/light/confirmed"
|
ci.icon = pr_icon[status]
|
||||||
elif status == PR_EXPIRED:
|
|
||||||
ci.icon = "atlas://gui/kivy/theming/light/important"
|
|
||||||
else:
|
|
||||||
ci.icon = "atlas://gui/kivy/theming/light/important"
|
|
||||||
ci.amount = self.app.format_amount_and_units(amount) if amount else ''
|
ci.amount = self.app.format_amount_and_units(amount) if amount else ''
|
||||||
ci.date = format_time(timestamp)
|
ci.date = format_time(timestamp)
|
||||||
ci.screen = self
|
ci.screen = self
|
||||||
|
|
|
@ -25,18 +25,31 @@
|
||||||
InvoicesLabel:
|
InvoicesLabel:
|
||||||
text: root.requestor
|
text: root.requestor
|
||||||
shorten: True
|
shorten: True
|
||||||
|
Widget
|
||||||
InvoicesLabel:
|
InvoicesLabel:
|
||||||
text: root.memo
|
text: root.memo
|
||||||
color: .699, .699, .699, 1
|
color: .699, .699, .699, 1
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
shorten: True
|
shorten: True
|
||||||
Widget
|
Widget
|
||||||
|
BoxLayout:
|
||||||
|
spacing: '8dp'
|
||||||
|
height: '32dp'
|
||||||
|
orientation: 'vertical'
|
||||||
|
Widget
|
||||||
InvoicesLabel:
|
InvoicesLabel:
|
||||||
halign: 'right'
|
|
||||||
font_size: '15sp'
|
|
||||||
size_hint: None, 1
|
|
||||||
width: '110sp'
|
|
||||||
text: root.amount
|
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:
|
InvoicesScreen:
|
||||||
name: 'invoices'
|
name: 'invoices'
|
||||||
|
|
|
@ -25,18 +25,30 @@
|
||||||
RequestLabel:
|
RequestLabel:
|
||||||
text: root.address
|
text: root.address
|
||||||
shorten: True
|
shorten: True
|
||||||
|
Widget
|
||||||
RequestLabel:
|
RequestLabel:
|
||||||
text: root.memo
|
text: root.memo
|
||||||
color: .699, .699, .699, 1
|
color: .699, .699, .699, 1
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
shorten: True
|
shorten: True
|
||||||
Widget
|
Widget
|
||||||
|
BoxLayout:
|
||||||
|
spacing: '8dp'
|
||||||
|
height: '32dp'
|
||||||
|
orientation: 'vertical'
|
||||||
|
Widget
|
||||||
RequestLabel:
|
RequestLabel:
|
||||||
|
text: root.amount
|
||||||
halign: 'right'
|
halign: 'right'
|
||||||
font_size: '15sp'
|
font_size: '15sp'
|
||||||
size_hint: None, 1
|
Widget
|
||||||
width: '110sp'
|
RequestLabel:
|
||||||
text: root.amount
|
text: root.status
|
||||||
|
halign: 'right'
|
||||||
|
font_size: '13sp'
|
||||||
|
color: .699, .699, .699, 1
|
||||||
|
Widget
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RequestsScreen:
|
RequestsScreen:
|
||||||
|
|
Loading…
Reference in New Issue