Skip to content

Commit

Permalink
fix(model): Handle ControlNodes without kind in _get_icon()
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Sep 10, 2024
1 parent ca344c0 commit 01b05cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion capellambse/diagram/_styleclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,19 @@ def _port_allocation(obj: model.ModelObject) -> str:
return f"{'_'.join(sorted(styleclasses))}Allocation"


def _control_node(obj: model.ModelObject) -> str:
assert isinstance(obj, model.fa.ControlNode)
if obj.kind is None:
return _default(obj)
return obj.kind.name.capitalize() + _default(obj)


_STYLECLASSES: dict[str, cabc.Callable[..., str]] = {
"Association": _association,
"CapellaIncomingRelation": lambda _: "RequirementRelation",
"CapellaOutgoingRelation": lambda _: "RequirementRelation",
"Class": lambda o: "Primitive" * o.is_primitive + "Class",
"ComponentPort": lambda o: f"CP_{o.direction or 'UNSET'}",
"ControlNode": lambda o: o.kind.name.capitalize() + _default(o),
"Entity": lambda o: (
("Entity", "OperationalActor")[o.is_actor and o.is_human]
),
Expand Down

0 comments on commit 01b05cb

Please sign in to comment.