Skip to content

Commit

Permalink
merge: Add styling for primitive Classes (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Feb 15, 2024
2 parents dcafcb8 + 097891e commit 2dbc1dc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions capellambse/diagram/_styleclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,16 @@ def _property(obj: model.ModelObject) -> str:
return obj.kind.name.capitalize()


def _class(obj: model.ModelObject) -> str:
assert isinstance(obj, model.information.Class)
return "Primitive" * obj.is_primitive + "Class"


_STYLECLASSES: dict[str, cabc.Callable[[model.ModelObject], str]] = {
"Association": _association,
"CapellaIncomingRelation": lambda _: "RequirementRelation",
"CapellaOutgoingRelation": lambda _: "RequirementRelation",
"Class": _class,
"ComponentPort": _component_port,
"ControlNode": _control_node,
"FunctionalChainInvolvementFunction": _functional_chain_involvement,
Expand Down
5 changes: 5 additions & 0 deletions capellambse/diagram/capstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@ class in the form::
"stroke": COLORS["_CAP_Class_Border_Brown"],
"text_fill": COLORS["black"],
},
"Box.PrimitiveClass": {
"fill": COLORS["_CAP_Class_Brown"],
"stroke": COLORS["_CAP_Datatype_Border_Gray"],
"text_fill": COLORS["black"],
},
"Box.DataPkg": { # DT_DataPkg
"fill": [
COLORS["white"],
Expand Down
1 change: 1 addition & 0 deletions capellambse/svg/decorations.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
needs_feature_line = {
"BooleanType",
"Class",
"PrimitiveClass",
"Enumeration",
"NumericType",
"PhysicalQuantity",
Expand Down

0 comments on commit 2dbc1dc

Please sign in to comment.