1
0

qt: tooltip formatting function

This commit is contained in:
ThomasV
2021-03-28 09:57:00 +02:00
parent 03a95f36fc
commit 345c2b4295
3 changed files with 7 additions and 3 deletions

View File

@@ -1,5 +1,8 @@
# note: qt and kivy use different i18n methods
def to_rtf(msg):
return '\n'.join(['<p>' + x + '</p>' for x in msg.split('\n\n')])
MSG_RECOVERABLE_CHANNELS = """
Add extra data to your channel funding transactions, so that a static backup can be recovered from your seed.
@@ -8,7 +11,8 @@ Note that static backups only allow you to request a force-close with the remote
If this is enabled, other nodes cannot open a channel to you. Channel recovery data is encrypted, so that only your wallet can decrypt it. However, blockchain analysis will be able to tell that the transaction was probably created by Electrum.
"""
MSG_REQUEST_FORCE_CLOSE = """You may choose to initiate a cooperative close, or request the remote peer to force close the channel.
MSG_REQUEST_FORCE_CLOSE = """
You may choose to initiate a cooperative close, or request the remote peer to force close the channel.
If you request a force-close, your node will pretend that it has lost its data and ask the remote node to broadcast their latest state. Doing so from time to time helps make sure that nodes are honest, because your node can punish them if they broadcast a revoked state."""

View File

@@ -119,7 +119,7 @@ class ChannelsList(MyTreeView):
msg = _('Close channel?')
force_cb = QCheckBox('Request force close from remote peer')
tooltip = _(messages.MSG_REQUEST_FORCE_CLOSE)
tooltip = '<qt>' + tooltip + '</qt>' # rich text is word wrapped
tooltip = messages.to_rtf(tooltip)
def on_checked(b):
self.is_force_close = bool(b)
force_cb.stateChanged.connect(on_checked)

View File

@@ -134,7 +134,7 @@ class SettingsDialog(WindowModalDialog):
if self.wallet.lnworker and self.wallet.lnworker.has_deterministic_node_id():
help_recov = _(messages.MSG_RECOVERABLE_CHANNELS)
recov_cb = QCheckBox(_("Create recoverable channels"))
recov_cb.setToolTip(help_recov)
recov_cb.setToolTip(messages.to_rtf(help_recov))
recov_cb.setChecked(bool(self.config.get('use_recoverable_channels', True)))
def on_recov_checked(x):
self.config.set_key('use_recoverable_channels', bool(x))