commit 6b13ed1f454bb04caa90a9f96c3d47b01f61b81c
parent 84ac33f589011bcc5aebf31a65d5f4d419034bf6
Author: ThomasV <thomasv@electrum.org>
Date: Fri, 5 Feb 2016 19:40:05 +0100
kivy: display status of invoices and requests
Diffstat:
3 files changed, 53 insertions(+), 24 deletions(-)
diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py
@@ -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
diff --git a/gui/kivy/uix/ui_screens/invoices.kv b/gui/kivy/uix/ui_screens/invoices.kv
@@ -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
- InvoicesLabel:
- halign: 'right'
- font_size: '15sp'
- size_hint: None, 1
- width: '110sp'
- text: root.amount
+ BoxLayout:
+ spacing: '8dp'
+ height: '32dp'
+ orientation: 'vertical'
+ Widget
+ InvoicesLabel:
+ 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'
diff --git a/gui/kivy/uix/ui_screens/requests.kv b/gui/kivy/uix/ui_screens/requests.kv
@@ -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
- RequestLabel:
- halign: 'right'
- font_size: '15sp'
- size_hint: None, 1
- width: '110sp'
- text: root.amount
+ BoxLayout:
+ spacing: '8dp'
+ height: '32dp'
+ orientation: 'vertical'
+ Widget
+ RequestLabel:
+ text: root.amount
+ halign: 'right'
+ font_size: '15sp'
+ Widget
+ RequestLabel:
+ text: root.status
+ halign: 'right'
+ font_size: '13sp'
+ color: .699, .699, .699, 1
+ Widget
+
RequestsScreen: