diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py index d81bb9d56..e3fc3d416 100644 --- a/electrum/gui/qt/channels_list.py +++ b/electrum/gui/qt/channels_list.py @@ -363,6 +363,9 @@ class ChannelsList(MyTreeView): menu.addAction(read_QIcon('update.png'), _('Submarine swap'), lambda: self.main_window.run_swap_dialog()) menu.addSeparator() menu.addAction(_("Import channel backup"), lambda: self.main_window.do_process_from_text_channel_backup()) + # only enable menu if has LN. Or we could selectively enable menu items? + # and maybe add item "main_window.init_lightning_dialog()" when applicable + menu.setEnabled(self.wallet.has_lightning()) self.new_channel_button = EnterButton(_('New Channel'), self.main_window.new_channel_dialog) self.new_channel_button.setEnabled(self.wallet.has_lightning()) toolbar.insertWidget(2, self.new_channel_button) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 4eeb4aebc..67fd252fd 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -1112,6 +1112,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener): if not self.network: self.show_error(_("You are offline.")) return + if not self.wallet.lnworker: + self.show_error(_('Lightning is disabled')) + return if not self.wallet.lnworker.num_sats_can_send() and not self.wallet.lnworker.num_sats_can_receive(): self.show_error(_("You do not have liquidity in your active channels.")) return @@ -2130,6 +2133,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener): def import_channel_backup(self, encrypted: str): if not self.question('Import channel backup?'): return + if not self.wallet.lnworker: + self.show_error(_('Lightning is disabled')) + return try: self.wallet.lnworker.import_channel_backup(encrypted) except Exception as e: