electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit f1e55a5b16594eb55ab078828126c2c5176d6e1e
parent cdefecc16b8622efef9389e5c35e16096899e8af
Author: ThomasV <thomasv@gitorious>
Date:   Sat,  6 Sep 2014 15:06:55 +0200

Merge branch 'dabura667-fixmultiline'

Diffstat:
Mgui/qt/main_window.py | 4++++
Mgui/qt/paytoedit.py | 9+++++++--
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -1034,6 +1034,10 @@ class ElectrumWindow(QMainWindow): if self.payment_request: outputs = self.payment_request.get_outputs() else: + errors = self.payto_e.get_errors() + if errors: + self.show_warning(_("Invalid Lines found:") + "\n\n" + '\n'.join([ _("Line #") + str(x[0]+1) + ": " + x[1] for x in errors])) + return outputs = self.payto_e.get_outputs() if not outputs: diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py @@ -42,6 +42,7 @@ class PayToEdit(QRTextEdit): self.c = None self.textChanged.connect(self.check_text) self.outputs = [] + self.errors = [] self.is_pr = False self.scan_f = self.win.pay_from_URI self.update_size() @@ -94,6 +95,7 @@ class PayToEdit(QRTextEdit): def check_text(self): + self.errors = [] if self.is_pr: return @@ -114,10 +116,11 @@ class PayToEdit(QRTextEdit): self.unlock_amount() return - for line in lines: + for i, line in enumerate(lines): try: type, to_address, amount = self.parse_address_and_amount(line) except: + self.errors.append((i, line.strip())) continue outputs.append((type, to_address, amount)) @@ -139,13 +142,15 @@ class PayToEdit(QRTextEdit): self.unlock_amount() + def get_errors(self): + return self.errors + def get_outputs(self): if self.payto_address: try: amount = self.amount_edit.get_amount() except: amount = None - self.outputs = [('address', self.payto_address, amount)] return self.outputs[:]