You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

from kivy.app import App
from kivy.factory import Factory
from kivy.lang import Builder
Factory.register('QRScanner', module='electrum_gui.kivy.qr_scanner')
class QrScannerDialog(Factory.AnimaterPopup):
__events__('on_complete', )
def on_symbols(self, instance, value):
instance.stop()
self.dismiss()
uri = App.get_running_app().decode_uri(value[0].data)
#address = uri.get('address', 'empty')
#label = uri.get('label', '')
#amount = uri.get('amount', 0.0)
#message = uir.get('message', '')
self.dispatch('on_omplete', uri)
Builder.load_string('''
<QrScannerDialog>
title:
_(\
'[size=18dp]Hold your QRCode up to the camera[/size][size=7dp]\\n[/size]')
title_size: '24sp'
border: 7, 7, 7, 7
size_hint: None, None
size: '320dp', '270dp'
pos_hint: {'center_y': .53}
separator_color: .89, .89, .89, 1
separator_height: '1.2dp'
title_color: .437, .437, .437, 1
background: 'atlas://gui/kivy/theming/light/dialog'
on_activate:
qrscr.start()
qrscr.size = self.size
on_deactivate: qrscr.stop()
QRScanner:
id: qrscr
on_symbols: root.on_symbols(*args)
''')