wijjit.layout.engine.SizeConstraints

class wijjit.layout.engine.SizeConstraints(min_width, min_height, preferred_width=None, preferred_height=None, content_min_width=None, content_min_height=None)[source]

Size constraints for layout calculation.

Parameters:
  • min_width (int) – Minimum width required

  • min_height (int) – Minimum height required

  • preferred_width (int, optional) – Preferred width (default: min_width)

  • preferred_height (int, optional) – Preferred height (default: min_height)

  • content_min_width (int, optional) – Width below which the node’s content cannot be shown, ignoring any explicit fixed width spec (default: min_width).

  • content_min_height (int, optional) – Height below which the node’s content cannot be shown, ignoring any explicit fixed height spec (default: min_height).

Variables:
  • min_width (int) – Minimum width required

  • min_height (int) – Minimum height required

  • preferred_width (int) – Preferred width

  • preferred_height (int) – Preferred height

  • content_min_width (int) – Natural content minimum width (the auto-fit shrink floor)

  • content_min_height (int) – Natural content minimum height (the auto-fit shrink floor)

Notes

A node with a fixed width/height spec reports that value as both min_* and preferred_*, which makes it look incompressible. The content_min_* pair records what the node would need if the author had not pinned a size, and is what auto-fit (see shrink_to_fit()) uses as the floor when it has to claw back over-committed space.

__init__(min_width, min_height, preferred_width=None, preferred_height=None, content_min_width=None, content_min_height=None)
Parameters:
  • min_width (int)

  • min_height (int)

  • preferred_width (int | None)

  • preferred_height (int | None)

  • content_min_width (int | None)

  • content_min_height (int | None)

Return type:

None

Methods

__init__(min_width, min_height[, ...])

Attributes

content_min_height

content_min_width

preferred_height

preferred_width

min_width

min_height

min_width: int
min_height: int
preferred_width: int | None = None
preferred_height: int | None = None
content_min_width: int | None = None
content_min_height: int | None = None
__post_init__()[source]

Set preferred and content-minimum sizes to min sizes if not given.

Return type:

None