electrum

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

commit e2d03f1cc9c2a412a5336051a9aa2d1872e81f13
parent c9fd14e3435fd0f6ce5b0535db39d00cec28b18d
Author: ThomasV <thomasv@gitorious>
Date:   Tue, 17 Jun 2014 16:45:45 +0200

show popup if qr scanner not enabled

Diffstat:
Mgui/qt/paytoedit.py | 5+----
Mgui/qt/qrtextedit.py | 11++++-------
Mlib/plugins.py | 6+++++-
3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py @@ -45,10 +45,7 @@ class PayToEdit(QRTextEdit): self.textChanged.connect(self.check_text) self.outputs = [] self.is_pr = False - - def qr_input(self): - from electrum.plugins import run_hook - run_hook('scan_qr_hook', lambda x: self.win.pay_from_URI(x)) + self.scan_f = self.win.pay_from_URI def lock_amount(self): self.amount_edit.setFrozen(True) diff --git a/gui/qt/qrtextedit.py b/gui/qt/qrtextedit.py @@ -11,11 +11,8 @@ class QRTextEdit(QTextEdit): self.button.setStyleSheet("QToolButton { border: none; padding: 0px; }") self.button.setVisible(True) self.button.clicked.connect(lambda: self.qr_show() if self.isReadOnly() else self.qr_input()) - #frameWidth = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth) - #self.setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(self.button.sizeHint().width() + frameWidth + 1)) - #msz = self.minimumSizeHint() - #self.setMinimumSize(max(msz.width(), self.button.sizeHint().height() + frameWidth * 2 + 2), - # max(msz.height(), self.button.sizeHint().height() + frameWidth * 2 + 2)) + self.scan_f = self.setText + def resizeEvent(self, e): o = QTextEdit.resizeEvent(self, e) @@ -39,5 +36,5 @@ class QRTextEdit(QTextEdit): def qr_input(self): from electrum.plugins import run_hook - run_hook('scan_qr_hook', self.setText) - + if not run_hook('scan_qr_hook', self.scan_f): + QMessageBox.warning(self, _('Error'), _('QR Scanner not enabled'), _('OK')) diff --git a/lib/plugins.py b/lib/plugins.py @@ -34,6 +34,8 @@ def run_hook(name, *args): global plugins + found = 0 + for p in plugins: if not p.is_enabled(): @@ -43,13 +45,15 @@ def run_hook(name, *args): if not callable(f): continue + found += 1 + try: f(*args) except Exception: print_error("Plugin error") traceback.print_exc(file=sys.stdout) - return + return found