tkivy: "paste" button now works for transactions - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 1ebfcc0f364ecb806c0ce736a76de8a3256748fd DIR parent c776af41f6b453e3c0d6e61c554a01e347c5d761 HTML Author: SomberNight <somber.night@protonmail.com> Date: Sun, 26 May 2019 02:46:25 +0200 kivy: "paste" button now works for transactions Diffstat: M electrum/gui/kivy/uix/screens.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) --- DIR diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py t@@ -20,7 +20,7 @@ from kivy.utils import platform from electrum.util import profiler, parse_URI, format_time, InvalidPassword, NotEnoughFunds, Fiat from electrum import bitcoin -from electrum.transaction import TxOutput +from electrum.transaction import TxOutput, Transaction, tx_from_str from electrum.util import send_exception_to_crash_reporter, parse_URI, InvalidBitcoinURI from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED from electrum.plugin import run_hook t@@ -233,11 +233,22 @@ class SendScreen(CScreen): self.payment_request = None def do_paste(self): - contents = self.app._clipboard.paste() - if not contents: + data = self.app._clipboard.paste() + if not data: self.app.show_info(_("Clipboard is empty")) return - self.set_URI(contents) + # try to decode as transaction + try: + raw_tx = tx_from_str(data) + tx = Transaction(raw_tx) + tx.deserialize() + except: + tx = None + if tx: + self.app.tx_dialog(tx) + return + # try to decode as URI/address + self.set_URI(data) def do_send(self): if self.screen.is_pr: