From 6c62fb03ac1231012faed03e5ec610b13386be63 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sat, 23 Nov 2019 11:02:31 +0100 Subject: [PATCH] fix #5733 --- electrum/gui/qt/__init__.py | 10 +++++++--- electrum/gui/qt/main_window.py | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py index 697d64f2a..459c4a60c 100644 --- a/electrum/gui/qt/__init__.py +++ b/electrum/gui/qt/__init__.py @@ -155,8 +155,12 @@ class ElectrumGui(Logger): else: m = self.tray.contextMenu() m.clear() - m.addAction(_("Lightning"), self.show_lightning_dialog) - m.addAction(_("Watchtower"), self.show_watchtower_dialog) + network = self.daemon.network + m.addAction(_("Network"), self.show_network_dialog) + if network.lngossip: + m.addAction(_("Lightning Network"), self.show_lightning_dialog) + if network.local_watchtower: + m.addAction(_("Local Watchtower"), self.show_watchtower_dialog) for window in self.windows: name = window.wallet.basename() submenu = m.addMenu(name) @@ -210,7 +214,7 @@ class ElectrumGui(Logger): self.watchtower_dialog = WatchtowerDialog(self) self.watchtower_dialog.bring_to_top() - def show_network_dialog(self, parent): + def show_network_dialog(self): if not self.daemon.network: parent.show_warning(_('You are using Electrum in offline mode; restart Electrum if you want to get connected'), title=_('Offline')) return diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 9b74c3394..960a1d19a 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -639,7 +639,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): # Settings / Preferences are all reserved keywords in macOS using this as work around tools_menu.addAction(_("Electrum preferences") if sys.platform == 'darwin' else _("Preferences"), self.settings_dialog) - tools_menu.addAction(_("&Network"), lambda: self.gui_object.show_network_dialog(self)) + tools_menu.addAction(_("&Network"), self.gui_object.show_network_dialog) if self.wallet.has_lightning(): tools_menu.addAction(_("&Lightning"), self.gui_object.show_lightning_dialog) tools_menu.addAction(_("&Watchtower"), self.gui_object.show_watchtower_dialog) @@ -1999,7 +1999,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): if self.wallet.has_lightning(): self.lightning_button = StatusBarButton(read_QIcon("lightning.png"), _("Lightning Network"), self.gui_object.show_lightning_dialog) sb.addPermanentWidget(self.lightning_button) - self.status_button = StatusBarButton(read_QIcon("status_disconnected.png"), _("Network"), lambda: self.gui_object.show_network_dialog(self)) + self.status_button = StatusBarButton(read_QIcon("status_disconnected.png"), _("Network"), self.gui_object.show_network_dialog) sb.addPermanentWidget(self.status_button) run_hook('create_status_bar', sb) self.setStatusBar(sb)