Browse Source

kivy: improve layout of invoice and about dialogs

283
ThomasV 9 years ago
parent
commit
f89a90016e
  1. 6
      gui/kivy/main.kv
  2. 23
      gui/kivy/main_window.py
  3. 3
      gui/kivy/uix/dialogs/tx_dialog.py
  4. 7
      gui/kivy/uix/screens.py
  5. 32
      gui/kivy/uix/ui_screens/about.kv
  6. 71
      gui/kivy/uix/ui_screens/invoice.kv

6
gui/kivy/main.kv

@ -26,6 +26,12 @@
# Custom Global Widgets
<TopLabel@Label>
valign: 'top'
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
<EmptyLabel@Label>
color: (0.8, 0.8, 0.8, 1)
size_hint_y: None

23
gui/kivy/main_window.py

@ -285,25 +285,18 @@ class ElectrumWindow(App):
memo = req.get('memo')
amount = req.get('amount')
popup = Builder.load_file('gui/kivy/uix/ui_screens/invoice.kv')
if is_invoice:
popup.title = _('Invoice')
popup.ids.requestor_label.text = _("Requestor") + ': ' + requestor
else:
popup.title = _('Request')
popup.ids.requestor_label.text = _("Address") + ': ' + req.get('address')
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
popup.is_invoice = is_invoice
popup.amount = amount
popup.requestor = requestor if is_invoice else req.get('address')
popup.exp = format_time(exp) if exp else ''
popup.description = memo if memo else ''
popup.signature = req.get('signature', '')
popup.status = status
txid = req.get('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()
def qr_dialog(self, title, data):
from uix.dialogs.qr_dialog import QRDialog
popup = QRDialog(title, data)

3
gui/kivy/uix/dialogs/tx_dialog.py

@ -24,8 +24,7 @@ Builder.load_string('''
Label:
id: status_label
text: root.status_str
text_size: self.width, None
size: self.texture_size
text_size: self.size
Label:
id: amount_label
text: root.amount_str

7
gui/kivy/uix/screens.py

@ -444,8 +444,7 @@ class InvoicesScreen(CScreen):
def do_view(self, obj):
pr = self.app.invoices.get(obj.key)
pr.verify({})
status = _('Status') + ': ' + obj.status
self.app.show_pr_details(pr.get_dict(), status, True)
self.app.show_pr_details(pr.get_dict(), obj.status, True)
def do_delete(self, obj):
from dialogs.question import Question
@ -504,10 +503,10 @@ class RequestsScreen(CScreen):
address = req['address']
if amount:
status = req.get('status')
status = _('Status') + ': ' + request_text[status]
status = request_text[status]
else:
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)

32
gui/kivy/uix/ui_screens/about.kv

@ -1,10 +1,5 @@
#:import VERSION electrum.version.ELECTRUM_VERSION
<TopLabel@Label>
valign: 'top'
font_size: '6pt'
text_size: self.size
Popup:
title: _("About Electrum")
BoxLayout:
@ -13,33 +8,48 @@ Popup:
padding: '10dp'
GridLayout:
cols: 2
spacing: '10dp'
TopLabel:
text: _('Version')
size_hint_x: 0.4
TopLabel:
text: VERSION
size_hint_x: 0.6
TopLabel:
text: _('Licence')
size_hint_x: 0.4
TopLabel:
text: "GNU GPL v3"
size_hint_x: 0.6
TopLabel:
text: _('Homepage')
size_hint_x: 0.4
TopLabel:
markup: True
text: '[color=6666ff][ref=x]https://electrum.org[/ref][/color]'
on_ref_press:
import webbrowser
webbrowser.open("https://electrum.org")
size_hint_x: 0.6
TopLabel:
text: _('Developers')
Label:
size_hint_x: 0.4
TopLabel:
text: '\n'.join(['Thomas Voegtlin', 'Neil Booth', 'Akshay Arora'])
valign: 'top'
font_size: '6pt'
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
size_hint_x: 0.6
TopLabel:
text: _('Distributed by Electrum Technologies GmbH')
padding: '0dp', '20dp'
Widget:
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()

71
gui/kivy/uix/ui_screens/invoice.kv

@ -1,44 +1,51 @@
#:import Decimal decimal.Decimal
Popup:
id: popup
title: _('Invoice')
is_invoice: True
amount: 0
requestor: ''
exp: ''
description: ''
status: ''
signature: ''
title: _('Invoice') if popup.is_invoice else _('Request')
BoxLayout:
orientation: 'vertical'
spacing: '1dp'
Widget:
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
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:
size_hint: 1, 0.5
size_hint: 1, 0.1
BoxLayout:
size_hint: 1, None

Loading…
Cancel
Save