qt wizard: WizardComponent: (fix) also inherit ABC
for `@abstractmethod` decorator to work (except, turns out, it's not so simple because of pyqt's own magic for QWidget)
This commit is contained in:
@@ -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"))
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user