qt ChannelsList: disable toolbar menu if not wallet.has_lightning()
closes https://github.com/spesmilo/electrum/issues/8321
This commit is contained in:
@@ -363,6 +363,9 @@ class ChannelsList(MyTreeView):
|
|||||||
menu.addAction(read_QIcon('update.png'), _('Submarine swap'), lambda: self.main_window.run_swap_dialog())
|
menu.addAction(read_QIcon('update.png'), _('Submarine swap'), lambda: self.main_window.run_swap_dialog())
|
||||||
menu.addSeparator()
|
menu.addSeparator()
|
||||||
menu.addAction(_("Import channel backup"), lambda: self.main_window.do_process_from_text_channel_backup())
|
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 = EnterButton(_('New Channel'), self.main_window.new_channel_dialog)
|
||||||
self.new_channel_button.setEnabled(self.wallet.has_lightning())
|
self.new_channel_button.setEnabled(self.wallet.has_lightning())
|
||||||
toolbar.insertWidget(2, self.new_channel_button)
|
toolbar.insertWidget(2, self.new_channel_button)
|
||||||
|
|||||||
@@ -1112,6 +1112,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
|
|||||||
if not self.network:
|
if not self.network:
|
||||||
self.show_error(_("You are offline."))
|
self.show_error(_("You are offline."))
|
||||||
return
|
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():
|
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."))
|
self.show_error(_("You do not have liquidity in your active channels."))
|
||||||
return
|
return
|
||||||
@@ -2130,6 +2133,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
|
|||||||
def import_channel_backup(self, encrypted: str):
|
def import_channel_backup(self, encrypted: str):
|
||||||
if not self.question('Import channel backup?'):
|
if not self.question('Import channel backup?'):
|
||||||
return
|
return
|
||||||
|
if not self.wallet.lnworker:
|
||||||
|
self.show_error(_('Lightning is disabled'))
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
self.wallet.lnworker.import_channel_backup(encrypted)
|
self.wallet.lnworker.import_channel_backup(encrypted)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user