electrum

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

commit f89a90016e528fbe237f7ac982226305a71d383b
parent f1822a960322dd49f2678edbc7b4a9203c55336a
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 16 Feb 2016 10:24:13 +0100

kivy: improve layout of invoice and about dialogs

Diffstat:
Mgui/kivy/main.kv | 6++++++
Mgui/kivy/main_window.py | 23++++++++---------------
Mgui/kivy/uix/dialogs/tx_dialog.py | 3+--
Mgui/kivy/uix/screens.py | 7+++----
Mgui/kivy/uix/ui_screens/about.kv | 32+++++++++++++++++++++-----------
Mgui/kivy/uix/ui_screens/invoice.kv | 71+++++++++++++++++++++++++++++++++++++++--------------------------------
6 files changed, 78 insertions(+), 64 deletions(-)

diff --git a/gui/kivy/main.kv b/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 diff --git a/gui/kivy/main_window.py b/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) diff --git a/gui/kivy/uix/dialogs/tx_dialog.py b/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 diff --git a/gui/kivy/uix/screens.py b/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) diff --git a/gui/kivy/uix/ui_screens/about.kv b/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() diff --git a/gui/kivy/uix/ui_screens/invoice.kv b/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