electrum

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

commit 22a14d42b2e44e9adcfb6971b88e31500594dacb
parent 10611876ee6204ce0f18c2b267a300d132b44805
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 23 Feb 2021 12:03:13 +0100

Merge pull request #7061 from zebra-lucky/add_kivy_scan_qr_non_android

kivy: add app.scan_qr_non_android
Diffstat:
Melectrum/gui/kivy/main_window.py | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py @@ -516,7 +516,7 @@ class ElectrumWindow(App, Logger): def scan_qr(self, on_complete): if platform != 'android': - return + return self.scan_qr_non_android(on_complete) from jnius import autoclass, cast from android import activity PythonActivity = autoclass('org.kivy.android.PythonActivity') @@ -539,6 +539,15 @@ class ElectrumWindow(App, Logger): activity.bind(on_activity_result=on_qr_result) PythonActivity.mActivity.startActivityForResult(intent, 0) + def scan_qr_non_android(self, on_complete): + from electrum import qrscanner + try: + video_dev = self.electrum_config.get_video_device() + data = qrscanner.scan_barcode(video_dev) + on_complete(data) + except BaseException as e: + self.show_error(repr(e)) + def do_share(self, data, title): if platform != 'android': return