From 680c9c888a4620527ef85eee6c0daac2f26c07dd Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 11 Dec 2015 15:48:56 +0100 Subject: [PATCH] kivy: add save_request button --- gui/kivy/uix/screens.py | 13 +++++++++++++ gui/kivy/uix/ui_screens/receive.kv | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py index 586d2f027..e1bfa03de 100644 --- a/gui/kivy/uix/screens.py +++ b/gui/kivy/uix/screens.py @@ -293,9 +293,22 @@ class ReceiveScreen(CScreen): uri = self.get_URI() self.app._clipboard.put(uri, 'text/plain') + def do_save(self): + addr = str(self.screen.address) + amount = str(self.screen.amount) + message = unicode(self.screen.message) + if not message and not amount: + self.app.show_error(_('No message or amount')) + return False + amount = self.app.get_amount(amount) + req = self.app.wallet.make_payment_request(addr, amount, message, None) + self.app.wallet.add_payment_request(req, self.app.electrum_config) + self.app.show_error(_('Request saved')) + def do_clear(self): self.screen.amount = '' self.screen.message = '' + self.update() diff --git a/gui/kivy/uix/ui_screens/receive.kv b/gui/kivy/uix/ui_screens/receive.kv index 5a09f0e25..3665cd75e 100644 --- a/gui/kivy/uix/ui_screens/receive.kv +++ b/gui/kivy/uix/ui_screens/receive.kv @@ -93,5 +93,10 @@ ReceiveScreen: size_hint: 1, None height: '48dp' on_release: s.parent.do_clear() + Button: + text: _('Save') + size_hint: 1, None + height: '48dp' + on_release: s.parent.do_save() Widget: size_hint: 1, 0.3