Skip to content

Commit

Permalink
merge: Add missing attributes and default styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Nov 1, 2023
2 parents a3dfe6b + 27560e6 commit d62d953
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
2 changes: 2 additions & 0 deletions capellambse/diagram/_styleclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def get_styleclass(obj: model.ModelObject) -> str:


def _default(obj: model.ModelObject) -> str:
if isinstance(obj, model.GenericElement):
return obj.xtype.split(":")[-1]
return type(obj).__name__


Expand Down
20 changes: 20 additions & 0 deletions capellambse/diagram/capstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,26 @@ class in the form::
"stroke": COLORS["_CAP_Datatype_Border_Gray"],
"text_fill": COLORS["black"],
},
"Box.BooleanType": {
"fill": COLORS["_CAP_Class_Brown"],
"stroke": COLORS["_CAP_Datatype_Border_Gray"],
"text_fill": COLORS["black"],
},
"Box.NumericType": {
"fill": COLORS["_CAP_Class_Brown"],
"stroke": COLORS["_CAP_Datatype_Border_Gray"],
"text_fill": COLORS["black"],
},
"Box.PhysicalQuantity": {
"fill": COLORS["_CAP_Class_Brown"],
"stroke": COLORS["_CAP_Datatype_Border_Gray"],
"text_fill": COLORS["black"],
},
"Box.StringType": {
"fill": COLORS["_CAP_Class_Brown"],
"stroke": COLORS["_CAP_Datatype_Border_Gray"],
"text_fill": COLORS["black"],
},
"Box.ExchangeItem": { # DT_ExchangeItem
"fill": COLORS["_CAP_ExchangeItem_Pinkkish"],
"stroke": COLORS["_CAP_Interface_Border_Reddish"],
Expand Down
2 changes: 2 additions & 0 deletions capellambse/model/crosslayer/capellacore.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class Generalization(c.GenericElement):

_xmltag = "ownedGeneralizations"

super: c.Accessor


@c.xtype_handler(None)
class EnumerationPropertyLiteral(c.GenericElement):
Expand Down
6 changes: 6 additions & 0 deletions capellambse/model/crosslayer/information/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ class Class(c.GenericElement):
capellacommon.StateMachine, aslist=c.ElementList
)
owned_properties = c.DirectProxyAccessor(Property, aslist=c.ElementList)
generalizations = c.DirectProxyAccessor(
capellacore.Generalization, aslist=c.ElementList
)

@property
def properties(self) -> c.ElementList[Property]:
Expand Down Expand Up @@ -207,6 +210,9 @@ class ExchangeItem(c.GenericElement):
exchanges: c.Accessor[c.GenericElement]


c.set_accessor(
capellacore.Generalization, "super", c.AttrProxyAccessor(None, "super")
)
for cls in [Class, Union, datatype.Enumeration, Collection]:
c.set_accessor(
cls,
Expand Down
9 changes: 7 additions & 2 deletions capellambse/svg/decorations.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@
DiagramClass = str
FaultyClass = str
PatchClass = str
always_top_label = {
needs_feature_line = {
"BooleanType",
"Class",
"Enumeration",
"NumericType",
"PhysicalQuantity",
"StringType",
}
always_top_label = needs_feature_line | {
"Note",
"RepresentationLink",
"OperationalActivity",
"PhysicalComponent",
}
needs_feature_line = {"Class", "Enumeration"}


class DecoFactories(t.Dict[str, cabc.Callable]):
Expand Down

0 comments on commit d62d953

Please sign in to comment.