electrum

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

commit 526c6c88f7bc3046934e6a0e6a57e2c8242b8b64
parent 7c3edd58e34402ef92af8452c63feba1ace9de15
Author: ThomasV <thomasv@electrum.org>
Date:   Fri, 12 Feb 2016 16:09:16 +0100

kivy: scan tx

Diffstat:
Mgui/kivy/main_window.py | 17++++++++++++-----
Mgui/kivy/uix/screens.py | 9++++++++-
Mgui/kivy/uix/ui_screens/send.kv | 2+-
3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py @@ -238,6 +238,16 @@ class ElectrumWindow(App): return self.send_screen.set_URI(url) + def on_qr(self, data): + if data.startswith('bitcoin:'): + self.set_URI(data) + else: + from electrum.bitcoin import base_decode + from electrum.transaction import Transaction + text = base_decode(data, None, base=43).encode('hex') + tx = Transaction(text) + self.tx_dialog(tx) + def on_uri(self, instance, uri): if uri: Logger.info("on uri:" + uri) @@ -646,12 +656,9 @@ class ElectrumWindow(App): pos = (win.center[0], win.center[1] - (info_bubble.height/2)) info_bubble.show(pos, duration, width, modal=modal, exit=exit) - def tx_details_dialog(self, obj): - tx_hash = obj.tx_hash + def tx_dialog(self, tx): + tx_hash = tx.hash() popup = Builder.load_file('gui/kivy/uix/ui_screens/transaction.kv') - tx = self.wallet.transactions.get(tx_hash) - if not tx: - return conf, timestamp = self.wallet.get_confirmations(tx_hash) is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(tx) if is_relevant: diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py @@ -97,7 +97,14 @@ class HistoryScreen(CScreen): def __init__(self, **kwargs): self.ra_dialog = None super(HistoryScreen, self).__init__(**kwargs) - self.menu_actions = [ ('Label', self.label_dialog), ('Details', self.app.tx_details_dialog)] + self.menu_actions = [ ('Label', self.label_dialog), ('Details', self.show_tx)] + + def show_tx(self, obj): + tx_hash = obj.tx_hash + tx = self.app.wallet.transactions.get(tx_hash) + if not tx: + return + self.app.tx_dialog(tx) def label_dialog(self, obj): from dialogs.label_dialog import LabelDialog diff --git a/gui/kivy/uix/ui_screens/send.kv b/gui/kivy/uix/ui_screens/send.kv @@ -76,7 +76,7 @@ SendScreen: IconButton: id: qr size_hint: 0.6, 1 - on_release: app.scan_qr(on_complete=app.set_URI) + on_release: app.scan_qr(on_complete=app.on_qr) icon: 'atlas://gui/kivy/theming/light/camera' Button: text: _('Paste')