tkivy: various small fixes - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit cd0ab62cae17f80dc8ceb4c60d420b512d680649 DIR parent f30149ad49f220da4639d897586345e7def531e4 HTML Author: ThomasV <thomasv@electrum.org> Date: Sun, 13 Dec 2015 06:41:22 +0100 kivy: various small fixes Diffstat: M gui/kivy/main.kv | 12 ------------ M gui/kivy/main_window.py | 10 ++++++++-- M gui/kivy/uix/screens.py | 12 +++++------- M gui/kivy/uix/ui_screens/send.kv | 10 +++++----- 4 files changed, 18 insertions(+), 26 deletions(-) --- DIR diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv t@@ -187,18 +187,6 @@ size: self.size pos: self.pos -<xxCardItem@ToggleButtonBehavior+GridLayout> - canvas.before: - Color: - rgba: 0.192, .498, 0.745, 1 if self.state == 'down' else 0 - Rectangle - size: self.size - pos: self.x, self.y + dp(5) - padding: '2dp', '2dp' - spacing: '2dp' - height: self.minimum_height - - <CardItem@ToggleButtonBehavior+BoxLayout> size_hint: 1, None height: '65dp' DIR diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py t@@ -205,8 +205,8 @@ class ElectrumWindow(App): def on_pr(self, pr): if pr.verify(self.contacts): key = self.invoices.add(pr) + self.invoices_screen.update() status = self.invoices.get_status(key) - #self.invoices_screen.update() if status == PR_PAID: self.show_error("invoice already paid") self.send_screen.do_clear() t@@ -214,7 +214,7 @@ class ElectrumWindow(App): if pr.has_expired(): self.show_error(_('Payment request has expired')) else: - self.current_pr = pr + self.current_invoice = pr self.update_screen('send') send_tab = self.tabs.ids.send_tab self.tabs.ids.panel.switch_to(send_tab) t@@ -521,6 +521,9 @@ class ElectrumWindow(App): def format_amount(self, x, is_diff=False, whitespaces=False): return format_satoshis(x, is_diff, 0, self.decimal_point(), whitespaces) + def format_amount_and_units(self, x): + return format_satoshis_plain(x, self.decimal_point()) + ' ' + self.base_unit + @profiler def update_wallet(self, *dt): self._trigger_update_status() t@@ -717,6 +720,9 @@ class ElectrumWindow(App): popup.tx_hash = obj.tx_hash popup.open() + def address_dialog(self, screen): + pass + def amount_dialog(self, screen, show_max): popup = Builder.load_file('gui/kivy/uix/ui_screens/amount.kv') but_max = popup.ids.but_max DIR diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py t@@ -205,8 +205,7 @@ class SendScreen(CScreen): self.screen.message = uri.get('message', '') amount = uri.get('amount') if amount: - amount_str = str( Decimal(amount) / pow(10, self.app.decimal_point())) - self.screen.amount = amount_str + ' ' + self.app.base_unit + self.screen.amount = self.format_amount_and_units(amount) def update(self): if self.app.current_invoice: t@@ -221,7 +220,7 @@ class SendScreen(CScreen): def set_request(self, pr): self.payment_request = pr self.screen.address = pr.get_requestor() - self.screen.amount = self.app.format_amount(pr.get_amount()) + self.screen.amount = self.app.format_amount_and_units(pr.get_amount()) self.screen.message = pr.get_memo() def do_paste(self): t@@ -289,8 +288,7 @@ class ReceiveScreen(CScreen): req = self.app.wallet.receive_requests.get(addr) if req: self.screen.message = req.get('memo') - self.screen.amount = self.app.format_amount(req.get('amount')) + ' ' + self.app.base_unit - + self.screen.amount = self.app.format_amount_and_units(req.get('amount')) def amount_callback(self, popup): amount_label = self.screen.ids.get('amount') t@@ -378,7 +376,7 @@ class InvoicesScreen(CScreen): ci.key = pr.get_id() ci.requestor = pr.get_requestor() ci.memo = pr.memo - ci.amount = self.app.format_amount(pr.get_amount()) + ci.amount = self.app.format_amount_and_units(pr.get_amount()) #ci.status = self.invoices.get_status(key) exp = pr.get_expiration_date() ci.date = format_time(exp) if exp else _('Never') t@@ -413,7 +411,7 @@ class RequestsScreen(CScreen): ci.address = req['address'] ci.memo = req.get('memo', '') #ci.status = req.get('status') - ci.amount = self.app.format_amount(amount) if amount else '' + ci.amount = self.app.format_amount_and_units(amount) if amount else '' ci.date = format_time(timestamp) ci.screen = self requests_list.add_widget(ci) DIR diff --git a/gui/kivy/uix/ui_screens/send.kv b/gui/kivy/uix/ui_screens/send.kv t@@ -32,10 +32,10 @@ SendScreen: size_hint: None, None size: '22dp', '22dp' pos_hint: {'center_y': .5} - TextInputBlue: + AmountButton: id: payto_e - text: s.address - hint_text: "Recipient" + text: s.address if s.address else _('Recipient') + on_release: app.address_dialog(s) CardSeparator: opacity: message_selection.opacity color: blue_bottom.foreground_color t@@ -49,7 +49,7 @@ SendScreen: pos_hint: {'center_y': .5} AmountButton: id: amount_e - text: s.amount if s.amount else 'Amount' + text: s.amount if s.amount else _('Amount') on_release: app.amount_dialog(s, True) CardSeparator: t@@ -68,7 +68,7 @@ SendScreen: pos_hint: {'center_y': .5} TextInputBlue: id: message_e - hint_text: 'Description' + hint_text: _('Description') text: s.message on_text_validate: s.message = self.text BoxLayout: