electrum

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

commit 2f543d2ad8bd4da1b05c24f7cc78ee9eaeb8bd33
parent 3e8cbdfba291e6d1e7014cd1f3732c6e879b306b
Author: ThomasV <thomasv@electrum.org>
Date:   Wed, 14 Oct 2015 11:44:01 +0200

add amount keyboard

Diffstat:
Mgui/kivy/main_window.py | 9+++++++++
Mgui/kivy/uix/screens.py | 24++++++++++++++++++++++--
Agui/kivy/uix/ui_screens/amount.kv | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mgui/kivy/uix/ui_screens/receive.kv | 40++++++++++++++++++++++++++++------------
Mgui/kivy/uix/ui_screens/send.kv | 10----------
5 files changed, 125 insertions(+), 24 deletions(-)

diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py @@ -803,6 +803,15 @@ class ElectrumWindow(App): info_bubble.show(pos, duration, width, modal=modal, exit=exit) + def amount_dialog(self, label, callback): + popup = Builder.load_file('gui/kivy/uix/ui_screens/amount.kv') + popup.ids.amount_label.text = label.text + def cb(): + label.text = popup.ids.amount_label.text + callback() + popup.on_dismiss = cb + popup.open() + def password_dialog(self, f, args): if self.wallet.use_encryption: popup = Builder.load_file('gui/kivy/uix/ui_screens/password.kv') diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py @@ -249,11 +249,31 @@ class SendScreen(CScreen): class ReceiveScreen(CScreen): kvname = 'receive' - @profiler + def update(self): addr = self.app.wallet.get_unused_address(None) + address_label = self.screen.ids.get('address') + address_label.text = addr + self.update_qr() + + def amount_callback(self, popup): + amount_label = self.screen.ids.get('amount') + amount_label.text = popup.ids.amount_label.text + self.update_qr() + + @profiler + def update_qrtt(self): + raise + + def update_qr(self): + address_label = self.screen.ids.get('address') + address = address_label.text + amount_label = self.screen.ids.get('amount') + amount = amount_label.text qr = self.screen.ids.get('qr') - qr.set_data(addr) + uri = 'bitcoin:'+ address + '?amount='+amount if address and amount else address + qr.set_data(uri) + class ContactsScreen(CScreen): diff --git a/gui/kivy/uix/ui_screens/amount.kv b/gui/kivy/uix/ui_screens/amount.kv @@ -0,0 +1,66 @@ +<KButton@Button>: + size_hint: 1, None + height: '38dp' + +Popup: + id: popup + title: _('Amount') + + BoxLayout: + + orientation: 'vertical' + + halign: 'center' + + Label: + id: amount_label + text: '' + + GridLayout: + cols: 3 + size_hint: 0.5, 1 + KButton: + text: '1' + on_release: amount_label.text += self.text + KButton: + text: '2' + on_release: amount_label.text += self.text + KButton: + text: '3' + on_release: amount_label.text += self.text + KButton: + text: '4' + on_release: amount_label.text += self.text + KButton: + text: '5' + on_release: amount_label.text += self.text + KButton: + text: '6' + on_release: amount_label.text += self.text + KButton: + text: '7' + on_release: amount_label.text += self.text + KButton: + text: '8' + on_release: amount_label.text += self.text + KButton: + text: '9' + on_release: amount_label.text += self.text + KButton: + text: '.' + on_release: amount_label.text += self.text + KButton: + text: '0' + on_release: amount_label.text += self.text + KButton: + text: '<' + on_release: amount_label.text = amount_label.text[:-1] + + Button: + size_hint: 0.5, None + height: '48dp' + text: _('OK') + on_release: popup.dismiss() + + Widget: + size_hint: 1, None diff --git a/gui/kivy/uix/ui_screens/receive.kv b/gui/kivy/uix/ui_screens/receive.kv @@ -9,14 +9,12 @@ ReceiveScreen: id: receive_screen name: 'receive' - mode: 'qr' - on_mode: if args[1] == 'nfc': from electrum_gui.kivy.nfc_scanner import NFCScanner BoxLayout padding: '12dp', '12dp', '12dp', '12dp' spacing: '12dp' - mode: 'qr' orientation: 'vertical' + size_hint: 1, 1 FloatLayout: id: bl @@ -31,14 +29,32 @@ ReceiveScreen: GridLayout: id: grid - cols: 1 + cols: 2 + Label: + text: 'Address' + size_hint: 0.5, None + height: '38dp' + AddressSelector: + id: address + size_hint: 0.5, None + height: '38dp' + Label: + text: 'Amount' + size_hint: 0.5, None + height: '38dp' Button: - text: 'Amount: None' - size_hint_y: None + id: amount + text: '' + size_hint: 0.5, None + height: '38dp' + on_release: app.amount_dialog(amount, receive_screen.parent.update_qr) + Label: + text: 'Description' + size_hint: 0.5, None height: '48dp' - on_release: receive_screen.set_amount_dialog() - Button: - text: 'Message: None' - size_hint_y: None - height: '48dp' - + TextInput: + text: '' + on_text: receive_screen.parent.update_qr + multiline: False + size_hint: 0.5, None + height: '38dp' diff --git a/gui/kivy/uix/ui_screens/send.kv b/gui/kivy/uix/ui_screens/send.kv @@ -192,16 +192,6 @@ SendScreen: on_text_validate: anim = Factory.Animation(opacity=1, height=blue_bottom.item_height) anim.start(wallet_selection) - #anim.start(address_selection) - CardSeparator - opacity: address_selection.opacity - color: blue_bottom.foreground_color - AddressSelector: - id: address_selection - foreground_color: blue_bottom.foreground_color - opacity: 1 - size_hint: 1, None - height: blue_bottom.item_height Button: #background_color: (1, 1, 1, 1) if self.disabled else ((.258, .80, .388, 1) if self.state == 'normal' else (.203, .490, .741, 1)) text: _('Send')