M1-Survey-Engine/source/survey/base/BaseSurvey.py
2023-12-21 16:46:53 +01:00

38 lines
895 B
Python

from abc import abstractmethod
from typing import Optional, Any
from PyQt6.QtCore import pyqtSignal
from PyQt6.QtWidgets import QFrame
class BaseSurvey(QFrame):
"""
A type of survey survey that can be in the user interface
"""
@classmethod
@abstractmethod
def from_dict(cls, data: dict[str, Any], signals: dict[str, pyqtSignal]) -> "BaseSurvey":
"""
Create an instance from a configuration dictionary
:return: the instance
"""
def on_show(self) -> None:
"""
Called when the survey is shown
"""
def on_hide(self) -> None:
"""
Called when the survey is hidden
:return:
"""
def get_collected_data(self) -> Optional[dict]:
"""
Return the data collected for the survey
:return: the data collected for the survey
"""
return None