electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit d19fc56eb8875c16ced4ee7be0f048277f95189a
parent beac1c4ddc7e579155f3f1bbd51588d265beada5
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 10 Mar 2020 16:03:34 +0100

kivy: requests/invoices dialogs improvements

Diffstat:
Melectrum/gui/kivy/uix/dialogs/invoice_dialog.py | 11++++++++++-
Melectrum/gui/kivy/uix/dialogs/request_dialog.py | 11++++++++++-
Melectrum/gui/kivy/uix/screens.py | 8+++-----
Melectrum/gui/kivy/uix/ui_screens/receive.kv | 10++++++----
4 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/electrum/gui/kivy/uix/dialogs/invoice_dialog.py b/electrum/gui/kivy/uix/dialogs/invoice_dialog.py @@ -20,6 +20,7 @@ Builder.load_string(''' amount: 0 title: '' data: '' + description:'' status_color: 1,1,1,1 status_str:'' warning: '' @@ -34,7 +35,14 @@ Builder.load_string(''' padding: '10dp' spacing: '10dp' TopLabel: - text: root.data + text: _('Invoice data')+ ':' + RefLabel: + data: root.data + name: _('Data') + TopLabel: + text: _('Description') + ':' + RefLabel: + data: root.description or _('No description') TopLabel: text: _('Amount') + ': ' + app.format_amount_and_units(root.amount) TopLabel: @@ -86,6 +94,7 @@ class InvoiceDialog(Factory.Popup): self.key = key r = self.app.wallet.get_invoice(key) self.amount = r.get('amount') + self.description = r.get('message') or r.get('memo','') self.is_lightning = r.get('type') == PR_TYPE_LN self.update_status() self.log = self.app.wallet.lnworker.logs[self.key] if self.is_lightning else [] diff --git a/electrum/gui/kivy/uix/dialogs/request_dialog.py b/electrum/gui/kivy/uix/dialogs/request_dialog.py @@ -14,6 +14,7 @@ Builder.load_string(''' id: popup amount: 0 title: '' + description:'' data: '' warning: '' status_str: '' @@ -35,7 +36,14 @@ Builder.load_string(''' touch = args[1] if self.collide_point(*touch.pos): self.shaded = not self.shaded TopLabel: - text: root.data + text: _('Data')+ ':' + RefLabel: + data: root.data + name: _('Request data') + TopLabel: + text: _('Description') + ':' + RefLabel: + data: root.description or _('No description') TopLabel: text: _('Amount') + ': ' + app.format_amount_and_units(root.amount) TopLabel: @@ -82,6 +90,7 @@ class RequestDialog(Factory.Popup): self.key = key r = self.app.wallet.get_request(key) self.amount = r.get('amount') + self.description = r.get('message', '') self.is_lightning = r.get('type') == PR_TYPE_LN self.update_status() diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py @@ -217,8 +217,6 @@ class SendScreen(CScreen): self.payment_request_queued = None _list = self.app.wallet.get_invoices() _list.reverse() - lnworker_logs = self.app.wallet.lnworker.logs if self.app.wallet.lnworker else {} - _list = [x for x in _list if x and x.get('status') != PR_PAID or x.get('rhash') in lnworker_logs] payments_container = self.ids.payments_container payments_container.data = [self.get_card(item) for item in _list] @@ -478,8 +476,8 @@ class ReceiveScreen(CScreen): ci['key'] = key ci['amount'] = self.app.format_amount_and_units(amount) if amount else '' ci['memo'] = description - ci['status'] = status_str - ci['is_expired'] = status == PR_EXPIRED + ci['status'] = status + ci['status_str'] = status_str return ci def update(self): @@ -488,7 +486,7 @@ class ReceiveScreen(CScreen): _list = self.app.wallet.get_sorted_requests() _list.reverse() requests_container = self.ids.requests_container - requests_container.data = [self.get_card(item) for item in _list if item.get('status') != PR_PAID] + requests_container.data = [self.get_card(item) for item in _list] def show_item(self, obj): self.app.show_request(obj.is_lightning, obj.key) diff --git a/electrum/gui/kivy/uix/ui_screens/receive.kv b/electrum/gui/kivy/uix/ui_screens/receive.kv @@ -1,4 +1,6 @@ #:import _ electrum.gui.kivy.i18n._ +#:import pr_color electrum.util.pr_color +#:import PR_UNKNOWN electrum.util.PR_UNKNOWN #:import Factory kivy.factory.Factory #:import Decimal decimal.Decimal #:set btc_symbol chr(171) @@ -13,11 +15,11 @@ valign: 'top' <RequestItem@CardItem> - is_expired: False address: '' memo: '' amount: '' - status: '' + status_str: '' + status: PR_UNKNOWN BoxLayout: spacing: '8dp' height: '32dp' @@ -44,10 +46,10 @@ font_size: '15sp' Widget RequestLabel: - text: root.status + text: root.status_str halign: 'right' font_size: '13sp' - color: (1., .2, .2, 1) if root.is_expired else (.7, .7, .7, 1) + color: pr_color[root.status] Widget <RequestRecycleView>: