1
0

qt: don't show empty BalanceDialog

This commit is contained in:
SomberNight
2022-05-14 18:32:52 +02:00
parent 2e260bd602
commit 2b7cf31308
2 changed files with 9 additions and 2 deletions

View File

@@ -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

View File

@@ -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):