mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 18:25:21 +00:00
single dialog for confirmation and password
This commit is contained in:
parent
12583246ee
commit
7c4b749340
1 changed files with 35 additions and 29 deletions
|
@ -1159,13 +1159,6 @@ class ElectrumWindow(QMainWindow, PrintError):
|
||||||
QMessageBox.warning(self, _('Error'), _('Invalid Fee'), _('OK'))
|
QMessageBox.warning(self, _('Error'), _('Invalid Fee'), _('OK'))
|
||||||
return
|
return
|
||||||
|
|
||||||
amount = sum(map(lambda x:x[2], outputs))
|
|
||||||
confirm_amount = self.config.get('confirm_amount', COIN)
|
|
||||||
if amount >= confirm_amount:
|
|
||||||
o = '\n'.join(map(lambda x:x[1], outputs))
|
|
||||||
if not self.question(_("send %(amount)s to %(address)s?")%{ 'amount' : self.format_amount(amount) + ' '+ self.base_unit(), 'address' : o}):
|
|
||||||
return
|
|
||||||
|
|
||||||
coins = self.get_coins()
|
coins = self.get_coins()
|
||||||
return outputs, fee, label, coins
|
return outputs, fee, label, coins
|
||||||
|
|
||||||
|
@ -1191,33 +1184,37 @@ class ElectrumWindow(QMainWindow, PrintError):
|
||||||
QMessageBox.warning(self, _('Error'), _("This transaction requires a higher fee, or it will not be propagated by the network."), _('OK'))
|
QMessageBox.warning(self, _('Error'), _("This transaction requires a higher fee, or it will not be propagated by the network."), _('OK'))
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.config.get('can_edit_fees', False):
|
|
||||||
if not self.question(_("A fee of %(fee)s will be added to this transaction.\nProceed?")%{ 'fee' : self.format_amount(fee) + ' '+ self.base_unit()}):
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
confirm_fee = self.config.get('confirm_fee', 100000)
|
|
||||||
if fee >= confirm_fee:
|
|
||||||
msg = '\n'.join([
|
|
||||||
_("The fee for this transaction seems unusually high."),
|
|
||||||
_("Are you really sure you want to pay %(fee)s in fees?")%{ 'fee' : self.format_amount(fee) + ' '+ self.base_unit()}
|
|
||||||
])
|
|
||||||
if not self.question(msg):
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.show_before_broadcast():
|
if self.show_before_broadcast():
|
||||||
self.show_transaction(tx, tx_desc)
|
self.show_transaction(tx, tx_desc)
|
||||||
|
return
|
||||||
|
# confirmation dialog
|
||||||
|
amount = sum(map(lambda x:x[2], outputs))
|
||||||
|
confirm_amount = self.config.get('confirm_amount', COIN)
|
||||||
|
msg = [
|
||||||
|
_("Amount to be sent") + ": %s"%(self.format_amount(amount) + ' '+ self.base_unit()),
|
||||||
|
_("Transaction fee") + ": %s"%(self.format_amount(fee) + ' '+ self.base_unit()),
|
||||||
|
]
|
||||||
|
if self.wallet.use_encryption:
|
||||||
|
msg.append(_("Enter your password to proceed"))
|
||||||
|
password = self.password_dialog('\n'.join(msg))
|
||||||
|
if not password:
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
def sign_done(success):
|
msg.append(_('Proceed?'))
|
||||||
if success:
|
password = None
|
||||||
if not tx.is_complete():
|
if not self.question('\n'.join(msg)):
|
||||||
self.show_transaction(tx)
|
return
|
||||||
self.do_clear()
|
|
||||||
else:
|
def sign_done(success):
|
||||||
self.broadcast_transaction(tx, tx_desc)
|
if success:
|
||||||
self.sign_tx(tx, sign_done)
|
if not tx.is_complete():
|
||||||
|
self.show_transaction(tx)
|
||||||
|
self.do_clear()
|
||||||
|
else:
|
||||||
|
self.broadcast_transaction(tx, tx_desc)
|
||||||
|
self.sign_tx(tx, sign_done, password)
|
||||||
|
|
||||||
|
|
||||||
@protected
|
|
||||||
def sign_tx(self, tx, callback, password, parent=None):
|
def sign_tx(self, tx, callback, password, parent=None):
|
||||||
'''Sign the transaction in a separate thread. When done, calls
|
'''Sign the transaction in a separate thread. When done, calls
|
||||||
the callback with a success code of True or False.
|
the callback with a success code of True or False.
|
||||||
|
@ -1247,6 +1244,15 @@ class ElectrumWindow(QMainWindow, PrintError):
|
||||||
|
|
||||||
def broadcast_transaction(self, tx, tx_desc, parent=None):
|
def broadcast_transaction(self, tx, tx_desc, parent=None):
|
||||||
|
|
||||||
|
confirm_fee = self.config.get('confirm_fee', 100000)
|
||||||
|
if tx.get_fee() >= confirm_fee:
|
||||||
|
msg = '\n'.join([
|
||||||
|
_("The fee for this transaction seems unusually high."),
|
||||||
|
_("Are you really sure you want to pay %(fee)s in fees?")%{ 'fee' : self.format_amount(fee) + ' '+ self.base_unit()}
|
||||||
|
])
|
||||||
|
if not self.question(msg):
|
||||||
|
return
|
||||||
|
|
||||||
def broadcast_thread():
|
def broadcast_thread():
|
||||||
# non-GUI thread
|
# non-GUI thread
|
||||||
pr = self.payment_request
|
pr = self.payment_request
|
||||||
|
|
Loading…
Add table
Reference in a new issue