electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 5dc240d4ed39796bec72ac115d920160865b3ec5
parent 5248613e9d7b8b8ec85a1cee897d1901d747f5b4
Author: SomberNight <somber.night@protonmail.com>
Date:   Fri, 21 Dec 2018 20:46:47 +0100

qt: show_message and friends display plaintext by default

Diffstat:
Melectrum/gui/qt/main_window.py | 2+-
Melectrum/gui/qt/util.py | 25+++++++++++++++----------
Melectrum/plugins/revealer/qt.py | 12++++++++----
3 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py @@ -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."), _("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): if self.tx_notification_queue.qsize() == 0: diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py @@ -190,24 +190,24 @@ class MessageBoxMixin(object): parent, title or '', 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, - 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, - _('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, - 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, - title or _('Information'), msg) + title or _('Information'), msg, **kwargs) 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() if type(icon) is QPixmap: 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.setWindowModality(Qt.WindowModal) 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_() class WindowModalDialog(QDialog, MessageBoxMixin): diff --git a/electrum/plugins/revealer/qt.py b/electrum/plugins/revealer/qt.py @@ -170,19 +170,22 @@ class Plugin(RevealerPlugin): 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), "<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() def ext_warning(self, dialog): 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() def bdone(self, dialog): version = self.versioned_seed.version code_id = self.versioned_seed.checksum 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): @@ -208,7 +211,8 @@ class Plugin(RevealerPlugin): .format(warning=_("Warning"), ver0=_("Revealers starting with 0 are not secure due to a vulnerability."), 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): self.warn_old_revealer()