1
0

qt: new_channel_dialog: init USE_RECOVERABLE_CHANNELS cb intuitively

if `not lnworker.can_have_recoverable_channels()`,
- previously: the cb was disabled and checked
- now: the cb is disabled and unchecked
This commit is contained in:
SomberNight
2024-01-17 14:13:20 +00:00
parent e2bb7df54a
commit 4a82072443
2 changed files with 5 additions and 2 deletions

View File

@@ -89,16 +89,18 @@ class MyMenu(QMenu):
configvar: 'ConfigVarWithConfig',
*,
callback=None,
checked: Optional[bool] = None, # to override initial state of checkbox
short_desc: Optional[str] = None,
) -> QAction:
assert isinstance(configvar, ConfigVarWithConfig), configvar
if short_desc is None:
short_desc = configvar.get_short_desc()
assert short_desc is not None, f"short_desc missing for {configvar}"
b = configvar.get()
if checked is None:
checked = bool(configvar.get())
m = self.addAction(short_desc, lambda: self._do_toggle_config(configvar, callback=callback))
m.setCheckable(True)
m.setChecked(bool(b))
m.setChecked(checked)
if (long_desc := configvar.get_long_desc()) is not None:
m.setToolTip(messages.to_rtf(long_desc))
return m

View File

@@ -37,6 +37,7 @@ class NewChannelDialog(WindowModalDialog):
toolbar, menu = create_toolbar_with_menu(self.config, '')
menu.addConfig(
self.config.cv.LIGHTNING_USE_RECOVERABLE_CHANNELS,
checked=self.lnworker.has_recoverable_channels(),
).setEnabled(self.lnworker.can_have_recoverable_channels())
vbox.addLayout(toolbar)
msg = _('Choose a remote node and an amount to fund the channel.')