From 2d954bb55439ff7d0d84b2c45b43b2c47c0d73b7 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 14 Dec 2023 11:13:57 +0100 Subject: [PATCH] payserver plugin: remove support for qt GUI. (This plugin is not useful without a daemon) fixes #8748 --- electrum/plugins/payserver/__init__.py | 2 +- electrum/plugins/payserver/qt.py | 93 -------------------------- 2 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 electrum/plugins/payserver/qt.py diff --git a/electrum/plugins/payserver/__init__.py b/electrum/plugins/payserver/__init__.py index 6b14110386fa..52e3fb61c677 100644 --- a/electrum/plugins/payserver/__init__.py +++ b/electrum/plugins/payserver/__init__.py @@ -2,4 +2,4 @@ fullname = _('PayServer') description = 'run a HTTP server for receiving payments' -available_for = ['qt', 'cmdline'] +available_for = ['cmdline'] diff --git a/electrum/plugins/payserver/qt.py b/electrum/plugins/payserver/qt.py deleted file mode 100644 index e2e36b470cf0..000000000000 --- a/electrum/plugins/payserver/qt.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python -# -# Electrum - Lightweight Bitcoin Client -# Copyright (C) 2022 The Electrum Developers -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation files -# (the "Software"), to deal in the Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, sublicense, and/or sell copies of the Software, -# and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -from functools import partial -from typing import TYPE_CHECKING -from PyQt5 import QtWidgets - -from electrum.i18n import _ -from electrum.plugin import hook -from electrum.gui.qt.util import WindowModalDialog, OkButton, Buttons, EnterButton, webopen -from .payserver import PayServerPlugin - -if TYPE_CHECKING: - from electrum.gui.qt import ElectrumGui - - -class Plugin(PayServerPlugin): - - _init_qt_received = False - - @hook - def init_qt(self, gui: 'ElectrumGui'): - if self._init_qt_received: # only need/want the first signal - return - self._init_qt_received = True - # If the user just enabled the plugin, the 'load_wallet' hook would not - # get called for already loaded wallets, hence we call it manually for those: - for window in gui.windows: - self.daemon_wallet_loaded(gui.daemon, window.wallet) - - def requires_settings(self): - return True - - def settings_widget(self, window: WindowModalDialog): - return EnterButton( - _('Settings'), - partial(self.settings_dialog, window)) - - def settings_dialog(self, window: WindowModalDialog): - if self.config.NETWORK_OFFLINE: - window.show_error(_("You are offline.")) - return - d = WindowModalDialog(window, _("PayServer Settings")) - form = QtWidgets.QFormLayout(None) - addr = self.config.PAYSERVER_ADDRESS - assert self.server - url = self.server.base_url + self.server.root + '/create_invoice.html' - self.help_button = QtWidgets.QPushButton('View sample invoice creation form') - self.help_button.clicked.connect(lambda: webopen(url)) - address_e = QtWidgets.QLineEdit(addr) - keyfile_e = QtWidgets.QLineEdit(self.config.SSL_KEYFILE_PATH) - certfile_e = QtWidgets.QLineEdit(self.config.SSL_CERTFILE_PATH) - form.addRow(QtWidgets.QLabel("Network address:"), address_e) - form.addRow(QtWidgets.QLabel("SSL key file:"), keyfile_e) - form.addRow(QtWidgets.QLabel("SSL cert file:"), certfile_e) - vbox = QtWidgets.QVBoxLayout(d) - vbox.addLayout(form) - vbox.addSpacing(20) - vbox.addWidget(self.help_button) - vbox.addSpacing(20) - vbox.addLayout(Buttons(OkButton(d))) - if d.exec_(): - self.config.PAYSERVER_ADDRESS = str(address_e.text()) - self.config.SSL_KEYFILE_PATH = str(keyfile_e.text()) - self.config.SSL_CERTFILE_PATH = str(certfile_e.text()) - # fixme: restart the server - window.show_message('Please restart Electrum to enable those changes') - - @hook - def receive_list_menu(self, parent, menu, key): - menu.addAction(_("View in payserver"), lambda: webopen(self.view_url(key)))