Skip to content

abstract

Abstract base classes that define the interfaces the core and layout modules share. They break circular imports and document the contract that Patcher, Box, and Patchline implement. Not intended for direct use.

Abstract base classes for py2max core objects.

This module defines abstract base classes to break circular dependencies between core.py and layout.py modules.

AbstractLayoutManager

Bases: ABC

Abstract base class for LayoutManager objects.

This class defines the interface that layout managers expect from a LayoutManager object, allowing layout.py to reference LayoutManager without creating circular imports.

get_rect_from_maxclass abstractmethod

get_rect_from_maxclass(maxclass: str) -> Optional[Rect]

retrieves default patching_rect from defaults dictionary.

get_relative_pos abstractmethod

get_relative_pos(rect: Rect) -> Rect

returns a relative position for the object

get_absolute_pos abstractmethod

get_absolute_pos(rect: Rect) -> Rect

returns an absolute position for the object

get_pos abstractmethod

get_pos(maxclass: Optional[str] = None) -> Rect

get box rect (position) via maxclass or layout_manager

above abstractmethod

above(rect: Rect) -> Rect

Return a position of a comment above the object

AbstractBox

Bases: ABC

Abstract base class for Box objects.

This class defines the interface that layout managers expect from a Box object, allowing layout.py to reference Box without creating circular imports.

render abstractmethod

render() -> None

Render the box object.

to_dict abstractmethod

to_dict() -> Dict[str, Any]

Convert the box to a dictionary representation.

AbstractPatchline

Bases: ABC

Abstract base class for Patchline objects.

This class defines the interface that layout managers expect from a Patchline object, allowing layout.py to reference Patchline without creating circular imports.

src abstractmethod property

src: str

Source object identifier.

dst abstractmethod property

dst: str

Destination object identifier.

to_dict abstractmethod

to_dict() -> Dict[str, Any]

Convert the patchline to a dictionary representation.

AbstractPatcher

Bases: ABC

Abstract base class for Patcher objects.

This class defines the interface that layout managers expect from a Patcher object, allowing layout.py to reference Patcher without creating circular imports.

width abstractmethod property

width: float

Width of patcher window.

height abstractmethod property

height: float

Height of patcher window.

get_id

get_id(object_name: Optional[str] = None) -> str

Generate an object id (implemented by Patcher).

get_pos

get_pos(maxclass: Optional[str] = None) -> Rect

Get a box position from the layout manager (implemented by Patcher).

render

render(reset: bool = False) -> None

Render boxes/lines to dicts (implemented by Patcher).