From 75d800a4eadba9a814c0bcfdce980eec9fd0498a Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 11 Mar 2025 15:08:45 +0000 Subject: [PATCH] gui: move reused text to messages.py --- electrum/gui/messages.py | 9 ++++++++- electrum/gui/qml/qechanneldetails.py | 8 +------- electrum/gui/qml/qechannelopener.py | 2 +- electrum/gui/qt/channels_list.py | 8 +------- electrum/gui/qt/main_window.py | 2 +- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/electrum/gui/messages.py b/electrum/gui/messages.py index 7aac0af8c..8df3d0669 100644 --- a/electrum/gui/messages.py +++ b/electrum/gui/messages.py @@ -30,12 +30,19 @@ MSG_LIGHTNING_SCB_WARNING = _( MSG_LIGHTNING_WARNING = MSG_LIGHTNING_EXPERIMENTAL_WARNING + "\n\n" + MSG_LIGHTNING_SCB_WARNING -MGS_CONFLICTING_BACKUP_INSTANCE = _( +MSG_CONFLICTING_BACKUP_INSTANCE = _( """Another instance of this wallet (same seed) has an open channel with the same remote node. If you create this channel, you will not be able to use both wallets at the same time. Are you sure?""" ) +MSG_LN_EXPLAIN_SCB_BACKUPS = "".join([ + _("Channel backups can be imported in another instance of the same wallet."), " ", + _("In the Electrum mobile app, use the 'Send' button to scan this QR code."), " ", + "\n\n", + _("Please note that channel backups cannot be used to restore your channels."), " ", + _("If you lose your wallet file, the only thing you can do with a backup is to request your channel to be closed, so that your funds will be sent on-chain."), +]) MSG_CAPITAL_GAINS = _( """This summary covers only on-chain transactions (no lightning!). Capital gains are computed by attaching an acquisition price to each UTXO in the wallet, and uses the order of blockchain events (not FIFO).""" diff --git a/electrum/gui/qml/qechanneldetails.py b/electrum/gui/qml/qechanneldetails.py index 029d5b00d..e6f59defa 100644 --- a/electrum/gui/qml/qechanneldetails.py +++ b/electrum/gui/qml/qechanneldetails.py @@ -326,10 +326,4 @@ class QEChannelDetails(AuthMixin, QObject, QtEventListener): @pyqtSlot(result=str) def channelBackupHelpText(self): - return ' '.join([ - _("Channel backups can be imported in another instance of the same wallet."), - _("In the Electrum mobile app, use the 'Send' button to scan this QR code."), - '\n\n', - _("Please note that channel backups cannot be used to restore your channels."), - _("If you lose your wallet file, the only thing you can do with a backup is to request your channel to be closed, so that your funds will be sent on-chain."), - ]) + return messages.MSG_LN_EXPLAIN_SCB_BACKUPS diff --git a/electrum/gui/qml/qechannelopener.py b/electrum/gui/qml/qechannelopener.py index 6f147442f..879d06827 100644 --- a/electrum/gui/qml/qechannelopener.py +++ b/electrum/gui/qml/qechannelopener.py @@ -163,7 +163,7 @@ class QEChannelOpener(QObject, AuthMixin): lnworker = self._wallet.wallet.lnworker if lnworker.has_conflicting_backup_with(self._node_pubkey) and not confirm_backup_conflict: - self.conflictingBackup.emit(messages.MGS_CONFLICTING_BACKUP_INSTANCE) + self.conflictingBackup.emit(messages.MSG_CONFLICTING_BACKUP_INSTANCE) return amount = '!' if self._amount.isMax else self._amount.satsInt diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py index 5f6a22390..372132e4f 100644 --- a/electrum/gui/qt/channels_list.py +++ b/electrum/gui/qt/channels_list.py @@ -170,13 +170,7 @@ class ChannelsList(MyTreeView): self.lnworker.remove_channel_backup(channel_id) def export_channel_backup(self, channel_id): - msg = ' '.join([ - _("Channel backups can be imported in another instance of the same wallet."), - _("In the Electrum mobile app, use the 'Send' button to scan this QR code."), - '\n\n', - _("Please note that channel backups cannot be used to restore your channels."), - _("If you lose your wallet file, the only thing you can do with a backup is to request your channel to be closed, so that your funds will be sent on-chain."), - ]) + msg = messages.MSG_LN_EXPLAIN_SCB_BACKUPS data = self.lnworker.export_channel_backup(channel_id) self.main_window.show_qrcode(data, 'channel backup', help_text=msg, show_copy_text_btn=True) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 951a0835c..2a56c9d74 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -1401,7 +1401,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener): self.show_error(str(e)) return if self.wallet.lnworker.has_conflicting_backup_with(node_id): - msg = messages.MGS_CONFLICTING_BACKUP_INSTANCE + msg = messages.MSG_CONFLICTING_BACKUP_INSTANCE if not self.question(msg): return # we need to know the fee before we broadcast, because the txid is required