diff --git a/electrum/plugins/bitbox02/qt.py b/electrum/plugins/bitbox02/qt.py index e812204b1..50454b117 100644 --- a/electrum/plugins/bitbox02/qt.py +++ b/electrum/plugins/bitbox02/qt.py @@ -66,20 +66,11 @@ class Plugin(BitBox02Plugin, QtPluginBase): class BitBox02_Handler(QtHandlerBase): + MESSAGE_DIALOG_TITLE = _("BitBox02 Status") def __init__(self, win): super(BitBox02_Handler, self).__init__(win, "BitBox02") - def message_dialog(self, msg): - self.clear_dialog() - self.dialog = dialog = WindowModalDialog( - self.top_level_window(), _("BitBox02 Status") - ) - l = QLabel(msg) - vbox = QVBoxLayout(dialog) - vbox.addWidget(l) - dialog.show() - def name_multisig_account(self): return QMetaObject.invokeMethod( self, diff --git a/electrum/plugins/coldcard/qt.py b/electrum/plugins/coldcard/qt.py index dccaf2c55..f94a970fe 100644 --- a/electrum/plugins/coldcard/qt.py +++ b/electrum/plugins/coldcard/qt.py @@ -84,18 +84,11 @@ class Plugin(ColdcardPlugin, QtPluginBase): class Coldcard_Handler(QtHandlerBase): + MESSAGE_DIALOG_TITLE = _("Coldcard Status") def __init__(self, win): super(Coldcard_Handler, self).__init__(win, 'Coldcard') - def message_dialog(self, msg): - self.clear_dialog() - self.dialog = dialog = WindowModalDialog(self.top_level_window(), _("Coldcard Status")) - l = QLabel(msg) - vbox = QVBoxLayout(dialog) - vbox.addWidget(l) - dialog.show() - class CKCCSettingsDialog(WindowModalDialog): diff --git a/electrum/plugins/hw_wallet/qt.py b/electrum/plugins/hw_wallet/qt.py index cefc35616..022fd324c 100644 --- a/electrum/plugins/hw_wallet/qt.py +++ b/electrum/plugins/hw_wallet/qt.py @@ -28,7 +28,7 @@ import threading from functools import partial from typing import TYPE_CHECKING, Union, Optional, Callable, Any -from PyQt5.QtCore import QObject, pyqtSignal +from PyQt5.QtCore import QObject, pyqtSignal, Qt from PyQt5.QtWidgets import QVBoxLayout, QLineEdit, QHBoxLayout, QLabel from electrum.gui.qt.password_dialog import PasswordLayout, PW_PASSPHRASE @@ -167,14 +167,17 @@ class QtHandlerBase(HardwareHandlerBase, QObject, Logger): self.word = text.text() self.done.set() - def message_dialog(self, msg, on_cancel): - # Called more than once during signing, to confirm output and fee + MESSAGE_DIALOG_TITLE = None # type: Optional[str] + def message_dialog(self, msg, on_cancel=None): self.clear_dialog() - title = _('Please check your {} device').format(self.device) + title = self.MESSAGE_DIALOG_TITLE + if title is None: + title = _('Please check your {} device').format(self.device) self.dialog = dialog = WindowModalDialog(self.top_level_window(), title) - l = QLabel(msg) + label = QLabel(msg) + label.setTextInteractionFlags(Qt.TextSelectableByMouse) vbox = QVBoxLayout(dialog) - vbox.addWidget(l) + vbox.addWidget(label) if on_cancel: dialog.rejected.connect(on_cancel) vbox.addLayout(Buttons(CancelButton(dialog))) diff --git a/electrum/plugins/jade/qt.py b/electrum/plugins/jade/qt.py index b934ce1d4..ee135f62d 100644 --- a/electrum/plugins/jade/qt.py +++ b/electrum/plugins/jade/qt.py @@ -35,13 +35,7 @@ class Jade_Handler(QtHandlerBase): setup_signal = pyqtSignal() auth_signal = pyqtSignal(object, object) + MESSAGE_DIALOG_TITLE = _("Jade Status") + def __init__(self, win): super(Jade_Handler, self).__init__(win, 'Jade') - - def message_dialog(self, msg): - self.clear_dialog() - self.dialog = dialog = WindowModalDialog(self.top_level_window(), _("Jade Status")) - l = QLabel(msg) - vbox = QVBoxLayout(dialog) - vbox.addWidget(l) - dialog.show() diff --git a/electrum/plugins/ledger/qt.py b/electrum/plugins/ledger/qt.py index 3ce0bb8f0..a79c1e495 100644 --- a/electrum/plugins/ledger/qt.py +++ b/electrum/plugins/ledger/qt.py @@ -35,6 +35,8 @@ class Ledger_Handler(QtHandlerBase): setup_signal = pyqtSignal() auth_signal = pyqtSignal(object, object) + MESSAGE_DIALOG_TITLE = _("Ledger Status") + def __init__(self, win): super(Ledger_Handler, self).__init__(win, 'Ledger') self.setup_signal.connect(self.setup_dialog) @@ -48,14 +50,6 @@ class Ledger_Handler(QtHandlerBase): self.word = str(response[0]) self.done.set() - def message_dialog(self, msg): - self.clear_dialog() - self.dialog = dialog = WindowModalDialog(self.top_level_window(), _("Ledger Status")) - l = QLabel(msg) - vbox = QVBoxLayout(dialog) - vbox.addWidget(l) - dialog.show() - def auth_dialog(self, data, client: 'Ledger_Client'): try: from .auth2fa import LedgerAuthDialog