mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-05 05:15:12 +00:00
leave max_button pressed (fix #5251)
This commit is contained in:
parent
c49d5f672c
commit
9b4e490e3c
2 changed files with 12 additions and 12 deletions
|
@ -139,7 +139,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
self.tray = gui_object.tray
|
||||
self.app = gui_object.app
|
||||
self.cleaned_up = False
|
||||
self.is_max = False
|
||||
self.payment_request = None
|
||||
self.checking_accounts = False
|
||||
self.qr_window = None
|
||||
|
@ -1177,6 +1176,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
|
||||
self.max_button = EnterButton(_("Max"), self.spend_max)
|
||||
self.max_button.setFixedWidth(140)
|
||||
self.max_button.setCheckable(True)
|
||||
grid.addWidget(self.max_button, 4, 3)
|
||||
hbox = QHBoxLayout()
|
||||
hbox.addStretch(1)
|
||||
|
@ -1204,7 +1204,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
self.fee_e.setModified(False)
|
||||
|
||||
self.fee_slider.activate()
|
||||
self.spend_max() if self.is_max else self.update_fee()
|
||||
self.spend_max() if self.max_button.isChecked() else self.update_fee()
|
||||
|
||||
self.fee_slider = FeeSlider(self, self.config, fee_cb)
|
||||
self.fee_slider.setFixedWidth(140)
|
||||
|
@ -1298,7 +1298,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
self.amount_e.textEdited.connect(self.update_fee)
|
||||
|
||||
def reset_max(text):
|
||||
self.is_max = False
|
||||
self.max_button.setChecked(False)
|
||||
enable = not bool(text) and not self.amount_e.isReadOnly()
|
||||
self.max_button.setEnabled(enable)
|
||||
self.amount_e.textEdited.connect(reset_max)
|
||||
|
@ -1365,7 +1365,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
def spend_max(self):
|
||||
if run_hook('abort_send', self):
|
||||
return
|
||||
self.is_max = True
|
||||
self.max_button.setChecked(True)
|
||||
self.do_update_fee()
|
||||
|
||||
def update_fee(self):
|
||||
|
@ -1383,7 +1383,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
'''
|
||||
freeze_fee = self.is_send_fee_frozen()
|
||||
freeze_feerate = self.is_send_feerate_frozen()
|
||||
amount = '!' if self.is_max else self.amount_e.get_amount()
|
||||
amount = '!' if self.max_button.isChecked() else self.amount_e.get_amount()
|
||||
if amount is None:
|
||||
if not freeze_fee:
|
||||
self.fee_e.setAmount(None)
|
||||
|
@ -1391,7 +1391,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
self.statusBar().showMessage('')
|
||||
else:
|
||||
fee_estimator = self.get_send_fee_estimator()
|
||||
outputs = self.payto_e.get_outputs(self.is_max)
|
||||
outputs = self.payto_e.get_outputs(self.max_button.isChecked())
|
||||
if not outputs:
|
||||
_type, addr = self.get_payto_or_dummy()
|
||||
outputs = [TxOutput(_type, addr, amount)]
|
||||
|
@ -1460,7 +1460,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
self.feerounding_icon.setToolTip(self.feerounding_text)
|
||||
self.feerounding_icon.setVisible(abs(feerounding) >= 1)
|
||||
|
||||
if self.is_max:
|
||||
if self.max_button.isChecked():
|
||||
amount = tx.output_value()
|
||||
__, x_fee_amount = run_hook('get_tx_extra_fee', self.wallet, tx) or (None, 0)
|
||||
amount_after_all_fees = amount - x_fee_amount
|
||||
|
@ -1559,7 +1559,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
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(self.is_max)
|
||||
outputs = self.payto_e.get_outputs(self.max_button.isChecked())
|
||||
|
||||
if self.payto_e.is_alias and self.payto_e.validated is False:
|
||||
alias = self.payto_e.toPlainText()
|
||||
|
@ -1614,7 +1614,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
self.show_message(str(e))
|
||||
return
|
||||
|
||||
amount = tx.output_value() if self.is_max else sum(map(lambda x:x[2], outputs))
|
||||
amount = tx.output_value() if self.max_button.isChecked() else sum(map(lambda x:x[2], outputs))
|
||||
fee = tx.get_fee()
|
||||
|
||||
use_rbf = self.config.get('use_rbf', True)
|
||||
|
@ -1835,7 +1835,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
|
||||
|
||||
def do_clear(self):
|
||||
self.is_max = False
|
||||
self.max_button.setChecked(False)
|
||||
self.not_enough_funds = False
|
||||
self.payment_request = None
|
||||
self.payto_e.is_pr = False
|
||||
|
|
|
@ -152,11 +152,11 @@ class PayToEdit(CompletionTextEdit, ScanQRTextEdit, PrintError):
|
|||
else:
|
||||
total += output.value
|
||||
|
||||
self.win.is_max = is_max
|
||||
self.win.max_button.setChecked(is_max)
|
||||
self.outputs = outputs
|
||||
self.payto_address = None
|
||||
|
||||
if self.win.is_max:
|
||||
if self.win.max_button.isChecked():
|
||||
self.win.do_update_fee()
|
||||
else:
|
||||
self.amount_edit.setAmount(total if outputs else None)
|
||||
|
|
Loading…
Add table
Reference in a new issue