asn1editor.controller package¶
Submodules¶
asn1editor.controller.ChoiceInstanceFactory module¶
- class asn1editor.controller.ChoiceInstanceFactory.ChoiceInstanceFactory(view_factory: AbstractViewFactory, type_augmenter: TypeAugmenter | None, choice_view: ChoiceView, members: Dict[str, Type], checkers: Dict[str, Type])¶
Bases:
objectChanges the element selected by a choice.
This class stores the connection between views and controllers after initialization of the GUI to be able to create the choice element on demand.
- create(member: str, parent: Controller)¶
asn1editor.controller.Controller module¶
- class asn1editor.controller.Controller.BitstringController(name: str, parent: Controller | None, bitstring_interface: BitstringInterface, optional_interface: OptionalInterface | None, number_of_bits: int)¶
Bases:
Controller- add_controller(name: str, other: Controller)¶
Adds a controller with a given name. This is used when an element supports dynamic instantiation of sub-elements (like lists or choices). The function is called by child controllers to tell their parents about their existence.
- model_to_view(model: Dict[str, Any])¶
Sets the values from the model to the views
- view_to_model() Tuple[bytes, int] | None¶
Gets the values from the view and puts them in a model
- class asn1editor.controller.Controller.BoolController(name: str, parent: Controller, value_interface: ValueInterface, optional_interface: OptionalInterface | None, default: bool)¶
Bases:
ControllerA bool controller manages a single boolean element.
- add_controller(name: str, other: Controller)¶
Adds a controller with a given name. This is used when an element supports dynamic instantiation of sub-elements (like lists or choices). The function is called by child controllers to tell their parents about their existence.
- model_to_view(model: Dict[str, Any] | Any)¶
Sets the values from the model to the views
- view_to_model() bool¶
Gets the values from the view and puts them in a model
- class asn1editor.controller.Controller.ChoiceController(name: str, parent: Controller, value_interface: ValueInterface, optional_interface: OptionalInterface | None, choice_instance_factory, default: str)¶
Bases:
ControllerA choice may contain a selection of different sub-elements. The controller creates the
- add_controller(name: str, other: Controller)¶
Adds a controller with a given name. This is used when an element supports dynamic instantiation of sub-elements (like lists or choices). The function is called by child controllers to tell their parents about their existence.
- event_handler()¶
Handles an event that involves creation or removal of sub-controllers like changing the number of list elements or changing a choice.
Is called when the value of the element changes.
- model_to_view(model: Dict[str, Any])¶
Sets the values from the model to the views
- view_to_model() Tuple[str, Any] | None¶
Gets the values from the view and puts them in a model
- class asn1editor.controller.Controller.ContainerController(name: str, parent: Controller | None, optional_interface: OptionalInterface | None)¶
Bases:
Controller- add_controller(name: str, other: Controller)¶
Adds a controller with a given name. This is used when an element supports dynamic instantiation of sub-elements (like lists or choices). The function is called by child controllers to tell their parents about their existence.
- model_to_view(model: Dict[str, Any])¶
Sets the values from the model to the views
- view_to_model() Dict[str, Any] | None¶
Gets the values from the view and puts them in a model
- class asn1editor.controller.Controller.Controller(name: str, parent: Controller, optional_interface: OptionalInterface | None)¶
Bases:
objectThe controller serves to connect the GUI representation with the data model.
It manages the path of elements to be able to access elements by a dot separated name.
- add_controller(name: str, other: Controller)¶
Adds a controller with a given name. This is used when an element supports dynamic instantiation of sub-elements (like lists or choices). The function is called by child controllers to tell their parents about their existence.
- event_handler()¶
Handles an event that involves creation or removal of sub-controllers like changing the number of list elements or changing a choice.
Is called when the value of the element changes.
- get_path() str¶
- model_to_view(model: Dict[str, Any])¶
Sets the values from the model to the views
- optional_handler()¶
Handles the change of the optional status of an element.
- view_to_model() Dict[str, Any] | None¶
Gets the values from the view and puts them in a model
- class asn1editor.controller.Controller.ListController(name: str, parent: Controller, value_interface: ValueInterface, optional_interface: OptionalInterface | None, list_instance_factory, default: int)¶
Bases:
ControllerA list controller manages a list of elements with the same type. The number of elements may be dynamic and a factory is provided to create or destroy new instances of the list. This factory creates both the views and the controllers for a new element.
- add_controller(name: str, other: Controller)¶
Adds a controller with a given name. This is used when an element supports dynamic instantiation of sub-elements (like lists or choices). The function is called by child controllers to tell their parents about their existence.
- event_handler()¶
Handles an event that involves creation or removal of sub-controllers like changing the number of list elements or changing a choice.
Is called when the value of the element changes.
- model_to_view(model: List[Any] | Dict[str, Any])¶
Sets the values from the model to the views
- optional_handler()¶
Handles the change of the optional status of an element.
- view_to_model() List | None¶
Gets the values from the view and puts them in a model
- class asn1editor.controller.Controller.NullController(name: str, parent: Controller, optional_interface: OptionalInterface | None)¶
Bases:
Controller- add_controller(name: str, other: Controller)¶
Adds a controller with a given name. This is used when an element supports dynamic instantiation of sub-elements (like lists or choices). The function is called by child controllers to tell their parents about their existence.
- model_to_view(model: Dict[str, Any])¶
Sets the values from the model to the views
- view_to_model() Optional¶
Gets the values from the view and puts them in a model
- class asn1editor.controller.Controller.RootController(name: str)¶
Bases:
ContainerController- model_to_view(model: Dict[str, Any])¶
Sets the values from the model to the views
- view_to_model() Dict[str, Any] | None¶
Gets the values from the view and puts them in a model
- class asn1editor.controller.Controller.ValueController(name: str, parent: Controller, value_interface: ValueInterface, optional_interface: OptionalInterface | None, data_converter: Converter)¶
Bases:
ControllerController for plain value fields.
A value controller uses a data converter to perform the mapping between values provided from a view and those expected in the model.
- add_controller(name: str, other: Controller)¶
Adds a controller with a given name. This is used when an element supports dynamic instantiation of sub-elements (like lists or choices). The function is called by child controllers to tell their parents about their existence.
- model_to_view(model: Dict[str, Any] | Any)¶
Sets the values from the model to the views
- view_to_model() Any¶
Gets the values from the view and puts them in a model
asn1editor.controller.ControllerFactory module¶
- class asn1editor.controller.ControllerFactory.ControllerFactory(parent: <module 'asn1editor.controller.Controller' from '/home/docs/checkouts/readthedocs.org/user_builds/asn1editor/checkouts/latest/asn1editor/controller/Controller.py'>)¶
Bases:
objectCreates controllers for an ASN.1 type as children for a given controller.
- create_bitstring_controller(type_: Type, bitstring_interface: BitstringInterface, optional_interface: OptionalInterface | None)¶
- create_bool_controller(type_: Type, value_interface: ValueInterface, optional_interface: OptionalInterface | None)¶
- create_choice_controller(type_: Type, value_interface: ValueInterface, optional_interface: OptionalInterface | None, choice_instance_factory)¶
- create_container_controller(type_: Type, optional_interface: OptionalInterface | None) ContainerController¶
- create_list_controller(type_: Type, value_interface: ValueInterface, optional_interface: OptionalInterface | None, list_instance_factory, minimum_elements: int)¶
- create_null_controller(type_: Type)¶
- create_value_controller(type_: Type, value_interface: ValueInterface, optional_interface: OptionalInterface | None, minimum: str | int | float | None = 0)¶
asn1editor.controller.Converter module¶
- class asn1editor.controller.Converter.Any(minimum: int | float | None, default: str | bytes | int | float | date | time | None)¶
Bases:
Converter- default() Any¶
- static from_view(val: Any) Any¶
- static to_view(val: Any) Any¶
- class asn1editor.controller.Converter.ByteString(minimum: int | float | None, default: str | bytes | int | float | date | time | None)¶
Bases:
Converter- default() bytes¶
- static from_view(val: bytes) bytes¶
- static to_view(val: bytes) bytes¶
- class asn1editor.controller.Converter.Converter(minimum: int | float | None, default: str | bytes | int | float | date | time | None)¶
Bases:
objectConverts values from view to model and vice versa. GUI implementations usually work with strings, while the ASN.1 model requires numeric data types.
- static default() str | bytes | int | float¶
- static from_view(val: str | bytes) Any¶
- static to_view(val: Any) str | bytes¶
- class asn1editor.controller.Converter.Float(minimum: int | float | None, default: str | bytes | int | float | date | time | None)¶
Bases:
Converter- default() float¶
- static from_view(val: str) float¶
- static to_view(val: float) str¶
asn1editor.controller.ListInstanceFactory module¶
- class asn1editor.controller.ListInstanceFactory.ListInstanceFactory(view_factory: AbstractViewFactory, type_augmenter: TypeAugmenter | None, list_view: ListView, _type: Type, checker: Type)¶
Bases:
objectCreate or removes list instances.
This class stores the connection between views and controllers after initialization of the GUI to be able to create list elements on demand.
- create(instance: int, parent: Controller)¶
- destroy(instance: int)¶