Browse Source

kivy: "paste" button now works for transactions

regtest_lnd
SomberNight 6 years ago
parent
commit
1ebfcc0f36
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 19
      electrum/gui/kivy/uix/screens.py

19
electrum/gui/kivy/uix/screens.py

@ -20,7 +20,7 @@ from kivy.utils import platform
from electrum.util import profiler, parse_URI, format_time, InvalidPassword, NotEnoughFunds, Fiat from electrum.util import profiler, parse_URI, format_time, InvalidPassword, NotEnoughFunds, Fiat
from electrum import bitcoin 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.util import send_exception_to_crash_reporter, parse_URI, InvalidBitcoinURI
from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED
from electrum.plugin import run_hook from electrum.plugin import run_hook
@ -233,11 +233,22 @@ class SendScreen(CScreen):
self.payment_request = None self.payment_request = None
def do_paste(self): def do_paste(self):
contents = self.app._clipboard.paste() data = self.app._clipboard.paste()
if not contents: if not data:
self.app.show_info(_("Clipboard is empty")) self.app.show_info(_("Clipboard is empty"))
return 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): def do_send(self):
if self.screen.is_pr: if self.screen.is_pr:

Loading…
Cancel
Save