tFixed Line input - electrum - Electrum Bitcoin wallet (HTM) git clone https://git.parazyd.org/electrum (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules --- (DIR) commit 3863ee9f642514e2960bf808acc3665f13cd7ee6 (DIR) parent 7568d71d126b2f8dad793069539b4a5ecde3e9e8 (HTM) Author: dabura667 <matsuringo667@gmail.com> Date: Sat, 6 Sep 2014 02:05:30 +0900 Fixed Line input Diffstat: M gui/qt/paytoedit.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) --- (DIR) diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py t@@ -23,6 +23,7 @@ from qrtextedit import QRTextEdit import re from decimal import Decimal from electrum import bitcoin +from electrum.i18n import _ RE_ADDRESS = '[1-9A-HJ-NP-Za-km-z]{26,}' RE_ALIAS = '(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>' t@@ -114,15 +115,29 @@ class PayToEdit(QRTextEdit): self.unlock_amount() return - for line in lines: + errors = [] + errtext = "" + for i, line in enumerate(lines): try: type, to_address, amount = self.parse_address_and_amount(line) except: + x, y = line.split(',') + r = x.strip() + m = re.match('^'+RE_ALIAS+'$', r) + address = m.group(2) if m else r + errors.append((i, address)) continue outputs.append((type, to_address, amount)) total += amount + if errors != []: + for x in errors: + errtext += "Line #" + str(x[0]+1) + ": " + x[1] + "\n" + QMessageBox.critical(None, _("Invalid Addresses"), _("ABORTING! Invalid Addresses found:") + "\n\n" + errtext) + self.clear() + return + self.outputs = outputs self.payto_address = None