syside.RelationshipBody

class RelationshipBody

Bases: syside.ContainerView[syside.Element]

Container for relationship bodies. Works similarly to ChildrenNodes except relationships are not needed and all elements are taken ownership off.

TODO: add insert and replace methods.

append(element: type[syside.TElement]) syside.TElement

Append an owned related element. Returns newly constructed related element.

append(element: syside.TElement) syside.TElement

Append an owned existing related element. Returns the same related element.

append_annotation(element: type[syside.RelationshipBody.append_annotation.M]) tuple[syside.Annotation, syside.RelationshipBody.append_annotation.M]

Append an owned annotation to an annotating element. Returns a pair of newly constructed (annotation, annotating element).

append_annotation(element: syside.RelationshipBody.append_annotation.M) tuple[syside.Annotation, syside.RelationshipBody.append_annotation.M]

Append an owned annotation to an existing annotating element. Returns a pair of (annotation, annotating element) where only the annotation is newly constructed.

pop(index: int = -1) syside.Element

Removes a related element at the specified index from the model tree and returns it.

remove_element(arg: syside.Element, /) bool

Removes a related element from the model tree. Returns True if the element was removed, otherwise False.

clear() None

Removes and releases all elements in this container. Afterwards, len is 0.