electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 26efef9e069616ab675231548b642b6296342019
parent aaed594772dde4b6240267e21f067e89bed5fa15
Author: ThomasV <thomasv@electrum.org>
Date:   Fri, 13 Sep 2019 11:55:05 +0200

move lightning settings to settings dialog

Diffstat:
Melectrum/gui/qt/lightning_dialog.py | 44--------------------------------------------
Melectrum/gui/qt/settings_dialog.py | 61++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 60 insertions(+), 45 deletions(-)

diff --git a/electrum/gui/qt/lightning_dialog.py b/electrum/gui/qt/lightning_dialog.py @@ -31,15 +31,6 @@ from PyQt5.QtWidgets import (QDialog, QWidget, QLabel, QVBoxLayout, QCheckBox, from electrum.i18n import _ from .util import HelpLabel, MyTreeView, Buttons -help_local = _("""If this option is checked, Electrum will persist as a daemon after -you close all your wallet windows. Your local watchtower will keep -running, and it will protect your channels even if your wallet is not -open. For this to work, your computer needs to be online regularly.""") - -help_remote = _("""To setup a remote watchtower, you must run an Electrum daemon on a -computer that is always connected to the internet. Configure -'watchtower_host' and 'watchtower_port' in the remote daemon, and -enter the corresponding URL here""") class WatcherList(MyTreeView): def __init__(self, parent): @@ -92,46 +83,11 @@ class LightningDialog(QDialog): watcher_w = QWidget() watcher_vbox = QVBoxLayout(watcher_w) watcher_vbox.addWidget(self.watcher_list) - # settings - settings_w = QWidget() - settings_vbox = QVBoxLayout(settings_w) - persist_cb = QCheckBox(_("Persist as daemon after GUI is closed")) - persist_cb.setToolTip(help_local) - persist_cb.setChecked(bool(self.config.get('persist_daemon', False))) - def on_persist_checked(v): - self.config.set_key('persist_daemon', v == Qt.Checked, save=True) - persist_cb.stateChanged.connect(on_persist_checked) - - remote_cb = QCheckBox(_("Use a remote watchtower")) - remote_cb.setToolTip(help_remote) - remote_cb.setChecked(bool(self.config.get('use_watchtower', False))) - def on_remote_checked(v): - self.config.set_key('use_watchtower', v == Qt.Checked, save=True) - self.watchtower_url_e.setEnabled(v == Qt.Checked) - remote_cb.stateChanged.connect(on_remote_checked) - - watchtower_url = self.config.get('watchtower_url') - self.watchtower_url_e = QLineEdit(watchtower_url) - self.watchtower_url_e.setEnabled(self.config.get('use_watchtower', False)) - def on_url(): - url = self.watchtower_url_e.text() or None - watchtower_url = self.config.set_key('watchtower_url', url) - if url: - self.lnwatcher.set_remote_watchtower() - self.watchtower_url_e.editingFinished.connect(on_url) - g = QGridLayout(settings_w) - g.addWidget(persist_cb, 0, 0, 1, 3) - g.addWidget(remote_cb, 1, 0, 1, 3) - g.addWidget(QLabel(_('URL')), 2, 1) - g.addWidget(self.watchtower_url_e, 2, 2) - settings_vbox.addLayout(g) - settings_vbox.addStretch(1) # tabs tabs = QTabWidget() tabs.addTab(network_w, _('Network')) tabs.addTab(watcher_w, _('Watchtower')) - tabs.addTab(settings_w, _('Settings')) vbox = QVBoxLayout(self) vbox.addWidget(tabs) b = QPushButton(_('Close')) diff --git a/electrum/gui/qt/settings_dialog.py b/electrum/gui/qt/settings_dialog.py @@ -170,6 +170,64 @@ class SettingsDialog(WindowModalDialog): batch_rbf_cb.stateChanged.connect(on_batch_rbf) fee_widgets.append((batch_rbf_cb, None)) + # lightning + help_lightning = _("""Enable Lightning Network payments. Note that funds stored in +lightning channels are not recoverable from your seed. You must backup +your wallet file after every channel creation.""") + lightning_widgets = [] + lightning_cb = QCheckBox(_("Enable Lightning")) + lightning_cb.setToolTip(help_lightning) + lightning_cb.setChecked(bool(self.config.get('lightning', False))) + def on_lightning_checked(x): + self.config.set_key('lightning', bool(x)) + lightning_cb.stateChanged.connect(on_lightning_checked) + lightning_widgets.append((lightning_cb, None)) + + help_local_wt = _("""To setup a local watchtower, you must run Electrum on a machine + that is always connected to the internet. Your watchtower will be private. Configure 'watchtower_host' +and 'watchtower_port' in your config if you want it to be public.""") + local_wt_cb = QCheckBox(_("Run a local watchtower")) + local_wt_cb.setToolTip(help_local_wt) + local_wt_cb.setChecked(bool(self.config.get('local_watchtower', False))) + def on_local_wt_checked(x): + self.config.set_key('local_watchtower', bool(x)) + self.local_wt_port_e.setEnabled(bool(x)) + local_wt_cb.stateChanged.connect(on_local_wt_checked) + self.local_wt_port_e = QLineEdit(self.config.get('watchtower_port')) + self.local_wt_port_e.setEnabled(self.config.get('local_watchtower', False)) + lightning_widgets.append((local_wt_cb, self.local_wt_port_e)) + + help_persist = _("""If this option is checked, Electrum will persist as a daemon after +you close all your wallet windows. Your local watchtower will keep +running, and it will protect your channels even if your wallet is not +open. For this to work, your computer needs to be online regularly.""") + persist_cb = QCheckBox(_("Run as daemon after the GUI is closed")) + persist_cb.setToolTip(help_persist) + persist_cb.setChecked(bool(self.config.get('persist_daemon', False))) + def on_persist_checked(x): + self.config.set_key('persist_daemon', bool(x)) + persist_cb.stateChanged.connect(on_persist_checked) + lightning_widgets.append((persist_cb, None)) + + help_remote_wt = _("""To use a remote watchtower, enter the corresponding URL here""") + remote_wt_cb = QCheckBox(_("Use a remote watchtower")) + remote_wt_cb.setToolTip(help_remote_wt) + remote_wt_cb.setChecked(bool(self.config.get('use_watchtower', False))) + def on_remote_wt_checked(x): + self.config.set_key('use_watchtower', bool(x)) + self.watchtower_url_e.setEnabled(bool(x)) + remote_wt_cb.stateChanged.connect(on_remote_wt_checked) + watchtower_url = self.config.get('watchtower_url') + self.watchtower_url_e = QLineEdit(watchtower_url) + self.watchtower_url_e.setEnabled(self.config.get('use_watchtower', False)) + def on_wt_url(): + url = self.watchtower_url_e.text() or None + watchtower_url = self.config.set_key('watchtower_url', url) + if url: + self.lnwatcher.set_remote_watchtower() + self.watchtower_url_e.editingFinished.connect(on_wt_url) + lightning_widgets.append((remote_wt_cb, self.watchtower_url_e)) + msg = _('OpenAlias record, used to receive coins and to sign payment requests.') + '\n\n'\ + _('The following alias providers are available:') + '\n'\ + '\n'.join(['https://cryptoname.co/', 'http://xmr.link']) + '\n\n'\ @@ -466,9 +524,10 @@ class SettingsDialog(WindowModalDialog): fiat_widgets.append((QLabel(_('Source')), ex_combo)) tabs_info = [ + (gui_widgets, _('General')), (fee_widgets, _('Fees')), (tx_widgets, _('Transactions')), - (gui_widgets, _('General')), + (lightning_widgets, _('Lightning')), (fiat_widgets, _('Fiat')), (server_widgets, _('PayServer')), (oa_widgets, _('OpenAlias')),