mitk.mxn.layout.LayoutWindow#
- class mitk.mxn.layout.LayoutWindow(id, view_direction, name=None, size=1)#
Bases:
objectA leaf render-window. Routing identity (
id) is required and schema-pattern checked;nameis an optional free-form display label and is omitted from JSON whenNone.Direct dataclass init is the private form: it sorts
_linksto keep equality order-insensitive but does not re-run regex / length / link checks. Always go throughcreate()for input from user-controlled sources.- Parameters:
id (str)
view_direction (ViewDirection)
name (str | None)
size (int)
- __init__(id, view_direction, name=None, size=1)#
- Parameters:
id (str)
view_direction (ViewDirection)
name (str | None)
size (int)
- Return type:
None
Methods
__init__(id, view_direction[, name, size])create(id, view_direction, *[, name, ...])Primary, validating constructor.
linked_to(group, *[, dim])Whether this window is linked to the given group on the given dimension.
with_id(new_id)Return a copy with a new id.
with_link(dimension, link)Return a copy with the given dimension linked to the given group.
with_name(new_name)Return a copy with a new display name (None to clear it).
Attributes
Fresh dict
{dimension: link_value}.Group name linked on
LinkDimension.SELECTION.- __eq__(other)#
Return self==value.
- classmethod create(id, view_direction, *, name=None, selection=None, links=None, size=1)#
Primary, validating constructor.
- Parameters:
id (
str) – Routing identity. Must matchWINDOW_ID_PATTERN(qualified form).view_direction (
ViewDirection|str) –ViewDirectionenum or matching string.name (
str|None) – Optional human-readable display label. Omitted from JSON whenNone. Tools should passNoneunless authoring for humans.selection (
str|Link|Group|None) – Common-case shorthand for the only v2 link dimension. Pass anyLinkLike(group name string,Link, orGroup).links (
Mapping[LinkDimension|str,str|Link|Group] |None) – Power-user form for setting multiple link dimensions at once. Values share theLinkLikeaccept-set. Passing bothselectionandlinksraisesValueError.size (
int) – Splitter weight; only ratios matter. Defaults to 1.
- Return type:
- linked_to(group, *, dim=LinkDimension.SELECTION)#
Whether this window is linked to the given group on the given dimension.
- Return type:
- Parameters:
dim (LinkDimension | str)
- property links: dict[str, str | Link]#
Fresh dict
{dimension: link_value}. Mutations to the returned dict do not affect the window. Under v2 every value isstr; v3 may surfaceLinkfor modifier-bearing dimensions.
- property selection: str#
Group name linked on
LinkDimension.SELECTION.v2 has no modifiers on the selection dimension, so the return is always a bare string. Raises
KeyErrorif a malformed window somehow lacks the selection link (should be impossible for objects produced viacreate()).
- view_direction: ViewDirection#
- with_id(new_id)#
Return a copy with a new id.
WARNING: ids are routing identities; renaming an id that has already been served via REST or saved to a session breaks every cached reference (persisted session state, REST URL bookmarks, per-renderer DataNode property context keys). Safe on in-memory documents that have not yet been published.
- Return type:
- Parameters:
new_id (str)
- with_link(dimension, link)#
Return a copy with the given dimension linked to the given group.
- Return type:
- Parameters:
dimension (LinkDimension | str)