mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
qt: show_message and friends display plaintext by default
This commit is contained in:
parent
5248613e9d
commit
5dc240d4ed
3 changed files with 24 additions and 15 deletions
|
@ -610,7 +610,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
_("Before reporting a bug, upgrade to the most recent version of Electrum (latest release or git HEAD), and include the version number in your report."),
|
_("Before reporting a bug, upgrade to the most recent version of Electrum (latest release or git HEAD), and include the version number in your report."),
|
||||||
_("Try to explain not only what the bug is, but how it occurs.")
|
_("Try to explain not only what the bug is, but how it occurs.")
|
||||||
])
|
])
|
||||||
self.show_message(msg, title="Electrum - " + _("Reporting Bugs"))
|
self.show_message(msg, title="Electrum - " + _("Reporting Bugs"), rich_text=True)
|
||||||
|
|
||||||
def notify_transactions(self):
|
def notify_transactions(self):
|
||||||
if self.tx_notification_queue.qsize() == 0:
|
if self.tx_notification_queue.qsize() == 0:
|
||||||
|
|
|
@ -190,24 +190,24 @@ class MessageBoxMixin(object):
|
||||||
parent, title or '',
|
parent, title or '',
|
||||||
msg, buttons=Yes|No, defaultButton=No) == Yes
|
msg, buttons=Yes|No, defaultButton=No) == Yes
|
||||||
|
|
||||||
def show_warning(self, msg, parent=None, title=None):
|
def show_warning(self, msg, parent=None, title=None, **kwargs):
|
||||||
return self.msg_box(QMessageBox.Warning, parent,
|
return self.msg_box(QMessageBox.Warning, parent,
|
||||||
title or _('Warning'), msg)
|
title or _('Warning'), msg, **kwargs)
|
||||||
|
|
||||||
def show_error(self, msg, parent=None):
|
def show_error(self, msg, parent=None, **kwargs):
|
||||||
return self.msg_box(QMessageBox.Warning, parent,
|
return self.msg_box(QMessageBox.Warning, parent,
|
||||||
_('Error'), msg)
|
_('Error'), msg, **kwargs)
|
||||||
|
|
||||||
def show_critical(self, msg, parent=None, title=None):
|
def show_critical(self, msg, parent=None, title=None, **kwargs):
|
||||||
return self.msg_box(QMessageBox.Critical, parent,
|
return self.msg_box(QMessageBox.Critical, parent,
|
||||||
title or _('Critical Error'), msg)
|
title or _('Critical Error'), msg, **kwargs)
|
||||||
|
|
||||||
def show_message(self, msg, parent=None, title=None):
|
def show_message(self, msg, parent=None, title=None, **kwargs):
|
||||||
return self.msg_box(QMessageBox.Information, parent,
|
return self.msg_box(QMessageBox.Information, parent,
|
||||||
title or _('Information'), msg)
|
title or _('Information'), msg, **kwargs)
|
||||||
|
|
||||||
def msg_box(self, icon, parent, title, text, buttons=QMessageBox.Ok,
|
def msg_box(self, icon, parent, title, text, buttons=QMessageBox.Ok,
|
||||||
defaultButton=QMessageBox.NoButton):
|
defaultButton=QMessageBox.NoButton, rich_text=False):
|
||||||
parent = parent or self.top_level_window()
|
parent = parent or self.top_level_window()
|
||||||
if type(icon) is QPixmap:
|
if type(icon) is QPixmap:
|
||||||
d = QMessageBox(QMessageBox.Information, title, str(text), buttons, parent)
|
d = QMessageBox(QMessageBox.Information, title, str(text), buttons, parent)
|
||||||
|
@ -216,7 +216,12 @@ class MessageBoxMixin(object):
|
||||||
d = QMessageBox(icon, title, str(text), buttons, parent)
|
d = QMessageBox(icon, title, str(text), buttons, parent)
|
||||||
d.setWindowModality(Qt.WindowModal)
|
d.setWindowModality(Qt.WindowModal)
|
||||||
d.setDefaultButton(defaultButton)
|
d.setDefaultButton(defaultButton)
|
||||||
d.setTextInteractionFlags(Qt.TextSelectableByMouse | Qt.LinksAccessibleByMouse)
|
if rich_text:
|
||||||
|
d.setTextInteractionFlags(Qt.TextSelectableByMouse| Qt.LinksAccessibleByMouse)
|
||||||
|
d.setTextFormat(Qt.RichText)
|
||||||
|
else:
|
||||||
|
d.setTextInteractionFlags(Qt.TextSelectableByMouse)
|
||||||
|
d.setTextFormat(Qt.PlainText)
|
||||||
return d.exec_()
|
return d.exec_()
|
||||||
|
|
||||||
class WindowModalDialog(QDialog, MessageBoxMixin):
|
class WindowModalDialog(QDialog, MessageBoxMixin):
|
||||||
|
|
|
@ -170,19 +170,22 @@ class Plugin(RevealerPlugin):
|
||||||
code_id = self.versioned_seed.checksum
|
code_id = self.versioned_seed.checksum
|
||||||
dialog.show_message(''.join([_("{} encrypted for Revealer {}_{} saved as PNG and PDF at: ").format(self.was, version, code_id),
|
dialog.show_message(''.join([_("{} encrypted for Revealer {}_{} saved as PNG and PDF at: ").format(self.was, version, code_id),
|
||||||
"<b>", self.get_path_to_revealer_file(), "</b>", "<br/>",
|
"<b>", self.get_path_to_revealer_file(), "</b>", "<br/>",
|
||||||
"<br/>", "<b>", _("Always check you backups.")]))
|
"<br/>", "<b>", _("Always check you backups.")]),
|
||||||
|
rich_text=True)
|
||||||
dialog.close()
|
dialog.close()
|
||||||
|
|
||||||
def ext_warning(self, dialog):
|
def ext_warning(self, dialog):
|
||||||
dialog.show_message(''.join(["<b>",_("Warning"), ": </b>",
|
dialog.show_message(''.join(["<b>",_("Warning"), ": </b>",
|
||||||
_("your seed extension will <b>not</b> be included in the encrypted backup.")]))
|
_("your seed extension will <b>not</b> be included in the encrypted backup.")]),
|
||||||
|
rich_text=True)
|
||||||
dialog.close()
|
dialog.close()
|
||||||
|
|
||||||
def bdone(self, dialog):
|
def bdone(self, dialog):
|
||||||
version = self.versioned_seed.version
|
version = self.versioned_seed.version
|
||||||
code_id = self.versioned_seed.checksum
|
code_id = self.versioned_seed.checksum
|
||||||
dialog.show_message(''.join([_("Digital Revealer ({}_{}) saved as PNG and PDF at:").format(version, code_id),
|
dialog.show_message(''.join([_("Digital Revealer ({}_{}) saved as PNG and PDF at:").format(version, code_id),
|
||||||
"<br/>","<b>", self.get_path_to_revealer_file(), '</b>']))
|
"<br/>","<b>", self.get_path_to_revealer_file(), '</b>']),
|
||||||
|
rich_text=True)
|
||||||
|
|
||||||
|
|
||||||
def customtxt_limits(self):
|
def customtxt_limits(self):
|
||||||
|
@ -208,7 +211,8 @@ class Plugin(RevealerPlugin):
|
||||||
.format(warning=_("Warning"),
|
.format(warning=_("Warning"),
|
||||||
ver0=_("Revealers starting with 0 are not secure due to a vulnerability."),
|
ver0=_("Revealers starting with 0 are not secure due to a vulnerability."),
|
||||||
url=_("More info at: {}").format(f'<a href="{link}">{link}</a>'),
|
url=_("More info at: {}").format(f'<a href="{link}">{link}</a>'),
|
||||||
risk=_("Proceed at your own risk.")))
|
risk=_("Proceed at your own risk.")),
|
||||||
|
rich_text=True)
|
||||||
|
|
||||||
def cypherseed_dialog(self, window):
|
def cypherseed_dialog(self, window):
|
||||||
self.warn_old_revealer()
|
self.warn_old_revealer()
|
||||||
|
|
Loading…
Add table
Reference in a new issue