input
Classes:
|
Metaclass to parametrically spawn a Qt Input widget for a given type. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- class Input(args: Optional[list] = None, kwargs: Optional[dict] = None, range: Optional[Tuple[Union[int, float], Union[int, float]]] = None)[source]
Bases:
abc.ABC
Metaclass to parametrically spawn a Qt Input widget for a given type.
Primarily for the purpose of making a unified widget creation and value retreival syntax within the
ModelWidget
class- widget: ClassVar[Type[PySide2.QtWidgets.QWidget]] = None
The widget that is made with the
make()
method
- validator: ClassVar[Optional[Type[PySide2.QtGui.QValidator]]] = None
The validator applied to the input widget
- method_calls: ClassVar[Optional[List[Tuple[str, List]]]] = None
Names of methods to call after instantiation, passed as a tuple of (method_name, [method_args])
- python_type: ClassVar[Type]
The python type that this input provides interface for
- permissiveness: ClassVar[int] = 0
When a type is annotated with a Union, the more permissive (higher number) one will be chosen. Arbitrary units.
- args: Optional[list] = FieldInfo(default=PydanticUndefined, default_factory=<class 'list'>, extra={})
Args to pass to the widget on creation
- kwargs: Optional[dict] = FieldInfo(default=PydanticUndefined, default_factory=<class 'dict'>, extra={})
Kwargs to pass to the widget on creation
- range: Optional[Tuple[Union[int, float], Union[int, float]]] = None
Limit numerical types to a specific range
- classmethod from_type(type_: Type[bool]) Type[BoolInput] [source]
- classmethod from_type(type_: Type[int]) Type[IntInput]
- classmethod from_type(type_: Type[float]) Type[FloatInput]
- classmethod from_type(type_: Type[str]) Type[StrInput]
- classmethod from_type(type_: Type[datetime.datetime]) Type[DatetimeInput]
- classmethod from_type(type_: Type[list]) Type[ListInput]
- make(widget_kwargs: Optional[dict] = None, validator_kwargs: Optional[dict] = None) PySide2.QtWidgets.QWidget [source]
Make the appropriate widget for this input.
Stores the made widget in the private
_widget
attr, which is then used in subsequentvalue()
andsetValue()
calls.- Parameters
widget_kwargs (dict) – Optional: kwargs given to the widget on instantiation
validator_kwargs (dict) – Optional: kwargs given to the validator on instantiation
- Returns
Subclass of QWidget according to Input type
- Return type
PySide2.QtWidgets.QWidget
- class BoolInput(args: Optional[list] = None, kwargs: Optional[dict] = None, range: Optional[Tuple[Union[int, float], Union[int, float]]] = None)[source]
Bases:
autopilot.gui.widgets.input.Input
- widget
alias of
PySide2.QtWidgets.QCheckBox
- class IntInput(args: Optional[list] = None, kwargs: Optional[dict] = None, range: Optional[Tuple[Union[int, float], Union[int, float]]] = None)[source]
Bases:
autopilot.gui.widgets.input.Input
- widget
alias of
PySide2.QtWidgets.QLineEdit
- validator
alias of
PySide2.QtGui.QIntValidator
- class FloatInput(args: Optional[list] = None, kwargs: Optional[dict] = None, range: Optional[Tuple[Union[int, float], Union[int, float]]] = None)[source]
Bases:
autopilot.gui.widgets.input.Input
- widget
alias of
PySide2.QtWidgets.QLineEdit
- validator
alias of
PySide2.QtGui.QIntValidator
- class StrInput(args: Optional[list] = None, kwargs: Optional[dict] = None, range: Optional[Tuple[Union[int, float], Union[int, float]]] = None)[source]
Bases:
autopilot.gui.widgets.input.Input
- widget
alias of
PySide2.QtWidgets.QLineEdit
- class DatetimeInput(args: Optional[list] = None, kwargs: Optional[dict] = None, range: Optional[Tuple[Union[int, float], Union[int, float]]] = None)[source]
Bases:
autopilot.gui.widgets.input.Input
- widget
alias of
PySide2.QtWidgets.QDateTimeEdit
- method_calls: ClassVar[Optional[List[Tuple[str, List]]]] = [('setCalendarPopup', [True])]
Names of methods to call after instantiation, passed as a tuple of (method_name, [method_args])
- python_type
alias of
datetime.datetime
- setValue(value: datetime.datetime)[source]
Set a value in the created widget
- value() datetime.datetime [source]
Retreive the value from the widget!
- class ListInput(args: Optional[list] = None, kwargs: Optional[dict] = None, range: Optional[Tuple[Union[int, float], Union[int, float]]] = None)[source]
Bases:
autopilot.gui.widgets.input.Input
- widget
alias of
PySide2.QtWidgets.QLineEdit
- class DictInput(args: Optional[list] = None, kwargs: Optional[dict] = None, range: Optional[Tuple[Union[int, float], Union[int, float]]] = None)[source]
Bases:
autopilot.gui.widgets.input.Input
- widget
alias of
PySide2.QtWidgets.QLineEdit
- class LiteralInput(choices: list, default: Optional[Any] = None, **kwargs)[source]
Bases:
autopilot.gui.widgets.input.Input
- widget
alias of
PySide2.QtWidgets.QComboBox
- python_type(*args, **kwds): ClassVar[Type] = typing.Literal
The python type that this input provides interface for
- default: Optional[Any] = None
If one of the entries in the literal type should be default, set this on widget creation
- make(widget_kwargs: Optional[dict] = None, validator_kwargs: Optional[dict] = None) PySide2.QtWidgets.QComboBox [source]
Call the superclass make method, but then set the options for the combobox based on our
LiteralInput.args
attribute.- Parameters
widget_kwargs (dict) – Optional: kwargs given to the widget on instantiation
validator_kwargs (dict) – Optional: kwargs given to the validator on instantiation
- Returns
PySide2.QtWidgets.QComboBox