1
0

wallet,gui: improve not_enough_funds_mentioning_frozen

This commit is contained in:
Sander van Grieken
2025-04-08 13:20:51 +02:00
parent cca29eff72
commit d28899c572
6 changed files with 31 additions and 11 deletions

View File

@@ -402,9 +402,10 @@ class QETxFinalizer(TxFeeSlider):
try:
# make unsigned transaction
tx = self.make_tx(amount='!' if self._amount.isMax else self._amount.satsInt)
amount = '!' if self._amount.isMax else self._amount.satsInt
tx = self.make_tx(amount=amount)
except NotEnoughFunds:
self.warning = _("Not enough funds")
self.warning = self._wallet.wallet.get_text_not_enough_funds_mentioning_frozen(for_amount=amount)
self._valid = False
self.validChanged.emit()
return

View File

@@ -851,6 +851,6 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
amount = tx.output_value()
except NotEnoughFunds as e:
self._logger.debug(str(e))
message = self.wallet.get_text_not_enough_funds_mentioning_frozen()
message = self.wallet.get_text_not_enough_funds_mentioning_frozen(for_amount='!')
return amount, message

View File

@@ -490,8 +490,10 @@ class TxEditor(WindowModalDialog):
elif self.can_pay_assuming_zero_fees(confirmed_only=confirmed_only):
self.error += ' ' + _('You need to set a lower fee.')
elif frozen_bal := self.wallet.get_frozen_balance_str():
# FIXME only show if unfreezing would fix "not enough funds"
self.error += ' ' + _("Some coins are frozen: {} (can be unfrozen in the Addresses or in the Coins tab)").format(frozen_bal)
self.error = self.wallet.get_text_not_enough_funds_mentioning_frozen(
for_amount=self.output_value,
hint=_('Can be unfrozen in the Addresses or in the Coins tab')
)
if not self.tx:
if self.not_enough_funds:
self.io_widget.update(None)

View File

@@ -1437,7 +1437,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
# note: use confirmed_only=False here, regardless of config setting,
# as the user needs to get to ConfirmTxDialog to change the config setting
if not d.can_pay_assuming_zero_fees(confirmed_only=False):
text = self.wallet.get_text_not_enough_funds_mentioning_frozen()
text = self.wallet.get_text_not_enough_funds_mentioning_frozen(for_amount=output_value)
self.show_message(text)
return
return d.run(), d.is_preview

View File

@@ -267,7 +267,7 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
tx = make_tx(FixedFeePolicy(0))
except NotEnoughFunds as e:
self.max_button.setChecked(False)
text = self.wallet.get_text_not_enough_funds_mentioning_frozen()
text = self.wallet.get_text_not_enough_funds_mentioning_frozen(for_amount='!')
self.show_error(text)
return