kivy: improve layout of invoice and about dialogs
This commit is contained in:
parent
f1822a9603
commit
f89a90016e
|
@ -26,6 +26,12 @@
|
||||||
|
|
||||||
# Custom Global Widgets
|
# Custom Global Widgets
|
||||||
|
|
||||||
|
<TopLabel@Label>
|
||||||
|
valign: 'top'
|
||||||
|
size_hint_y: None
|
||||||
|
text_size: self.width, None
|
||||||
|
height: self.texture_size[1]
|
||||||
|
|
||||||
<EmptyLabel@Label>
|
<EmptyLabel@Label>
|
||||||
color: (0.8, 0.8, 0.8, 1)
|
color: (0.8, 0.8, 0.8, 1)
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
|
|
|
@ -285,25 +285,18 @@ class ElectrumWindow(App):
|
||||||
memo = req.get('memo')
|
memo = req.get('memo')
|
||||||
amount = req.get('amount')
|
amount = req.get('amount')
|
||||||
popup = Builder.load_file('gui/kivy/uix/ui_screens/invoice.kv')
|
popup = Builder.load_file('gui/kivy/uix/ui_screens/invoice.kv')
|
||||||
if is_invoice:
|
popup.is_invoice = is_invoice
|
||||||
popup.title = _('Invoice')
|
popup.amount = amount
|
||||||
popup.ids.requestor_label.text = _("Requestor") + ': ' + requestor
|
popup.requestor = requestor if is_invoice else req.get('address')
|
||||||
else:
|
popup.exp = format_time(exp) if exp else ''
|
||||||
popup.title = _('Request')
|
popup.description = memo if memo else ''
|
||||||
popup.ids.requestor_label.text = _("Address") + ': ' + req.get('address')
|
popup.signature = req.get('signature', '')
|
||||||
|
popup.status = status
|
||||||
popup.ids.amount_label.text = _('Amount') + ': ' + self.format_amount_and_units(amount) if amount else ''
|
|
||||||
popup.ids.expiration_label.text = _('Expires') + ': ' + format_time(exp) if exp else ''
|
|
||||||
popup.ids.memo_label.text = _("Description") + ': ' + memo if memo else _("No Description")
|
|
||||||
popup.ids.signature_label.text = req.get('signature', '')
|
|
||||||
|
|
||||||
popup.ids.txid_label.text = status
|
|
||||||
txid = req.get('txid')
|
txid = req.get('txid')
|
||||||
if txid:
|
if txid:
|
||||||
popup.ids.txid_label.text += '\n' + _("Transaction ID") + ':\n' + ' '.join(map(''.join, zip(*[iter(txid)]*4)))
|
popup.ids.txid_label.text = _("Transaction ID") + ':\n' + ' '.join(map(''.join, zip(*[iter(txid)]*4)))
|
||||||
popup.open()
|
popup.open()
|
||||||
|
|
||||||
|
|
||||||
def qr_dialog(self, title, data):
|
def qr_dialog(self, title, data):
|
||||||
from uix.dialogs.qr_dialog import QRDialog
|
from uix.dialogs.qr_dialog import QRDialog
|
||||||
popup = QRDialog(title, data)
|
popup = QRDialog(title, data)
|
||||||
|
|
|
@ -24,8 +24,7 @@ Builder.load_string('''
|
||||||
Label:
|
Label:
|
||||||
id: status_label
|
id: status_label
|
||||||
text: root.status_str
|
text: root.status_str
|
||||||
text_size: self.width, None
|
text_size: self.size
|
||||||
size: self.texture_size
|
|
||||||
Label:
|
Label:
|
||||||
id: amount_label
|
id: amount_label
|
||||||
text: root.amount_str
|
text: root.amount_str
|
||||||
|
|
|
@ -444,8 +444,7 @@ class InvoicesScreen(CScreen):
|
||||||
def do_view(self, obj):
|
def do_view(self, obj):
|
||||||
pr = self.app.invoices.get(obj.key)
|
pr = self.app.invoices.get(obj.key)
|
||||||
pr.verify({})
|
pr.verify({})
|
||||||
status = _('Status') + ': ' + obj.status
|
self.app.show_pr_details(pr.get_dict(), obj.status, True)
|
||||||
self.app.show_pr_details(pr.get_dict(), status, True)
|
|
||||||
|
|
||||||
def do_delete(self, obj):
|
def do_delete(self, obj):
|
||||||
from dialogs.question import Question
|
from dialogs.question import Question
|
||||||
|
@ -504,10 +503,10 @@ class RequestsScreen(CScreen):
|
||||||
address = req['address']
|
address = req['address']
|
||||||
if amount:
|
if amount:
|
||||||
status = req.get('status')
|
status = req.get('status')
|
||||||
status = _('Status') + ': ' + request_text[status]
|
status = request_text[status]
|
||||||
else:
|
else:
|
||||||
received = self.app.wallet.get_addr_received(address)
|
received = self.app.wallet.get_addr_received(address)
|
||||||
status = _('Amount received') + ': ' + self.app.format_amount_and_units(amount)
|
status = self.app.format_amount_and_units(amount)
|
||||||
|
|
||||||
self.app.show_pr_details(req, status, False)
|
self.app.show_pr_details(req, status, False)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
#:import VERSION electrum.version.ELECTRUM_VERSION
|
#:import VERSION electrum.version.ELECTRUM_VERSION
|
||||||
|
|
||||||
<TopLabel@Label>
|
|
||||||
valign: 'top'
|
|
||||||
font_size: '6pt'
|
|
||||||
text_size: self.size
|
|
||||||
|
|
||||||
Popup:
|
Popup:
|
||||||
title: _("About Electrum")
|
title: _("About Electrum")
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
|
@ -13,33 +8,48 @@ Popup:
|
||||||
padding: '10dp'
|
padding: '10dp'
|
||||||
GridLayout:
|
GridLayout:
|
||||||
cols: 2
|
cols: 2
|
||||||
|
spacing: '10dp'
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: _('Version')
|
text: _('Version')
|
||||||
|
size_hint_x: 0.4
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: VERSION
|
text: VERSION
|
||||||
|
size_hint_x: 0.6
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: _('Licence')
|
text: _('Licence')
|
||||||
|
size_hint_x: 0.4
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: "GNU GPL v3"
|
text: "GNU GPL v3"
|
||||||
|
size_hint_x: 0.6
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: _('Homepage')
|
text: _('Homepage')
|
||||||
|
size_hint_x: 0.4
|
||||||
TopLabel:
|
TopLabel:
|
||||||
markup: True
|
markup: True
|
||||||
text: '[color=6666ff][ref=x]https://electrum.org[/ref][/color]'
|
text: '[color=6666ff][ref=x]https://electrum.org[/ref][/color]'
|
||||||
on_ref_press:
|
on_ref_press:
|
||||||
import webbrowser
|
import webbrowser
|
||||||
webbrowser.open("https://electrum.org")
|
webbrowser.open("https://electrum.org")
|
||||||
|
size_hint_x: 0.6
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: _('Developers')
|
text: _('Developers')
|
||||||
Label:
|
size_hint_x: 0.4
|
||||||
|
TopLabel:
|
||||||
text: '\n'.join(['Thomas Voegtlin', 'Neil Booth', 'Akshay Arora'])
|
text: '\n'.join(['Thomas Voegtlin', 'Neil Booth', 'Akshay Arora'])
|
||||||
valign: 'top'
|
size_hint_x: 0.6
|
||||||
font_size: '6pt'
|
|
||||||
size_hint_y: None
|
|
||||||
text_size: self.width, None
|
|
||||||
height: self.texture_size[1]
|
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: _('Distributed by Electrum Technologies GmbH')
|
text: _('Distributed by Electrum Technologies GmbH')
|
||||||
padding: '0dp', '20dp'
|
padding: '0dp', '20dp'
|
||||||
Widget:
|
Widget:
|
||||||
size_hint: None, 0.5
|
size_hint: None, 0.5
|
||||||
|
BoxLayout:
|
||||||
|
size_hint: 1, None
|
||||||
|
height: '48dp'
|
||||||
|
Widget:
|
||||||
|
size_hint: 0.5, None
|
||||||
|
height: '48dp'
|
||||||
|
Button:
|
||||||
|
size_hint: 0.5, None
|
||||||
|
height: '48dp'
|
||||||
|
text: _('Close')
|
||||||
|
on_release: root.dismiss()
|
||||||
|
|
|
@ -1,45 +1,52 @@
|
||||||
#:import Decimal decimal.Decimal
|
#:import Decimal decimal.Decimal
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Popup:
|
Popup:
|
||||||
id: popup
|
id: popup
|
||||||
title: _('Invoice')
|
is_invoice: True
|
||||||
|
amount: 0
|
||||||
|
requestor: ''
|
||||||
|
exp: ''
|
||||||
|
description: ''
|
||||||
|
status: ''
|
||||||
|
signature: ''
|
||||||
|
title: _('Invoice') if popup.is_invoice else _('Request')
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
spacing: '1dp'
|
GridLayout:
|
||||||
|
spacing: '10dp'
|
||||||
|
cols: 2
|
||||||
|
TopLabel:
|
||||||
|
text: _('Requestor') if popup.is_invoice else _('Address')
|
||||||
|
TopLabel:
|
||||||
|
text: root.requestor
|
||||||
|
TopLabel:
|
||||||
|
text: _('Amount') if root.amount else ''
|
||||||
|
TopLabel:
|
||||||
|
text: app.format_amount_and_units(root.amount) if root.amount else ''
|
||||||
|
TopLabel:
|
||||||
|
text: _('Signature') if root.signature else ''
|
||||||
|
TopLabel:
|
||||||
|
text: root.signature
|
||||||
|
TopLabel:
|
||||||
|
text: _('Expiration') if root.exp else ''
|
||||||
|
TopLabel:
|
||||||
|
text: root.exp
|
||||||
|
TopLabel:
|
||||||
|
text: _('Description') if root.description else ''
|
||||||
|
TopLabel:
|
||||||
|
text: root.description
|
||||||
|
TopLabel:
|
||||||
|
text: _('Status') if popup.amount or popup.is_invoice else _('Amount received')
|
||||||
|
TopLabel:
|
||||||
|
text: root.status
|
||||||
|
|
||||||
|
TopLabel:
|
||||||
|
id: txid_label
|
||||||
Widget:
|
Widget:
|
||||||
size_hint: 1, 0.1
|
size_hint: 1, 0.1
|
||||||
|
|
||||||
GridLayout:
|
|
||||||
cols:1
|
|
||||||
size_hint: 1, 1
|
|
||||||
Label:
|
|
||||||
id: requestor_label
|
|
||||||
text_size: self.width, None
|
|
||||||
size_hint: 1, 0.3
|
|
||||||
Label:
|
|
||||||
id: amount_label
|
|
||||||
text_size: self.width, None
|
|
||||||
size_hint: 1, 0.3
|
|
||||||
Label:
|
|
||||||
id: signature_label
|
|
||||||
text_size: self.width, None
|
|
||||||
size_hint: 1, 0.3
|
|
||||||
Label:
|
|
||||||
id: expiration_label
|
|
||||||
text_size: self.width, None
|
|
||||||
size_hint: 1, 0.3
|
|
||||||
Label:
|
|
||||||
id: memo_label
|
|
||||||
text_size: self.width, None
|
|
||||||
size_hint: 1, 0.3
|
|
||||||
Label:
|
|
||||||
id: txid_label
|
|
||||||
text_size: self.width, None
|
|
||||||
size: self.texture_size
|
|
||||||
|
|
||||||
Widget:
|
|
||||||
size_hint: 1, 0.5
|
|
||||||
|
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
|
|
Loading…
Reference in New Issue