diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index aa10fe1b9..7a607caab 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -39,7 +39,7 @@ import asyncio from typing import Optional, TYPE_CHECKING, Sequence, List, Union from PyQt5.QtGui import QPixmap, QKeySequence, QIcon, QCursor, QFont -from PyQt5.QtCore import Qt, QRect, QStringListModel, QSize, pyqtSignal +from PyQt5.QtCore import Qt, QRect, QStringListModel, QSize, pyqtSignal, QPoint from PyQt5.QtCore import QTimer from PyQt5.QtWidgets import (QMessageBox, QComboBox, QSystemTrayIcon, QTabWidget, QMenuBar, QFileDialog, QCheckBox, QLabel, @@ -1461,6 +1461,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): __, x_fee_amount = run_hook('get_tx_extra_fee', self.wallet, tx) or (None, 0) amount_after_all_fees = amount - x_fee_amount self.amount_e.setAmount(amount_after_all_fees) + # show tooltip explaining max amount + mining_fee = tx.get_fee() + mining_fee_str = self.format_amount_and_units(mining_fee) + msg = _("Mining fee: {} (can be adjusted on next screen)").format(mining_fee_str) + if x_fee_amount: + twofactor_fee_str = self.format_amount_and_units(x_fee_amount) + msg += "\n" + _("2fa fee: {} (for the next batch of transactions)").format(twofactor_fee_str) + frozen_bal = self.get_frozen_balance_str() + if frozen_bal: + msg += "\n" + _("Some coins are frozen: {} (can be unfrozen in the Addresses or in the Coins tab)").format(frozen_bal) + QToolTip.showText(self.max_button.mapToGlobal(QPoint(0, 0)), msg) def get_contact_payto(self, key): _type, label = self.contacts.get(key) @@ -1663,13 +1674,19 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): def get_text_not_enough_funds_mentioning_frozen(self) -> str: text = _("Not enough funds") - frozen_bal = sum(self.wallet.get_frozen_balance()) - if frozen_bal: - text += " ({} {} {})".format( - self.format_amount(frozen_bal).strip(), self.base_unit(), _("are frozen") + frozen_str = self.get_frozen_balance_str() + if frozen_str: + text += " ({} {})".format( + frozen_str, _("are frozen") ) return text + def get_frozen_balance_str(self) -> Optional[str]: + frozen_bal = sum(self.wallet.get_frozen_balance()) + if not frozen_bal: + return None + return self.format_amount_and_units(frozen_bal) + def pay_onchain_dialog( self, inputs: Sequence[PartialTxInput], outputs: List[PartialTxOutput], *,