Skip to content

Commit

Permalink
merge: Autodetect the entrypoint when loading models
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Jul 17, 2023
2 parents 252988e + 0ffa914 commit 59aea21
Show file tree
Hide file tree
Showing 33 changed files with 728 additions and 302 deletions.
10 changes: 5 additions & 5 deletions capellambse/aird/_box_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def generic_stacked_factory(seb: C.SemanticElementBuilder) -> C.StackingBox:
def class_factory(seb: C.SemanticElementBuilder) -> diagram.Box:
"""Create a Class.
Classes contain multiple `Property` sub-elements. These aren't
Classes contain multiple `Property` sub-elements. These aren't
actual boxes, but should instead be shown as part of the Class'
regular label text.
"""
Expand Down Expand Up @@ -230,7 +230,7 @@ def component_port_factory(seb: C.SemanticElementBuilder) -> diagram.Box:
def constraint_factory(seb: C.SemanticElementBuilder) -> diagram.Box:
"""Create the box for a Constraint.
Constraints are comprised of two parts: A Box and some Edges. The
Constraints are comprised of two parts: A Box and some Edges. The
Box' label must be extracted from the semantic object, because it
isn't always easily accessible for the ``generic_factory``.
Expand Down Expand Up @@ -373,7 +373,7 @@ def statemode_factory(seb: C.SemanticElementBuilder) -> diagram.Box:
"""Create a State or Mode.
Unlike other elements, these have their immediate children rendered
as stacked boxes. The child boxes themselves can in turn have more
as stacked boxes. The child boxes themselves can in turn have more
children either in floating or stacked form.
Additionally, States and Modes can have associated activities. These
Expand Down Expand Up @@ -442,8 +442,8 @@ def fcif_factory(seb: C.SemanticElementBuilder) -> diagram.Box:
"""Create a FunctionalChainInvolvementFunction.
These are special boxes that point to another element via their
``involved`` attribute. As there's no relevant information stored
in the original target attribute, we can simply use the "involved"
``involved`` attribute. As there's no relevant information stored in
the original target attribute, we can simply use the "involved"
element for constructing the actual box.
"""
seb.melodyobjs[0] = seb.melodyloader.follow_link(
Expand Down
2 changes: 1 addition & 1 deletion capellambse/aird/_edge_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def sequence_link_factory(seb: C.SemanticElementBuilder) -> diagram.Edge:
"""Create a SequenceLink.
Sequence links (in Operational Process Diagrams) use the guard
condition as label, if it is set. Otherwise the label stays empty.
condition as label, if it is set. Otherwise the label stays empty.
"""
edge = generic_factory(seb)
guard = _guard_condition(seb, "condition")
Expand Down
10 changes: 5 additions & 5 deletions capellambse/aird/_filters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def composite_filter(
) -> cabc.Callable[[CompositeFilter], CompositeFilter]:
"""Register a composite filter.
Composite filters are executed in two phases. The first phase
occurs during each diagram element's creation. Here the callables
Composite filters are executed in two phases. The first phase occurs
during each diagram element's creation. Here the callables
registered with this decorator are directly executed with the
diagram under construction and the to-be-filtered element as
arguments.
Expand All @@ -54,7 +54,7 @@ def composite_filter(
callable object during the first phase; this object will then be
called with the same (now constructed) diagram and the element.
Composite filters should always operate in place. They may append
Composite filters should always operate in place. They may append
additional elements to the diagram, but they should never remove
any; instead they should simply change their "hidden" flag to True.
"""
Expand Down Expand Up @@ -112,7 +112,7 @@ def setfilters(
Returns
-------
dgobject
The modified ``dgobject``. This is done for convenience; the
The modified ``dgobject``. This is done for convenience; the
object is modified in place.
See Also
Expand Down Expand Up @@ -153,7 +153,7 @@ def applyfilters(args: FilterArguments) -> None:
Firstly it executes phase 2 of all elements' composite filters; see
:func:`composite_filter` for more details.
Secondly it applies the diagram's global filters. These are always
Secondly it applies the diagram's global filters. These are always
applied after all composite filters have run.
"""
# Apply post-processing filters on elements
Expand Down
4 changes: 2 additions & 2 deletions capellambse/aird/_filters/composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def hide_empty_ports(
"""Hide child ports without context.
This filter utilizes the fact that boxes track all connected edges
as their "context". As ports do not have children, their context
can only be the edge(s) that connect directly to them.
as their "context". As ports do not have children, their context can
only be the edge(s) that connect directly to them.
"""
del ebd
assert isinstance(dgobject, diagram.Box)
Expand Down
2 changes: 1 addition & 1 deletion capellambse/aird/_semantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""Parser entry point for semantic elements.
Semantic elements have a ``<target>`` which references the represented
object in the ``.melodymodeller`` or ``.melodyfragment`` file. The
object in the ``.melodymodeller`` or ``.melodyfragment`` file. The
melody file is the source of truth for all attributes that are not
specific to a single diagram, i.e. basically everything except position,
size and styling.
Expand Down
4 changes: 2 additions & 2 deletions capellambse/aird/_visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""Parser entry point for visual elements.
Visual elements, contrary to semantic ones, do not exist in the melody
files at all. They are used for things such as Notes and inter-diagram
files at all. They are used for things such as Notes and inter-diagram
hyperlinks.
"""
from __future__ import annotations
Expand Down Expand Up @@ -118,7 +118,7 @@ def shape_factory(ebd: c.ElementBuilder) -> diagram.Box:
] = {
"BasicDecorationNode": c.SkipObject.raise_,
"Connector": connector_factory,
# Nodes are actually semantic elements. If one got through to here,
# Nodes are actually semantic elements. If one got through to here,
# it's an internal node, not an element root.
"Node": c.SkipObject.raise_,
"Shape": shape_factory,
Expand Down
16 changes: 8 additions & 8 deletions capellambse/diagram/_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(
pos
A Vector2D describing the spatial position.
size
A Vector2D describing the box' size. If one or both of its
A Vector2D describing the box' size. If one or both of its
components are 0, it/they will be calculated based on the
Box' label text and contained children.
label
Expand All @@ -92,19 +92,19 @@ def __init__(
parent
This box' parent box.
collapsed
Collapse this box and hide all its children. Note that
Collapse this box and hide all its children. Note that
setting this flag does not change the box' size.
minsize
When dynamically calculating Box size, the minimum size it
should have. Default: zero.
should have. Default: zero.
maxsize
When dynamically calculating Box size, the maximum size it
can have. Default: inifite.
can have. Default: infinite.
context
A list of UUIDs of objects in this box' context. This
A list of UUIDs of objects in this box' context. This
includes children and associated edges.
port
Flag this box as a port. Affects how context is added.
Flag this box as a port. Affects how context is added.
features
Certain classes of Box (like ``Class``) have features, which
is a list of strings that will be displayed inside the Box,
Expand Down Expand Up @@ -359,7 +359,7 @@ def move(self, offset: diagram.Vector2D, *, children: bool = True) -> None:
offset
The offset to move the box by.
children
Recursively move children as well. If False, the positions
Recursively move children as well. If False, the positions
of children need to be adjusted separately.
"""
self.pos += offset
Expand Down Expand Up @@ -533,7 +533,7 @@ class Edge(diagram.Vec2List):
"""An edge in the diagram.
An Edge consists of a series of points that are traversed in order.
Each point is given as Vector2D containing absolute coordinates. At
Each point is given as Vector2D containing absolute coordinates. At
least two points are required.
"""

Expand Down
12 changes: 6 additions & 6 deletions capellambse/diagram/capstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class RGB(t.NamedTuple):
"""A color.
Each color component (red, green, blue) is an integer in the range
of 0..255 (inclusive). The alpha channel is a float between 0.0 and
1.0 (inclusive). If it is 1, then the ``str()`` form does not
of 0..255 (inclusive). The alpha channel is a float between 0.0 and
1.0 (inclusive). If it is 1, then the ``str()`` form does not
include transparency information.
"""

Expand Down Expand Up @@ -80,7 +80,7 @@ def fromcsv(cls, csvstring: str) -> RGB:
def fromhex(cls, hexstring: str) -> RGB:
"""Create an RGB from a hexadecimal string.
The string can have 3, 4, 6 or 8 hexadecimal characters. In the
The string can have 3, 4, 6 or 8 hexadecimal characters. In the
cases of 3 and 6 characters, the alpha channel is set to 1.0
(fully opaque) and the remaining characters are interpreted as
the red, green and blue components.
Expand Down Expand Up @@ -138,7 +138,7 @@ class in the form::
Type.StyleClass
The type can be: ``Box``, ``Edge``. The style class can be any
The type can be: ``Box``, ``Edge``. The style class can be any
known style class.
"""
if "symbol" in objectclass.lower():
Expand Down Expand Up @@ -241,11 +241,11 @@ class in the form::
#: This dict contains the default styles that Capella applies, grouped
#: by the diagram class they belong to.
#:
#: The first level of keys are the diagrams' styleclasses. The special
#: The first level of keys are the diagrams' styleclasses. The special
#: key "__GLOBAL__" applies to all diagrams.
#:
#: The second level contains the style definitions for each element that
#: can appear in the diagram. The keys work in the following way:
#: can appear in the diagram. The keys work in the following way:
#:
#: Type.Class
#:
Expand Down
Loading

0 comments on commit 59aea21

Please sign in to comment.