input

Classes:

Input([args, kwargs, range])

Metaclass to parametrically spawn a Qt Input widget for a given type.

BoolInput([args, kwargs, range])

IntInput([args, kwargs, range])

FloatInput([args, kwargs, range])

StrInput([args, kwargs, range])

DatetimeInput([args, kwargs, range])

ListInput([args, kwargs, range])

DictInput([args, kwargs, range])

LiteralInput(choices[, default])

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]
abstract setValue(value: Any)[source]

Set a value in the created widget

abstract value() Any[source]

Retreive the value from the widget!

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 subsequent value() and setValue() 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

python_type

alias of bool

setValue(value: bool)[source]

Set a value in the created widget

value() bool[source]

Retreive the value from the widget!

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

permissiveness: ClassVar[int] = 1

When a type is annotated with a Union, the more permissive (higher number) one will be chosen. Arbitrary units.

python_type

alias of int

setValue(value: int)[source]

Set a value in the created widget

value() int[source]

Retreive the value from the widget!

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

permissiveness: ClassVar[int] = (2,)

When a type is annotated with a Union, the more permissive (higher number) one will be chosen. Arbitrary units.

python_type

alias of float

setValue(value: float)[source]

Set a value in the created widget

value() float[source]

Retreive the value from the widget!

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

permissiveness: ClassVar[int] = 3

When a type is annotated with a Union, the more permissive (higher number) one will be chosen. Arbitrary units.

python_type

alias of str

setValue(value: str)[source]

Set a value in the created widget

value() str[source]

Retreive the value from the widget!

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

python_type

alias of list

setValue(value: list)[source]

Set a value in the created widget

value() list[source]

Retreive the value from the widget!

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

python_type

alias of dict

setValue(value: dict)[source]

Set a value in the created widget

value() dict[source]

Retreive the value from the widget!

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

choices: list

Args are not optional for literal input types

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

setValue(value: Any)[source]

Set a value in the created widget

value() Any[source]

Retreive the value from the widget!