mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-27 15:31:31 +00:00
kivy: requests/invoices dialogs improvements
This commit is contained in:
parent
beac1c4ddc
commit
d19fc56eb8
4 changed files with 29 additions and 11 deletions
|
@ -20,6 +20,7 @@ Builder.load_string('''
|
||||||
amount: 0
|
amount: 0
|
||||||
title: ''
|
title: ''
|
||||||
data: ''
|
data: ''
|
||||||
|
description:''
|
||||||
status_color: 1,1,1,1
|
status_color: 1,1,1,1
|
||||||
status_str:''
|
status_str:''
|
||||||
warning: ''
|
warning: ''
|
||||||
|
@ -34,7 +35,14 @@ Builder.load_string('''
|
||||||
padding: '10dp'
|
padding: '10dp'
|
||||||
spacing: '10dp'
|
spacing: '10dp'
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: root.data
|
text: _('Invoice data')+ ':'
|
||||||
|
RefLabel:
|
||||||
|
data: root.data
|
||||||
|
name: _('Data')
|
||||||
|
TopLabel:
|
||||||
|
text: _('Description') + ':'
|
||||||
|
RefLabel:
|
||||||
|
data: root.description or _('No description')
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: _('Amount') + ': ' + app.format_amount_and_units(root.amount)
|
text: _('Amount') + ': ' + app.format_amount_and_units(root.amount)
|
||||||
TopLabel:
|
TopLabel:
|
||||||
|
@ -86,6 +94,7 @@ class InvoiceDialog(Factory.Popup):
|
||||||
self.key = key
|
self.key = key
|
||||||
r = self.app.wallet.get_invoice(key)
|
r = self.app.wallet.get_invoice(key)
|
||||||
self.amount = r.get('amount')
|
self.amount = r.get('amount')
|
||||||
|
self.description = r.get('message') or r.get('memo','')
|
||||||
self.is_lightning = r.get('type') == PR_TYPE_LN
|
self.is_lightning = r.get('type') == PR_TYPE_LN
|
||||||
self.update_status()
|
self.update_status()
|
||||||
self.log = self.app.wallet.lnworker.logs[self.key] if self.is_lightning else []
|
self.log = self.app.wallet.lnworker.logs[self.key] if self.is_lightning else []
|
||||||
|
|
|
@ -14,6 +14,7 @@ Builder.load_string('''
|
||||||
id: popup
|
id: popup
|
||||||
amount: 0
|
amount: 0
|
||||||
title: ''
|
title: ''
|
||||||
|
description:''
|
||||||
data: ''
|
data: ''
|
||||||
warning: ''
|
warning: ''
|
||||||
status_str: ''
|
status_str: ''
|
||||||
|
@ -35,7 +36,14 @@ Builder.load_string('''
|
||||||
touch = args[1]
|
touch = args[1]
|
||||||
if self.collide_point(*touch.pos): self.shaded = not self.shaded
|
if self.collide_point(*touch.pos): self.shaded = not self.shaded
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: root.data
|
text: _('Data')+ ':'
|
||||||
|
RefLabel:
|
||||||
|
data: root.data
|
||||||
|
name: _('Request data')
|
||||||
|
TopLabel:
|
||||||
|
text: _('Description') + ':'
|
||||||
|
RefLabel:
|
||||||
|
data: root.description or _('No description')
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: _('Amount') + ': ' + app.format_amount_and_units(root.amount)
|
text: _('Amount') + ': ' + app.format_amount_and_units(root.amount)
|
||||||
TopLabel:
|
TopLabel:
|
||||||
|
@ -82,6 +90,7 @@ class RequestDialog(Factory.Popup):
|
||||||
self.key = key
|
self.key = key
|
||||||
r = self.app.wallet.get_request(key)
|
r = self.app.wallet.get_request(key)
|
||||||
self.amount = r.get('amount')
|
self.amount = r.get('amount')
|
||||||
|
self.description = r.get('message', '')
|
||||||
self.is_lightning = r.get('type') == PR_TYPE_LN
|
self.is_lightning = r.get('type') == PR_TYPE_LN
|
||||||
self.update_status()
|
self.update_status()
|
||||||
|
|
||||||
|
|
|
@ -217,8 +217,6 @@ class SendScreen(CScreen):
|
||||||
self.payment_request_queued = None
|
self.payment_request_queued = None
|
||||||
_list = self.app.wallet.get_invoices()
|
_list = self.app.wallet.get_invoices()
|
||||||
_list.reverse()
|
_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 = self.ids.payments_container
|
||||||
payments_container.data = [self.get_card(item) for item in _list]
|
payments_container.data = [self.get_card(item) for item in _list]
|
||||||
|
|
||||||
|
@ -478,8 +476,8 @@ class ReceiveScreen(CScreen):
|
||||||
ci['key'] = key
|
ci['key'] = key
|
||||||
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['memo'] = description
|
ci['memo'] = description
|
||||||
ci['status'] = status_str
|
ci['status'] = status
|
||||||
ci['is_expired'] = status == PR_EXPIRED
|
ci['status_str'] = status_str
|
||||||
return ci
|
return ci
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
|
@ -488,7 +486,7 @@ class ReceiveScreen(CScreen):
|
||||||
_list = self.app.wallet.get_sorted_requests()
|
_list = self.app.wallet.get_sorted_requests()
|
||||||
_list.reverse()
|
_list.reverse()
|
||||||
requests_container = self.ids.requests_container
|
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):
|
def show_item(self, obj):
|
||||||
self.app.show_request(obj.is_lightning, obj.key)
|
self.app.show_request(obj.is_lightning, obj.key)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#:import _ electrum.gui.kivy.i18n._
|
#: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 Factory kivy.factory.Factory
|
||||||
#:import Decimal decimal.Decimal
|
#:import Decimal decimal.Decimal
|
||||||
#:set btc_symbol chr(171)
|
#:set btc_symbol chr(171)
|
||||||
|
@ -13,11 +15,11 @@
|
||||||
valign: 'top'
|
valign: 'top'
|
||||||
|
|
||||||
<RequestItem@CardItem>
|
<RequestItem@CardItem>
|
||||||
is_expired: False
|
|
||||||
address: ''
|
address: ''
|
||||||
memo: ''
|
memo: ''
|
||||||
amount: ''
|
amount: ''
|
||||||
status: ''
|
status_str: ''
|
||||||
|
status: PR_UNKNOWN
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
spacing: '8dp'
|
spacing: '8dp'
|
||||||
height: '32dp'
|
height: '32dp'
|
||||||
|
@ -44,10 +46,10 @@
|
||||||
font_size: '15sp'
|
font_size: '15sp'
|
||||||
Widget
|
Widget
|
||||||
RequestLabel:
|
RequestLabel:
|
||||||
text: root.status
|
text: root.status_str
|
||||||
halign: 'right'
|
halign: 'right'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1., .2, .2, 1) if root.is_expired else (.7, .7, .7, 1)
|
color: pr_color[root.status]
|
||||||
Widget
|
Widget
|
||||||
|
|
||||||
<RequestRecycleView>:
|
<RequestRecycleView>:
|
||||||
|
|
Loading…
Add table
Reference in a new issue