tNew feature "Scan QR code" in sending dialog. - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 4e54081c5c99967ce8172cd33d47aa8d69cea7cb DIR parent b21ebc0da4b5d7f726b18e007101cf9553203c0e HTML Author: slush <info@bitcoin.cz> Date: Thu, 2 Aug 2012 15:18:31 +0200 New feature "Scan QR code" in sending dialog. Diffstat: M lib/gui_qt.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) --- DIR diff --git a/lib/gui_qt.py b/lib/gui_qt.py t@@ -41,7 +41,7 @@ except: sys.exit(1) from wallet import format_satoshis -import bmp, mnemonic, pyqrnative +import bmp, mnemonic, pyqrnative, qrscanner from decimal import Decimal t@@ -443,6 +443,24 @@ class ElectrumWindow(QMainWindow): self.payto_e = QLineEdit() grid.addWidget(QLabel(_('Pay to')), 1, 0) grid.addWidget(self.payto_e, 1, 1, 1, 3) + + def fill_from_qr(): + qrcode = qrscanner.scan_qr() + if 'address' in qrcode: + self.payto_e.setText(qrcode['address']) + if 'amount' in qrcode: + self.amount_e.setText(str(qrcode['amount'])) + if 'label' in qrcode: + self.message_e.setText(qrcode['label']) + if 'message' in qrcode: + self.message_e.setText("%s (%s)" % (self.message_e.text(), qrcode['message'])) + + + if qrscanner.is_available(): + b = QPushButton(_("Scan QR code")) + b.clicked.connect(fill_from_qr) + grid.addWidget(b, 1, 5) + grid.addWidget(HelpButton(_('Recipient of the funds.') + '\n\n' + _('You may enter a Bitcoin address, a label from your list of contacts (a list of completions will be proposed), or an alias (email-like address that forwards to a Bitcoin address)')), 1, 4) completer = QCompleter()