From 151b64da8488fb3a6dd49d27201219619b0ea2a5 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 7 May 2025 13:59:00 +0000 Subject: [PATCH] wizard: "terms of use": add version number follow-up https://github.com/spesmilo/electrum/pull/9794 --- electrum/gui/messages.py | 9 +++++---- electrum/gui/qt/__init__.py | 3 ++- electrum/gui/qt/wizard/terms_of_use.py | 5 ++--- electrum/simple_config.py | 2 +- electrum/wizard.py | 4 +++- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/electrum/gui/messages.py b/electrum/gui/messages.py index 76737cc85..964cf2a76 100644 --- a/electrum/gui/messages.py +++ b/electrum/gui/messages.py @@ -80,11 +80,12 @@ MSG_LN_UTXO_RESERVE = ( ) # not to be translated -MSG_TERMS_OF_USE = """ -1. Electrum is distributed under the MIT licence by Electrum Technologies GmbH. Most notably, this means that the Electrum software is provided as is, and that it comes without warranty. +MSG_TERMS_OF_USE = ( +"""1. Electrum is distributed under the MIT licence by Electrum Technologies GmbH. Most notably, this means that the Electrum software is provided as is, and that it comes without warranty. 2. We are neither a bank nor a financial service provider. In addition, we do not not store user account data, and we are not an intermediary in the interaction between our software and the Bitcoin blockchain. Therefore, we do not have the possibility to freeze funds or to undo a fraudulent transaction. -3. We do not provide private user support. All issue resolutions are public, and take place on Github or public forums. If someone posing as 'Electrum support' proposes to help you via a private channel, this person is most likely an imposter trying to steal your bitcoins. -""" +3. We do not provide private user support. All issue resolutions are public, and take place on Github or public forums. If someone posing as 'Electrum support' proposes to help you via a private channel, this person is most likely an imposter trying to steal your bitcoins.""" +) +TERMS_OF_USE_LATEST_VERSION : int = 1 # bump this if we want users re-prompted due to changes diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py index c0d673d1d..24fd4309b 100644 --- a/electrum/gui/qt/__init__.py +++ b/electrum/gui/qt/__init__.py @@ -74,6 +74,7 @@ from electrum.keystore import load_keystore from electrum.bip32 import is_xprv from electrum.gui.common_qt.i18n import ElectrumTranslator +from electrum.gui.messages import TERMS_OF_USE_LATEST_VERSION from .util import read_QIcon, ColorScheme, custom_message_box, MessageBoxMixin, WWLabel from .main_window import ElectrumWindow @@ -504,7 +505,7 @@ class ElectrumGui(BaseElectrumGui, Logger): """Ask the user to accept the terms of use. This is only shown if the user has not accepted them yet. """ - if self.config.TERMS_OF_USE_ACCEPTED: + if self.config.TERMS_OF_USE_ACCEPTED >= TERMS_OF_USE_LATEST_VERSION: return from electrum.gui.qt.wizard.terms_of_use import QETermsOfUseWizard dialog = QETermsOfUseWizard(self.config, self.app) diff --git a/electrum/gui/qt/wizard/terms_of_use.py b/electrum/gui/qt/wizard/terms_of_use.py index 449cdfe59..765f7b571 100644 --- a/electrum/gui/qt/wizard/terms_of_use.py +++ b/electrum/gui/qt/wizard/terms_of_use.py @@ -6,7 +6,7 @@ from PyQt6.QtWidgets import QLabel, QHBoxLayout, QScrollArea from electrum.i18n import _ from electrum.wizard import TermsOfUseWizard -from electrum.gui.qt.util import icon_path +from electrum.gui.qt.util import icon_path, WWLabel from electrum.gui import messages from .wizard import QEAbstractWizard, WizardComponent @@ -48,9 +48,8 @@ class WCTermsOfUseScreen(WizardComponent): self.layout().addLayout(hbox_img) - self.tos_label = QLabel() + self.tos_label = WWLabel() self.tos_label.setText(messages.MSG_TERMS_OF_USE) - self.tos_label.setWordWrap(True) self.layout().addWidget(self.tos_label) self._valid = False diff --git a/electrum/simple_config.py b/electrum/simple_config.py index 6e5946bd6..18417ccff 100644 --- a/electrum/simple_config.py +++ b/electrum/simple_config.py @@ -847,7 +847,7 @@ Warning: setting this to too low will result in lots of payment failures."""), QR_READER_FLIP_X = ConfigVar('qrreader_flip_x', default=True, type_=bool) WIZARD_DONT_CREATE_SEGWIT = ConfigVar('nosegwit', default=False, type_=bool) CONFIG_FORGET_CHANGES = ConfigVar('forget_config', default=False, type_=bool) - TERMS_OF_USE_ACCEPTED = ConfigVar('terms_of_use_accepted', default=False, type_=bool) + TERMS_OF_USE_ACCEPTED = ConfigVar('terms_of_use_accepted', default=0, type_=int) # connect to remote submarine swap server SWAPSERVER_URL = ConfigVar('swapserver_url', default='', type_=str) diff --git a/electrum/wizard.py b/electrum/wizard.py index 18f9a50da..c5e748013 100644 --- a/electrum/wizard.py +++ b/electrum/wizard.py @@ -3,6 +3,8 @@ import os from typing import List, NamedTuple, Any, Dict, Optional, Tuple, TYPE_CHECKING +from electrum.gui.messages import TERMS_OF_USE_LATEST_VERSION + from electrum.i18n import _ from electrum.interface import ServerAddr from electrum.keystore import hardware_keystore @@ -784,7 +786,7 @@ class TermsOfUseWizard(AbstractWizard): } def accept_terms_of_use(self, _): - self._config.TERMS_OF_USE_ACCEPTED = True + self._config.TERMS_OF_USE_ACCEPTED = TERMS_OF_USE_LATEST_VERSION def start(self, initial_data: dict = None) -> WizardViewState: if initial_data is None: