minor fixes for payto_edit

This commit is contained in:
ThomasV 2014-06-06 07:17:47 +02:00
parent 7c3d8471e5
commit 0673df9176
2 changed files with 7 additions and 6 deletions

View File

@ -810,7 +810,8 @@ class ElectrumWindow(QMainWindow):
confirm_amount = self.config.get('confirm_amount', 100000000) confirm_amount = self.config.get('confirm_amount', 100000000)
if amount >= confirm_amount: if amount >= confirm_amount:
if not self.question(_("send %(amount)s to %(address)s?")%{ 'amount' : self.format_amount(amount) + ' '+ self.base_unit(), 'address' : to_address}): o = '\n'.join(map(lambda x:x[0], outputs))
if not self.question(_("send %(amount)s to %(address)s?")%{ 'amount' : self.format_amount(amount) + ' '+ self.base_unit(), 'address' : o}):
return return
confirm_fee = self.config.get('confirm_fee', 100000) confirm_fee = self.config.get('confirm_fee', 100000)

View File

@ -40,6 +40,7 @@ class PayToEdit(QTextEdit):
self.setMinimumHeight(27) self.setMinimumHeight(27)
self.setMaximumHeight(27) self.setMaximumHeight(27)
self.c = None self.c = None
self.textChanged.connect(self.check_text)
def lock_amount(self): def lock_amount(self):
self.amount_edit.setFrozen(True) self.amount_edit.setFrozen(True)
@ -80,12 +81,13 @@ class PayToEdit(QTextEdit):
outputs = [] outputs = []
total = 0 total = 0
self.payto_address = None
if len(lines) == 1: if len(lines) == 1:
try: try:
self.payto_address = self.parse_address(lines[0]) self.payto_address = self.parse_address(lines[0])
except: except:
self.payto_address = None pass
if self.payto_address: if self.payto_address:
self.unlock_amount() self.unlock_amount()
return return
@ -119,7 +121,7 @@ class PayToEdit(QTextEdit):
if self.payto_address: if self.payto_address:
if not bitcoin.is_address(self.payto_address): if not bitcoin.is_address(self.payto_address):
QMessageBox.warning(self, _('Error'), _('Invalid Bitcoin Address') + ':\n' + to_address, _('OK')) QMessageBox.warning(self, _('Error'), _('Invalid Bitcoin Address') + ':\n' + self.payto_address, _('OK'))
return return
try: try:
@ -165,7 +167,6 @@ class PayToEdit(QTextEdit):
tc.movePosition(QTextCursor.EndOfWord) tc.movePosition(QTextCursor.EndOfWord)
tc.insertText(completion.right(extra)) tc.insertText(completion.right(extra))
self.setTextCursor(tc) self.setTextCursor(tc)
self.check_text()
def textUnderCursor(self): def textUnderCursor(self):
@ -195,7 +196,6 @@ class PayToEdit(QTextEdit):
if not self.c or not isShortcut: if not self.c or not isShortcut:
QTextEdit.keyPressEvent(self, e) QTextEdit.keyPressEvent(self, e)
self.check_text()
ctrlOrShift = e.modifiers() and (Qt.ControlModifier or Qt.ShiftModifier) ctrlOrShift = e.modifiers() and (Qt.ControlModifier or Qt.ShiftModifier)