def qr_input(self):
     from electroncash import qrscanner, get_config
     try:
         data = qrscanner.scan_barcode(get_config().get_video_device())
     except BaseException as e:
         self.show_error(str(e))
         data = ''
     self.setText(data)
     return data
示例#2
0
 def qr_input(self):
     from electroncash import qrscanner, get_config
     try:
         data = qrscanner.scan_barcode(get_config().get_video_device())
     except BaseException as e:
         self.show_error(str(e))
         data = ''
     if not data:
         data = ''
     if self.allow_multi:
         new_text = self.text() + data + '\n'
     else:
         new_text = data
     self.setText(new_text)
     return data
 def read_tx_from_qrcode(self):
     from electroncash import qrscanner
     try:
         data = qrscanner.scan_barcode(self.main_window.config.get_video_device())
     except BaseException as e:
         self.show_error(str(e))
         return
     if not data:
         return
     # if the user scanned a bitcoincash URI
     if data.lower().startswith(NetworkConstants.CASHADDR_PREFIX + ':'):
         self.show_error(_("This is not a transaction."))
         return
     # else if the user scanned an offline signed tx
     data = bh2u(bitcoin.base_decode(data, length=None, base=43))
     tx = self.tx_from_text(data)
     if not tx:
         return
     self.user_loaded_transaction(tx)