X-Git-Url: https://git.novaco.in/?p=electrum-nvc.git;a=blobdiff_plain;f=gui%2Fqt%2Fmain_window.py;h=874b8e28c3956402c7dd3710e2a02f0a340b2990;hp=028deb509703fc929b53379adf55b2e1b126fea5;hb=81d1e67253c8ca581e821a6cd9e5ee1502fffd08;hpb=4da85c00e313d3e087f52d3c7263e79553ef8147 diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index 028deb5..874b8e2 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -360,6 +360,7 @@ class ElectrumWindow(QMainWindow): raw_transaction_menu.addAction(_("&From file"), self.do_process_from_file) raw_transaction_menu.addAction(_("&From text"), self.do_process_from_text) raw_transaction_menu.addAction(_("&From the blockchain"), self.do_process_from_txid) + raw_transaction_menu.addAction(_("&From QR code"), self.read_tx_from_qrcode) self.raw_transaction_menu = raw_transaction_menu help_menu = menubar.addMenu(_("&Help")) @@ -2091,6 +2092,21 @@ class ElectrumWindow(QMainWindow): QMessageBox.critical(None, _("Unable to parse transaction"), _("Electrum was unable to parse your transaction")) + def read_tx_from_qrcode(self): + data = run_hook('scan_qr_hook') + if not data: + return + # transactions are binary, but qrcode seems to return utf8... + z = data.decode('utf8') + s = '' + for b in z: + s += chr(ord(b)) + data = s.encode('hex') + tx = self.tx_from_text(data) + if not tx: + return + self.show_transaction(tx) + def read_tx_from_file(self): fileName = self.getOpenFileName(_("Select your transaction file"), "*.txn")