From 4909cebdae5705bfcd10ae6e8c0af89bdf545b28 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Mon, 13 Mar 2023 09:36:02 +0100 Subject: [PATCH] move recoverable channel option from preferences to new_channel_dialog toolbar --- electrum/gui/qt/new_channel_dialog.py | 10 +++++++++- electrum/gui/qt/settings_dialog.py | 11 ----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/electrum/gui/qt/new_channel_dialog.py b/electrum/gui/qt/new_channel_dialog.py index 3b3059bd3..717b53dbc 100644 --- a/electrum/gui/qt/new_channel_dialog.py +++ b/electrum/gui/qt/new_channel_dialog.py @@ -9,7 +9,8 @@ from electrum.lnworker import hardcoded_trampoline_nodes from electrum import ecc from electrum.util import NotEnoughFunds, NoDynamicFeeEstimates - +from electrum.gui import messages +from . import util from .util import (WindowModalDialog, Buttons, OkButton, CancelButton, EnterButton, ColorScheme, WWLabel, read_QIcon, IconLabel, char_width_in_lineedit) @@ -33,6 +34,13 @@ class NewChannelDialog(WindowModalDialog): self.trampoline_names = list(self.trampolines.keys()) self.min_amount_sat = min_amount_sat or MIN_FUNDING_SAT vbox = QVBoxLayout(self) + toolbar, menu = util.create_toolbar_with_menu(self.config, '') + recov_tooltip = messages.to_rtf(_(messages.MSG_RECOVERABLE_CHANNELS)) + menu.addConfig( + _("Create recoverable channels"), 'use_recoverable_channels', True, + tooltip=recov_tooltip, + ).setEnabled(self.lnworker.can_have_recoverable_channels()) + vbox.addLayout(toolbar) msg = _('Choose a remote node and an amount to fund the channel.') if min_amount_sat: # only displayed if min_amount_sat is passed as parameter diff --git a/electrum/gui/qt/settings_dialog.py b/electrum/gui/qt/settings_dialog.py index f00ec6c47..12ee77f1a 100644 --- a/electrum/gui/qt/settings_dialog.py +++ b/electrum/gui/qt/settings_dialog.py @@ -105,16 +105,6 @@ class SettingsDialog(QDialog, QtEventListener): nz.valueChanged.connect(on_nz) # lightning - help_recov = _(messages.MSG_RECOVERABLE_CHANNELS) - recov_cb = QCheckBox(_("Create recoverable channels")) - enable_toggle_use_recoverable_channels = bool(self.wallet.lnworker and self.wallet.lnworker.can_have_recoverable_channels()) - recov_cb.setEnabled(enable_toggle_use_recoverable_channels) - recov_cb.setToolTip(messages.to_rtf(help_recov)) - recov_cb.setChecked(bool(self.config.get('use_recoverable_channels', True)) and enable_toggle_use_recoverable_channels) - def on_recov_checked(x): - self.config.set_key('use_recoverable_channels', bool(x)) - recov_cb.stateChanged.connect(on_recov_checked) - help_trampoline = _(messages.MSG_HELP_TRAMPOLINE) trampoline_cb = QCheckBox(_("Use trampoline routing (disable gossip)")) trampoline_cb.setToolTip(messages.to_rtf(help_trampoline)) @@ -377,7 +367,6 @@ class SettingsDialog(QDialog, QtEventListener): gui_widgets.append((msat_cb, None)) gui_widgets.append((thousandsep_cb, None)) lightning_widgets = [] - lightning_widgets.append((recov_cb, None)) lightning_widgets.append((trampoline_cb, None)) lightning_widgets.append((instant_swaps_cb, None)) lightning_widgets.append((remote_wt_cb, self.watchtower_url_e))