qt: don't show empty BalanceDialog
This commit is contained in:
@@ -39,6 +39,10 @@ from electrum.i18n import _
|
||||
|
||||
from .util import Buttons, CloseButton, WindowModalDialog, ColorScheme
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .main_window import ElectrumWindow
|
||||
from electrum.wallet import Abstract_Wallet
|
||||
|
||||
|
||||
# Todo:
|
||||
# show lightning funds that are not usable
|
||||
@@ -140,7 +144,7 @@ class LegendWidget(QWidget):
|
||||
|
||||
class BalanceDialog(WindowModalDialog):
|
||||
|
||||
def __init__(self, parent, wallet):
|
||||
def __init__(self, parent: 'ElectrumWindow', *, wallet: 'Abstract_Wallet'):
|
||||
|
||||
WindowModalDialog.__init__(self, parent, _("Wallet Balance"))
|
||||
self.wallet = wallet
|
||||
|
||||
@@ -2432,8 +2432,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
||||
console.updateNamespace(methods)
|
||||
|
||||
def show_balance_dialog(self):
|
||||
balance = sum(self.wallet.get_balances_for_piechart())
|
||||
if balance == 0:
|
||||
return
|
||||
from .balance_dialog import BalanceDialog
|
||||
d = BalanceDialog(self, self.wallet)
|
||||
d = BalanceDialog(self, wallet=self.wallet)
|
||||
d.run()
|
||||
|
||||
def create_status_bar(self):
|
||||
|
||||
Reference in New Issue
Block a user