From 17006e5285cb45a444c232beb536fa1723a4a8e7 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 19 Sep 2014 11:08:43 +0200 Subject: [PATCH] qr scanner: show error if not installed --- gui/qt/main_window.py | 7 ++++++- lib/qrscanner.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index f41848dc0..0887d89b9 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -2144,7 +2144,12 @@ class ElectrumWindow(QMainWindow): def read_tx_from_qrcode(self): - data = run_hook('scan_qr_hook') + from electrum import qrscanner + try: + data = qrscanner.scan_qr(self.config) + except BaseException, e: + QMessageBox.warning(self, _('Error'), _(e), _('OK')) + return if not data: return # transactions are binary, but qrcode seems to return utf8... diff --git a/lib/qrscanner.py b/lib/qrscanner.py index a45e15209..0b712e609 100644 --- a/lib/qrscanner.py +++ b/lib/qrscanner.py @@ -8,7 +8,7 @@ except ImportError: def scan_qr(config): if not zbar: - return + raise BaseException("The zbar package is not available.\nOn Linux, try 'sudo apt-get install python-zbar'") device = config.get("video_device", "default") if device == 'default': device = ''