electrum

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

commit 1126555f14ed27d955227ec7baa51cf88629c3dd
parent 6ec610c3599583582bcc855457f619d84559300d
Author: ThomasV <thomasv@electrum.org>
Date:   Wed,  2 Dec 2015 15:27:23 +0100

kivy updates

Diffstat:
Mgui/kivy/main_window.py | 34+++++++++++++++++++++++++++-------
Mgui/kivy/uix/screens.py | 5++++-
Mgui/kivy/uix/ui_screens/receive.kv | 10+++++-----
Mgui/kivy/uix/ui_screens/send.kv | 58+++++++++++++++++++---------------------------------------
Mgui/kivy/uix/ui_screens/wallets.kv | 7-------
5 files changed, 55 insertions(+), 59 deletions(-)

diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py @@ -180,11 +180,11 @@ class ElectrumWindow(App): #self.config = self.gui_object.config self.contacts = Contacts(self.electrum_config) - self.bind(url=self.set_url) + self.bind(url=self.set_URI) # were we sent a url? url = self.electrum_config.get('url', None) if url: - self.set_url(url) + self.set_URI(url) # create triggers so as to minimize updation a max of 2 times a sec self._trigger_update_wallet =\ @@ -194,10 +194,26 @@ class ElectrumWindow(App): self._trigger_notify_transactions = \ Clock.create_trigger(self.notify_transactions, 5) - def set_url(self, url): - print "set url", url - url = electrum.util.parse_URI(url) - self.send_screen.set_qr_data(url) + def set_URI(self, url): + try: + url = electrum.util.parse_URI(url) + except: + self.show_info("Invalid URI", url) + return + self.send_screen.set_URI(url) + + def send_from_clipboard(self, on_complete): + if not self._clipboard: + from kivy.core.clipboard import Clipboard + self._clipboard = Clipboard + contents = self._clipboard.get() + try: + uri = electrum.util.parse_URI(contents) + except: + self.show_info("Invalid URI", url) + return + on_complete(uri) + def scan_qr(self, on_complete): from jnius import autoclass @@ -211,7 +227,11 @@ class ElectrumWindow(App): if resultCode == -1: # RESULT_OK: contents = intent.getStringExtra("SCAN_RESULT") if intent.getStringExtra("SCAN_RESULT_FORMAT") == 'QR_CODE': - uri = electrum.util.parse_URI(contents) + try: + uri = electrum.util.parse_URI(contents) + except: + self.show_info("Invalid URI", url) + return on_complete(uri) activity.bind(on_activity_result=on_qr_result) PythonActivity.mActivity.startActivityForResult(intent, 0) diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py @@ -177,8 +177,11 @@ class ScreenPassword(Factory.Screen): class SendScreen(CScreen): + kvname = 'send' - def set_qr_data(self, uri): + + def set_URI(self, uri): + print "z", uri self.ids.payto_e.text = uri.get('address', '') self.ids.message_e.text = uri.get('message', '') amount = uri.get('amount') diff --git a/gui/kivy/uix/ui_screens/receive.kv b/gui/kivy/uix/ui_screens/receive.kv @@ -29,7 +29,7 @@ ReceiveScreen: Label: id: address size_hint: 1, None - height: '38dp' + height: '48dp' opacity: 0.5 if qr.shaded else 1 SendReceiveBlueBottom: @@ -51,7 +51,7 @@ ReceiveScreen: text_size: (amount.width-15, None) halign: 'left' size_hint: 0.5, None - height: '38dp' + height: '48dp' on_release: app.amount_dialog(amount, receive_screen.parent.update_qr, False) background_color: 0, 0, 0, 0 CardSeparator: @@ -75,16 +75,16 @@ ReceiveScreen: BoxLayout: size_hint: 1, None - height: '38dp' + height: '48dp' Button: text: _('Clear') size_hint: 1, None - height: '38dp' + height: '48dp' on_release: receive_screen.parent.do_clear() Button: text: _('Share') size_hint: 1, None - height: '38dp' + height: '48dp' on_release: receive_screen.parent.do_share() Widget: diff --git a/gui/kivy/uix/ui_screens/send.kv b/gui/kivy/uix/ui_screens/send.kv @@ -28,20 +28,6 @@ -<SendReceiveToggle@BoxLayout> - padding: '5dp', '5dp' - size_hint: 1, None - height: '45dp' - canvas.before: - Color: - rgba: 1, 1, 1, 1 - BorderImage: - border: 12, 12, 12, 12 - source: 'atlas://gui/kivy/theming/light/card' - size: self.width + dp(3), self.height - pos: self.x - dp(1.5), self.y - - SendScreen: id: send_screen @@ -55,25 +41,6 @@ SendScreen: padding: '12dp', '12dp', '12dp', '12dp' spacing: '12dp' orientation: 'vertical' - SendReceiveToggle: - size_hint: 1, None - SendToggle: - id: qr - text: 'QR Code' - group: 'send_type' - source: 'atlas://gui/kivy/theming/light/qrcode' - on_release: - app.scan_qr(on_complete=root.set_qr_data) - state: 'down' - background_down: 'atlas://gui/kivy/theming/light/btn_send_nfc' - SendToggle: - id: nfc_toggle - text: 'NFC' - group: 'send_type' - state: 'normal' - source: 'atlas://gui/kivy/theming/light/nfc' - background_down: 'atlas://gui/kivy/theming/light/btn_send_nfc' - SendReceiveBlueBottom: id: blue_bottom size_hint: 1, None @@ -108,7 +75,7 @@ SendScreen: text_size: (self.width-15, None) halign: 'left' size_hint: 0.5, None - height: '38dp' + height: '48dp' on_release: app.amount_dialog(self, None, True) background_color: .238, .585, .878, 0 CardSeparator: @@ -130,18 +97,31 @@ SendScreen: hint_text: 'Description (optional)' BoxLayout: size_hint: 1, None - height: '38dp' + height: '48dp' + Button: + id: qr + text: _('QR Code') + on_release: + app.scan_qr(on_complete=root.set_URI) + Button: + id: paste_button + text: _('Clipboard') + on_release: + app.send_from_clipboard(on_complete=root.set_URI) Button: text: _('Clear') size_hint: 1, None - height: '38dp' + height: '48dp' on_release: send_screen.do_clear() + Widget: + size_hint: 1, 1 + BoxLayout: + size_hint: 1, None + height: '48dp' Button: text: _('Send') size_hint: 1, None - height: '38dp' + height: '48dp' on_release: send_screen.do_send() - Widget: - size_hint: 1, 1 diff --git a/gui/kivy/uix/ui_screens/wallets.kv b/gui/kivy/uix/ui_screens/wallets.kv @@ -1,12 +1,5 @@ #:import os os - -<WalletSelector@BlueSpinner> - icon: 'atlas://gui/kivy/theming/light/wallet' - values: ('default Wallet',) - text: _('Select your wallet') - - Popup: title: _('Wallets') id: popup