From 7337165d0e2db8e673af211cbe8c7cd49a860f2d Mon Sep 17 00:00:00 2001 From: dabura667 Date: Sat, 6 Sep 2014 01:07:44 +0900 Subject: [PATCH 1/2] Fixed CSV input bug --- gui/qt/main_window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index 5fd473af..0cbfde85 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -2201,7 +2201,7 @@ class ElectrumWindow(QMainWindow): try: for position, row in enumerate(csvReader): address = row[0] - if not is_address(address): + if not bitcoin.is_address(address): errors.append((position, address)) continue amount = Decimal(row[1]) From 4cc52ce11089862cf692e7edfb44d88372dab3f1 Mon Sep 17 00:00:00 2001 From: dabura667 Date: Sat, 6 Sep 2014 02:05:30 +0900 Subject: [PATCH 2/2] Fixed Line input --- gui/qt/paytoedit.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py index 8b3e24c3..af0ee245 100644 --- a/gui/qt/paytoedit.py +++ b/gui/qt/paytoedit.py @@ -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,})\>' @@ -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