Component Base Classes¶
The classes in digsim.circuit.components.atoms that all components are built on. Every
component has the methods of Component, like name(), port() and inports().
Subclass them to write your own components.
Component
¶
Component(
circuit: Circuit,
name: str | None = None,
display_name: str | None = None,
)
Bases: ABC
The component base class
active
property
¶
active: bool
Return True if this component is active/activated ('on' for a switch for example)
add_port
¶
add_port(port: Port) -> None
Add port to component, also add a 'portname' variable to the component with help of the 'self.dict'
parameter_set
¶
parameter_set(
parameter: str, value: ParameterValue
) -> None
Set component parameter
update
¶
update() -> None
This function is called if a port change and that port should update its parent
settings_to_dict
¶
settings_to_dict() -> dict[str, ParameterValue]
Return component settings as a dict
CallbackComponent
¶
Parameters¶
Parameter
¶
Bases: TypedDict
The description of a component parameter, returned by get_parameters(). The GUI builds the settings dialog from it, see "The settings dialog" in the guide for adding components to the GUI.
ParameterType
module-attribute
¶
ParameterType = Literal[
"bool",
"component_name",
"ic_name",
"int",
"intrange",
"list",
"path",
"str",
"width_bool",
"width_pow2",
]
Exceptions¶
DigsimException
¶
Bases: Exception
The digsim exception base class
ComponentException
¶
Bases: DigsimException
Component error exception class