|
@ -1,22 +1,28 @@ |
|
|
from kivy.uix.camera import Camera |
|
|
from kivy.uix.camera import Camera |
|
|
from kivy.clock import Clock |
|
|
from kivy.clock import Clock |
|
|
|
|
|
from kivy.utils import platform |
|
|
|
|
|
|
|
|
import iconv |
|
|
|
|
|
from electrum_gui.kivy.qr_scanner import ScannerBase |
|
|
from electrum_gui.kivy.qr_scanner import ScannerBase |
|
|
|
|
|
|
|
|
|
|
|
import iconv |
|
|
|
|
|
|
|
|
try: |
|
|
try: |
|
|
from zbar import ImageScanner, Config, Image, Symbol |
|
|
from zbar import ImageScanner, Config, Image, Symbol |
|
|
except ImportError: |
|
|
except ImportError: |
|
|
raise SystemError('unable to import zbar please make sure you have it installed') |
|
|
raise SystemError('unable to import zbar please make sure you have' |
|
|
|
|
|
' it installed.\nFor mac osx: `brew install zbar then\n`' |
|
|
|
|
|
'`pip install https://github.com/npinchot/zbar/archive/d3c1611ad2411fbdc3e79eb96ca704a63d30ae69.zip`') |
|
|
try: |
|
|
try: |
|
|
import Image as PILImage |
|
|
from PIL import Image as PILImage |
|
|
except ImportError: |
|
|
except ImportError: |
|
|
raise SystemError('unable to import Pil/pillow please install one of the two.') |
|
|
raise SystemError('unable to import Pil/pillow' |
|
|
|
|
|
' please install one of the two.') |
|
|
|
|
|
|
|
|
__all__ = ('ScannerCamera', ) |
|
|
__all__ = ('ScannerCamera', ) |
|
|
|
|
|
|
|
|
class ScannerCamera(ScannerBase): |
|
|
class ScannerCamera(ScannerBase): |
|
|
'''Widget that use the kivy.uix.camera.Camera and zbar to detect qrcode. |
|
|
'''Widget that use the kivy.uix.camera.Camera and zbar to detect |
|
|
When found, the `symbols` will be updated |
|
|
qrcode. When found, the `symbols` will be updated |
|
|
''' |
|
|
''' |
|
|
|
|
|
|
|
|
def __init__(self, **kwargs): |
|
|
def __init__(self, **kwargs): |
|
@ -48,6 +54,7 @@ class ScannerCamera(ScannerBase): |
|
|
self._camera.play = False |
|
|
self._camera.play = False |
|
|
Clock.unschedule(self._detect_qrcode_frame) |
|
|
Clock.unschedule(self._detect_qrcode_frame) |
|
|
# TODO: testing for various platforms(windows, mac) |
|
|
# TODO: testing for various platforms(windows, mac) |
|
|
|
|
|
if platform == 'linux': |
|
|
self._camera._camera._pipeline.set_state(1) |
|
|
self._camera._camera._pipeline.set_state(1) |
|
|
#self._camera = None |
|
|
#self._camera = None |
|
|
|
|
|
|
|
|