Skip to content

Commit

Permalink
Merge pull request #9201 from accumulator/sweep_privkey_fixes
Browse files Browse the repository at this point in the history
qt: fix scanning multi (privkeys, addresses) from QR.
  • Loading branch information
SomberNight authored Sep 17, 2024
2 parents eaebcaf + a01ae99 commit ba3935c
Showing 1 changed file with 28 additions and 14 deletions.
42 changes: 28 additions & 14 deletions electrum/gui/qt/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,14 +680,21 @@ def cb(success: bool, error: str, data: Optional[str]):
return
if not data:
data = ''
if allow_multi:
new_text = self.text() + data + '\n' # TODO: unused?
else:
new_text = data
try:
try:
if allow_multi:
text = self.text()
if data in text:
return
if text and not text.endswith('\n'):
text += '\n'
text += data
text += '\n'
setText(text)
else:
new_text = data
setText(new_text)
except Exception as e:
show_error(_('Invalid payment identifier in QR') + ':\n' + repr(e))
except Exception as e:
show_error(_('Invalid payment identifier in QR') + ':\n' + repr(e))

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

def input_file(
self,
Expand Down

0 comments on commit ba3935c

Please sign in to comment.