Browse Source

Merge pull request #7061 from zebra-lucky/add_kivy_scan_qr_non_android

kivy: add app.scan_qr_non_android
patch-4
ThomasV 4 years ago
committed by GitHub
parent
commit
22a14d42b2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      electrum/gui/kivy/main_window.py

11
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

Loading…
Cancel
Save