Browse Source

Merge pull request #9201 from accumulator/sweep_privkey_fixes

qt: fix scanning multi (privkeys, addresses) from QR.
master
ghost43 1 year ago committed by GitHub
parent
commit
ba3935c842
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 42
      electrum/gui/qt/util.py

42
electrum/gui/qt/util.py

@ -680,14 +680,21 @@ class GenericInputHandler:
return return
if not data: if not data:
data = '' data = ''
if allow_multi: try:
new_text = self.text() + data + '\n' # TODO: unused? if allow_multi:
else: text = self.text()
new_text = data if data in text:
try: return
if text and not text.endswith('\n'):
text += '\n'
text += data
text += '\n'
setText(text)
else:
new_text = data
setText(new_text) setText(new_text)
except Exception as e: except Exception as e:
show_error(_('Invalid payment identifier in QR') + ':\n' + repr(e)) show_error(_('Invalid payment identifier in QR') + ':\n' + repr(e))
from .qrreader import scan_qrcode from .qrreader import scan_qrcode
if parent is None: if parent is None:
@ -725,14 +732,21 @@ class GenericInputHandler:
show_error(_("No QR code was found on the screen.")) show_error(_("No QR code was found on the screen."))
return return
data = scanned_qr[0].data data = scanned_qr[0].data
if allow_multi: try:
new_text = self.text() + data + '\n' # TODO: unused? if allow_multi:
else: text = self.text()
new_text = data if data in text:
try: return
if text and not text.endswith('\n'):
text += '\n'
text += data
text += '\n'
setText(text)
else:
new_text = data
setText(new_text) setText(new_text)
except Exception as e: except Exception as e:
show_error(_('Invalid payment identifier in QR') + ':\n' + repr(e)) show_error(_('Invalid payment identifier in QR') + ':\n' + repr(e))
def input_file( def input_file(
self, self,

Loading…
Cancel
Save