Browse Source

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
master
SomberNight 2 years ago
parent
commit
4a82072443
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 6
      electrum/gui/qt/my_treeview.py
  2. 1
      electrum/gui/qt/new_channel_dialog.py

6
electrum/gui/qt/my_treeview.py

@ -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

1
electrum/gui/qt/new_channel_dialog.py

@ -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.')

Loading…
Cancel
Save