Browse Source

Qt: invert trampoline checkbox in settings dialog. Share the help message with Kivy

patch-4
ThomasV 4 years ago
parent
commit
f6b2e63b2a
  1. 7
      electrum/gui/kivy/uix/dialogs/settings.py
  2. 6
      electrum/gui/messages.py
  3. 17
      electrum/gui/qt/settings_dialog.py

7
electrum/gui/kivy/uix/dialogs/settings.py

@ -9,6 +9,7 @@ from electrum.gui.kivy.i18n import _
from electrum.plugin import run_hook
from electrum import coinchooser
from electrum.gui import messages
from electrum.gui.kivy import KIVY_GUI_PATH
from .choice_dialog import ChoiceDialog
@ -155,11 +156,7 @@ class SettingsDialog(Factory.Popup):
self._unit_dialog.open()
def routing_dialog(self, item, dt):
description = \
_('Lightning payments require finding a path through the Lightning Network.')\
+ ' ' + ('You may use trampoline routing, or local routing (gossip).')\
+ ' ' + ('Downloading the network gossip uses quite some bandwidth and storage, and is not recommended on mobile devices.')\
+ ' ' + ('If you use trampoline, you can only open channels with trampoline nodes.')
description = _(messages.MSG_HELP_TRAMPOLINE)
def cb(text):
self.app.use_gossip = (text == 'Gossip')
dialog = ChoiceDialog(

6
electrum/gui/messages.py

@ -25,3 +25,9 @@ It may be imported in another Electrum wallet with the same seed.
MSG_LIGHTNING_WARNING = """
Electrum uses static channel backups. If you lose your wallet file, you will need to request your channel to be force-closed by the remote peer in order to recover your funds. This assumes that the remote peer is reachable, and has not lost its own data.
"""
MSG_HELP_TRAMPOLINE = """
Lightning payments require finding a path through the Lightning Network. You may use trampoline routing, or local routing (gossip).
Downloading the network gossip uses quite some bandwidth and storage, and is not recommended on mobile devices. If you use trampoline, you can only open channels with trampoline nodes.
"""

17
electrum/gui/qt/settings_dialog.py

@ -142,13 +142,12 @@ class SettingsDialog(WindowModalDialog):
recov_cb.setEnabled(not bool(self.config.get('lightning_listen')))
lightning_widgets.append((recov_cb, None))
help_gossip = _("""If this option is enabled, Electrum will download the network
channels graph and compute payment path locally, instead of using trampoline payments. """)
gossip_cb = QCheckBox(_("Enable gossip (disable trampoline)"))
gossip_cb.setToolTip(help_gossip)
gossip_cb.setChecked(bool(self.config.get('use_gossip', False)))
def on_gossip_checked(x):
use_gossip = bool(x)
help_trampoline = _(messages.MSG_HELP_TRAMPOLINE)
trampoline_cb = QCheckBox(_("Use trampoline routing (disable gossip)"))
trampoline_cb.setToolTip(messages.to_rtf(help_trampoline))
trampoline_cb.setChecked(not bool(self.config.get('use_gossip', False)))
def on_trampoline_checked(use_trampoline):
use_gossip = not bool(use_trampoline)
self.config.set_key('use_gossip', use_gossip)
if use_gossip:
self.window.network.start_gossip()
@ -158,8 +157,8 @@ channels graph and compute payment path locally, instead of using trampoline pay
util.trigger_callback('ln_gossip_sync_progress')
# FIXME: update all wallet windows
util.trigger_callback('channels_updated', self.wallet)
gossip_cb.stateChanged.connect(on_gossip_checked)
lightning_widgets.append((gossip_cb, None))
trampoline_cb.stateChanged.connect(on_trampoline_checked)
lightning_widgets.append((trampoline_cb, None))
help_remote_wt = ' '.join([
_("A watchtower is a daemon that watches your channels and prevents the other party from stealing funds by broadcasting an old state."),

Loading…
Cancel
Save