pySimBlocks.gui.models.project_state¶
- class pySimBlocks.gui.models.project_state.ProjectState(directory_path: Path)[source]¶
Bases:
objectStore the editable state of a GUI project.
- blocks¶
Block instances currently present in the project.
- connections¶
Connections currently present in the project.
- simulation¶
Simulation parameter set for the project.
- external¶
Optional external runtime path or identifier.
- directory_path¶
Project directory on disk.
- logging¶
Signals selected for logging.
- logs¶
Last simulation logs.
- plots¶
Plot configurations defined for the project.
- load_simulation(sim_data: dict, external=None)[source]¶
Load simulation settings into the project state.
- Parameters:
sim_data – Serialized simulation settings.
external – Optional external runtime value.
- get_block(name: str)[source]¶
Return the block with the given name if it exists.
- Parameters:
name – Block instance name.
- Returns:
Matching block instance, or None if not found.
- add_block(block_instance: BlockInstance)[source]¶
Add a block instance to the project.
- Parameters:
block_instance – Block instance to add.
- remove_block(block_instance: BlockInstance)[source]¶
Remove a block instance from the project if present.
- Parameters:
block_instance – Block instance to remove.
- add_connection(conn: ConnectionInstance)[source]¶
Add a connection instance to the project.
- Parameters:
conn – Connection instance to add.
- remove_connection(conn: ConnectionInstance)[source]¶
Remove a connection instance from the project if present.
- Parameters:
conn – Connection instance to remove.
- get_connections_of_block(block_instance: BlockInstance) list[ConnectionInstance][source]¶
Return all connections touching the given block.
- Parameters:
block_instance – Block instance to inspect.
- Returns:
Connections where the block is either source or destination.
- get_connections_of_port(port_instance: PortInstance) list[ConnectionInstance][source]¶
Return all connections attached to the given port.
- Parameters:
port_instance – Port instance to inspect.
- Returns:
Connections where the port is either source or destination.