pySimBlocks.gui.models.port_instance

class pySimBlocks.gui.models.port_instance.PortInstance(name: str, display_as: str, direction: Literal['input', 'output'], block: BlockInstance)[source]

Bases: object

Represent a GUI port bound to a block instance.

name

Internal port name.

display_as

Label shown in the GUI.

direction

Port direction, either input or output.

block

Owning block instance.

is_compatible(other: PortInstance)[source]

Return whether this port can connect to another port.

Parameters:

other – Port to compare against.

Returns:

True if the ports have opposite directions.

can_accept_connection(connections: list[ConnectionInstance]) bool[source]

Return whether this port can accept one more connection.

Parameters:

connections – Existing connections currently attached to this port.

Returns:

True if the port can accept an additional connection.