mitk.mxn.layout.LayoutWindow#

class mitk.mxn.layout.LayoutWindow(id, view_direction, name=None, size=1)#

Bases: object

A leaf render-window. Routing identity (id) is required and schema-pattern checked; name is an optional free-form display label and is omitted from JSON when None.

Direct dataclass init is the private form: it sorts _links to keep equality order-insensitive but does not re-run regex / length / link checks. Always go through create() for input from user-controlled sources.

Parameters:
__init__(id, view_direction, name=None, size=1)#
Parameters:
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

links

Fresh dict {dimension: link_value}.

name

selection

Group name linked on LinkDimension.SELECTION.

size

id

view_direction

__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 match WINDOW_ID_PATTERN (qualified form).

  • view_direction (ViewDirection | str) – ViewDirection enum or matching string.

  • name (str | None) – Optional human-readable display label. Omitted from JSON when None. Tools should pass None unless authoring for humans.

  • selection (str | Link | Group | None) – Common-case shorthand for the only v2 link dimension. Pass any LinkLike (group name string, Link, or Group).

  • links (Mapping[LinkDimension | str, str | Link | Group] | None) – Power-user form for setting multiple link dimensions at once. Values share the LinkLike accept-set. Passing both selection and links raises ValueError.

  • size (int) – Splitter weight; only ratios matter. Defaults to 1.

Return type:

LayoutWindow

id: str#
linked_to(group, *, dim=LinkDimension.SELECTION)#

Whether this window is linked to the given group on the given dimension.

Return type:

bool

Parameters:

Fresh dict {dimension: link_value}. Mutations to the returned dict do not affect the window. Under v2 every value is str; v3 may surface Link for modifier-bearing dimensions.

name: str | None = None#
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 KeyError if a malformed window somehow lacks the selection link (should be impossible for objects produced via create()).

size: int = 1#
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:

LayoutWindow

Parameters:

new_id (str)

Return a copy with the given dimension linked to the given group.

Return type:

LayoutWindow

Parameters:
with_name(new_name)#

Return a copy with a new display name (None to clear it).

Free of the caveats on with_id()name is pure metadata.

Return type:

LayoutWindow

Parameters:

new_name (str | None)