yasmin_editor.model.layout module
Container layout model.
- class yasmin_editor.model.layout.Layout(state_positions: dict[str, ~yasmin_editor.model.layout.Position] = <factory>, outcome_positions: dict[str, ~yasmin_editor.model.layout.Position] = <factory>, outcome_placements: dict[str, ~yasmin_editor.model.layout.OutcomePlacement] = <factory>)
Bases:
objectStores positions for child states and final outcomes inside a container.
- create_outcome_alias(name: str, x: float, y: float) str
Create a new visual alias for an existing logical outcome.
- ensure_outcome_placement(outcome_name: str, x: float, y: float, instance_id: str | None = None) str
Create or update one visual placement for a logical outcome.
- get_outcome_placement(instance_id: str) OutcomePlacement | None
Return one outcome placement by its instance identifier.
- get_outcome_placements(outcome_name: str | None = None) list[OutcomePlacement]
Return all stored outcome placements, optionally filtered by outcome name.
- get_outcome_position(name: str) Position | None
Return the primary position of a logical final outcome if present.
- materialize_primary_outcome_position(name: str) str | None
Convert one legacy primary position into an explicit alias instance.
This is useful when a layout initially loaded one legacy outcome placement without an
instance_idand later needs more than one visual alias for the same logical outcome.
- outcome_placements: dict[str, OutcomePlacement]
- remove_outcome_placement(instance_id: str) None
Remove one visual placement of a final outcome.
- remove_outcome_position(name: str) None
Remove all stored placements of a logical final outcome.
- remove_state_position(name: str) None
Remove the stored position of a child state.
- rename_outcome_position(old_name: str, new_name: str) None
Rename the stored placements of a logical final outcome.
- rename_state_position(old_name: str, new_name: str) None
Rename the stored position of a child state.
- set_outcome_position(name: str, x: float, y: float, instance_id: str | None = None) str
Update one stored final-outcome placement.
Without an
instance_idthis updates the primary visible alias. Usecreate_outcome_alias()when a new visual alias should be created.
- set_primary_outcome_position(name: str, x: float, y: float) None
Store the primary legacy outcome position without creating an alias.
Legacy XML can describe one final outcome position without an explicit
instance_id. The editor still supports that representation for stable roundtrips, so callers that intentionally want a non-alias primary placement should use this method instead ofset_outcome_position().
- set_state_position(name: str, x: float, y: float) None
Set the position of a child state.