diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py index eba59166f..f24fa57a9 100644 --- a/electrum/gui/qt/util.py +++ b/electrum/gui/qt/util.py @@ -1,3 +1,4 @@ +from abc import ABC, ABCMeta import os.path import time import sys @@ -1430,6 +1431,12 @@ def qt_event_listener(func): return decorator +class _ABCQObjectMeta(type(QObject), ABCMeta): pass +class _ABCQWidgetMeta(type(QWidget), ABCMeta): pass +class AbstractQObject(QObject, ABC, metaclass=_ABCQObjectMeta): pass +class AbstractQWidget(QWidget, ABC, metaclass=_ABCQWidgetMeta): pass + + if __name__ == "__main__": app = QApplication([]) t = WaitingDialog(None, 'testing ...', lambda: [time.sleep(1)], lambda x: QMessageBox.information(None, 'done', "done")) diff --git a/electrum/gui/qt/wizard/wizard.py b/electrum/gui/qt/wizard/wizard.py index 791bceadf..424b5c7ff 100644 --- a/electrum/gui/qt/wizard/wizard.py +++ b/electrum/gui/qt/wizard/wizard.py @@ -10,7 +10,7 @@ from PyQt5.QtWidgets import (QDialog, QPushButton, QWidget, QLabel, QVBoxLayout, from electrum.i18n import _ from electrum.logging import get_logger -from electrum.gui.qt.util import Buttons, icon_path, MessageBoxMixin, WWLabel, ResizableStackedWidget +from electrum.gui.qt.util import Buttons, icon_path, MessageBoxMixin, WWLabel, ResizableStackedWidget, AbstractQWidget if TYPE_CHECKING: from electrum.simple_config import SimpleConfig @@ -233,7 +233,7 @@ class QEAbstractWizard(QDialog, MessageBoxMixin): return True -class WizardComponent(QWidget): +class WizardComponent(AbstractQWidget): updated = pyqtSignal(object) def __init__(self, parent: QWidget, wizard: QEAbstractWizard, *, title: str = None, layout: QLayout = None):