def qr_input(self): try: data = qrscanner.scan_barcode(app_state.config.get_video_device()) except Exception 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 qr_input(self): from electrumsv import qrscanner from electrumsv.simple_config import 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 qr_input(self, ignore_uris: bool=False): """ ignore_uris - external logic may already be handling post-processing of scanned data. """ try: data = qrscanner.scan_barcode(app_state.config.get_video_device()) except Exception 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, ignore_uris) return data
def qr_input(self, ignore_uris: bool=False): """ ignore_uris - external logic may already be handling post-processing of scanned data. """ try: data = qrscanner.scan_barcode(app_state.config.get_video_device()) except Exception 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 # This should only be set if the subclass is calling itself and knows that it has replaced # this method and it supports the extra parameter. See `PayToEdit.qr_input()`. if ignore_uris: self.setText(new_text, ignore_uris) else: self.setText(new_text) return data