Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion electrum/gui/qt/channels_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,11 @@ def create_toolbar(self, config):
# 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.can_have_lightning())
if not self.wallet.can_have_lightning():
self.new_channel_button.setEnabled(False)
self.new_channel_button.setToolTip(_("Lightning is not available for this wallet."))
else:
self.new_channel_button.setToolTip(_("Open a channel to send payments over the Lightning network."))
toolbar.insertWidget(2, self.new_channel_button)
return toolbar

Expand Down
24 changes: 21 additions & 3 deletions electrum/gui/qt/confirm_tx_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ def update_tab_visibility(self):
# always show onchain payment tab
self.tab_widget.addTab(self.onchain_tab, _('Onchain Transaction'))

allow_swaps = self.allow_preview and self.payee_outputs # allow_preview is false for ln channel opening txs
# allow_preview is false for ln channel opening txs
allow_swaps = self.allow_preview and self.payee_outputs and self.swap_manager
if self.config.WALLET_ENABLE_SUBMARINE_PAYMENTS and allow_swaps:
i = self.tab_widget.addTab(self.submarine_payment_tab, _('Submarine Payment'))
tooltip = self.config.cv.WALLET_ENABLE_SUBMARINE_PAYMENTS.get_long_desc()
Expand Down Expand Up @@ -499,8 +500,23 @@ def cb():
self.resize_to_fit_content()
self.pref_menu.addConfig(self.config.cv.GUI_QT_TX_EDITOR_SHOW_LOCKTIME, callback=cb)
self.pref_menu.addSeparator()
self.pref_menu.addConfig(self.config.cv.WALLET_SEND_CHANGE_TO_LIGHTNING, callback=self.trigger_update)
self.pref_menu.addConfig(self.config.cv.WALLET_ENABLE_SUBMARINE_PAYMENTS, callback=self.update_tab_visibility)
can_have_lightning = self.wallet.can_have_lightning()
send_ch_to_ln = self.pref_menu.addConfig(
self.config.cv.WALLET_SEND_CHANGE_TO_LIGHTNING,
callback=self.trigger_update,
checked=False if not can_have_lightning else None,
)
sub_payments = self.pref_menu.addConfig(
self.config.cv.WALLET_ENABLE_SUBMARINE_PAYMENTS,
callback=self.update_tab_visibility,
checked=False if not can_have_lightning else None,
)
if not can_have_lightning: # disable the buttons and override tooltip
ln_unavailable_msg = _("Not available for this wallet.") \
+ "\n" + _("Requires a wallet with Lightning network support.")
for ln_conf in (send_ch_to_ln, sub_payments):
ln_conf.setEnabled(False)
ln_conf.setToolTip(ln_unavailable_msg)
self.pref_menu.addToggle(
_('Use change addresses'),
self.toggle_use_change,
Expand All @@ -523,6 +539,8 @@ def cb():
self.pref_menu.addConfig(self.config.cv.WALLET_COIN_CHOOSER_OUTPUT_ROUNDING, callback=self.trigger_update)
self.pref_button = QToolButton()
self.pref_button.setIcon(read_QIcon("preferences.png"))
self.pref_button.setText(_('Tools'))
self.pref_button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
self.pref_button.setMenu(self.pref_menu)
self.pref_button.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
self.pref_button.setFocusPolicy(Qt.FocusPolicy.NoFocus)
Expand Down