Merge branch 'dabura667-fixmultiline'
This commit is contained in:
@@ -1034,6 +1034,10 @@ class ElectrumWindow(QMainWindow):
|
|||||||
if self.payment_request:
|
if self.payment_request:
|
||||||
outputs = self.payment_request.get_outputs()
|
outputs = self.payment_request.get_outputs()
|
||||||
else:
|
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()
|
outputs = self.payto_e.get_outputs()
|
||||||
|
|
||||||
if not outputs:
|
if not outputs:
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class PayToEdit(QRTextEdit):
|
|||||||
self.c = None
|
self.c = None
|
||||||
self.textChanged.connect(self.check_text)
|
self.textChanged.connect(self.check_text)
|
||||||
self.outputs = []
|
self.outputs = []
|
||||||
|
self.errors = []
|
||||||
self.is_pr = False
|
self.is_pr = False
|
||||||
self.scan_f = self.win.pay_from_URI
|
self.scan_f = self.win.pay_from_URI
|
||||||
self.update_size()
|
self.update_size()
|
||||||
@@ -94,6 +95,7 @@ class PayToEdit(QRTextEdit):
|
|||||||
|
|
||||||
|
|
||||||
def check_text(self):
|
def check_text(self):
|
||||||
|
self.errors = []
|
||||||
if self.is_pr:
|
if self.is_pr:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -114,10 +116,11 @@ class PayToEdit(QRTextEdit):
|
|||||||
self.unlock_amount()
|
self.unlock_amount()
|
||||||
return
|
return
|
||||||
|
|
||||||
for line in lines:
|
for i, line in enumerate(lines):
|
||||||
try:
|
try:
|
||||||
type, to_address, amount = self.parse_address_and_amount(line)
|
type, to_address, amount = self.parse_address_and_amount(line)
|
||||||
except:
|
except:
|
||||||
|
self.errors.append((i, line.strip()))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
outputs.append((type, to_address, amount))
|
outputs.append((type, to_address, amount))
|
||||||
@@ -139,13 +142,15 @@ class PayToEdit(QRTextEdit):
|
|||||||
self.unlock_amount()
|
self.unlock_amount()
|
||||||
|
|
||||||
|
|
||||||
|
def get_errors(self):
|
||||||
|
return self.errors
|
||||||
|
|
||||||
def get_outputs(self):
|
def get_outputs(self):
|
||||||
if self.payto_address:
|
if self.payto_address:
|
||||||
try:
|
try:
|
||||||
amount = self.amount_edit.get_amount()
|
amount = self.amount_edit.get_amount()
|
||||||
except:
|
except:
|
||||||
amount = None
|
amount = None
|
||||||
|
|
||||||
self.outputs = [('address', self.payto_address, amount)]
|
self.outputs = [('address', self.payto_address, amount)]
|
||||||
|
|
||||||
return self.outputs[:]
|
return self.outputs[:]
|
||||||
|
|||||||
Reference in New Issue
Block a user