return bytes in scan_barcode
This commit is contained in:
parent
5cc71ef84b
commit
b8c7edf070
|
@ -2056,14 +2056,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
if not data:
|
if not data:
|
||||||
return
|
return
|
||||||
# if the user scanned a bitcoin URI
|
# if the user scanned a bitcoin URI
|
||||||
if data.startswith("bitcoin:"):
|
if str(data).startswith("bitcoin:"):
|
||||||
self.pay_to_URI(data)
|
self.pay_to_URI(data)
|
||||||
return
|
return
|
||||||
# else if the user scanned an offline signed tx
|
# else if the user scanned an offline signed tx
|
||||||
# transactions are binary, but qrcode seems to return utf-8...
|
data = bh2u(bitcoin.base_decode(data, length=None, base=43))
|
||||||
data = data.decode('utf-8')
|
|
||||||
z = bitcoin.base_decode(data, length=None, base=43)
|
|
||||||
data = bh2u(''.join(chr(ord(b)) for b in z))
|
|
||||||
tx = self.tx_from_text(data)
|
tx = self.tx_from_text(data)
|
||||||
if not tx:
|
if not tx:
|
||||||
return
|
return
|
||||||
|
|
|
@ -61,8 +61,7 @@ class ScanQRTextEdit(ButtonsTextEdit, MessageBoxMixin):
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
self.show_error(str(e))
|
self.show_error(str(e))
|
||||||
data = ''
|
data = ''
|
||||||
if type(data) != str:
|
data = str(data)
|
||||||
data = ''
|
|
||||||
self.setText(data)
|
self.setText(data)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ def scan_barcode(device='', timeout=-1, display=True, threaded=False):
|
||||||
return
|
return
|
||||||
symbol = libzbar.zbar_symbol_set_first_symbol(symbols)
|
symbol = libzbar.zbar_symbol_set_first_symbol(symbols)
|
||||||
data = libzbar.zbar_symbol_get_data(symbol)
|
data = libzbar.zbar_symbol_get_data(symbol)
|
||||||
return str(data)
|
return data
|
||||||
|
|
||||||
def _find_system_cameras():
|
def _find_system_cameras():
|
||||||
device_root = "/sys/class/video4linux"
|
device_root = "/sys/class/video4linux"
|
||||||
|
|
Loading…
Reference in New Issue