Skip to content

Styling & Properties

Geometry

Region dataclass

Region(x: int, y: int, width: int, height: int)

bottom_right property

bottom_right: Point

bounding_box property

bounding_box: tuple[int, int, int, int]

height instance-attribute

height: int

size property

size: Size

top_left property

top_left: Point

width instance-attribute

width: int

x instance-attribute

x: int

y instance-attribute

y: int

from_points staticmethod

from_points(u: Point, v: Point) -> Region

union staticmethod

union(regions: list[Region]) -> Region

Nodes

NodeProperties dataclass

NodeProperties(
    shape: ShapeProperties = Box(),
    style: Style = Style(),
    content_style: Style = Style(),
    margin: int = 0,
    padding: PaddingDimensions = (0, 1),
    content_renderer: Callable[
        [str, dict[str, Any], Style], RenderableType
    ] = _default_content_renderer,
    lod_map: Callable[[float], int] = lambda _: 1,
    lod_properties: dict[int, NodeProperties] = dict(),
    ports: dict[str, Port] = dict(),
    slots: bool = False,
)

content_renderer class-attribute instance-attribute

content_renderer: Callable[
    [str, dict[str, Any], Style], RenderableType
] = _default_content_renderer

content_style class-attribute instance-attribute

content_style: Style = Style()

lod_map class-attribute instance-attribute

lod_map: Callable[[float], int] = lambda _: 1

lod_properties class-attribute instance-attribute

lod_properties: dict[int, NodeProperties] = field(
    default_factory=dict
)

margin class-attribute instance-attribute

margin: int = 0

padding class-attribute instance-attribute

padding: PaddingDimensions = (0, 1)

ports class-attribute instance-attribute

ports: dict[str, Port] = field(default_factory=dict)

shape class-attribute instance-attribute

shape: ShapeProperties = field(default_factory=Box)

slots class-attribute instance-attribute

slots: bool = False

style class-attribute instance-attribute

style: Style = Style()

from_attribute_dict classmethod

from_attribute_dict(
    data: dict[str, Any],
    suffix: str = "",
    fallback: Union[NodeProperties, None] = None,
) -> NodeProperties

from_data_dict classmethod

from_data_dict(data: dict[str, Any])

Port dataclass

Port(
    label: str = "",
    magnet: Magnet | None = None,
    key: int = 0,
    symbol: str = "○",
    symbol_connected: str = "●",
    offset: int | None = None,
)

key class-attribute instance-attribute

key: int = 0

label class-attribute instance-attribute

label: str = ''

magnet class-attribute instance-attribute

magnet: Magnet | None = None

offset class-attribute instance-attribute

offset: int | None = None

symbol class-attribute instance-attribute

symbol: str = '○'

symbol_connected class-attribute instance-attribute

symbol_connected: str = '●'

parse classmethod

parse(value: Union[dict[str, Any], Port]) -> Port

ShapeProperties dataclass

ShapeProperties(shape_type: Literal['box', 'just_content'])

shape_type instance-attribute

shape_type: Literal['box', 'just_content']

parse classmethod

parse(
    value: dict[str, Any],
    suffix: str,
    fallback: ShapeProperties,
) -> ShapeProperties

JustContent dataclass

JustContent(
    shape_type: Literal[
        "box", "just_content"
    ] = "just_content",
)

Bases: ShapeProperties

shape_type class-attribute instance-attribute

shape_type: Literal['box', 'just_content'] = 'just_content'

Box dataclass

Box(
    shape_type: Literal["box", "just_content"] = "box",
    box_type: RichBox = ROUNDED,
)

Bases: ShapeProperties

box_type class-attribute instance-attribute

box_type: Box = ROUNDED

shape_type class-attribute instance-attribute

shape_type: Literal['box', 'just_content'] = 'box'

parse classmethod

parse(
    value: dict[str, Any],
    suffix: str,
    fallback: ShapeProperties,
) -> Box

Edges

EdgeProperties dataclass

EdgeProperties(
    show: bool = True,
    label: str | None = None,
    style: Style = Style(),
    dash_pattern: list[int] | None = None,
    routing_mode: EdgeRoutingMode = EdgeRoutingMode.STRAIGHT,
    segment_drawing_mode: EdgeSegmentDrawingMode = EdgeSegmentDrawingMode.SINGLE_CHARACTER,
    start_arrow_tip: ArrowTip | None = None,
    end_arrow_tip: ArrowTip | None = None,
    start_port: str | None = None,
    end_port: str | None = None,
    start_magnet: Magnet = Magnet.CLOSEST,
    end_magnet: Magnet = Magnet.CLOSEST,
    lod_map: Callable[[float], int] = lambda _: 1,
    lod_properties: dict[int, EdgeProperties] = dict(),
)

dash_pattern class-attribute instance-attribute

dash_pattern: list[int] | None = None

end_arrow_tip class-attribute instance-attribute

end_arrow_tip: ArrowTip | None = None

end_magnet class-attribute instance-attribute

end_magnet: Magnet = CLOSEST

end_port class-attribute instance-attribute

end_port: str | None = None

label class-attribute instance-attribute

label: str | None = None

lod_map class-attribute instance-attribute

lod_map: Callable[[float], int] = lambda _: 1

lod_properties class-attribute instance-attribute

lod_properties: dict[int, EdgeProperties] = field(
    default_factory=dict
)

routing_mode class-attribute instance-attribute

routing_mode: EdgeRoutingMode = STRAIGHT

segment_drawing_mode class-attribute instance-attribute

segment_drawing_mode: EdgeSegmentDrawingMode = (
    SINGLE_CHARACTER
)

show class-attribute instance-attribute

show: bool = True

start_arrow_tip class-attribute instance-attribute

start_arrow_tip: ArrowTip | None = None

start_magnet class-attribute instance-attribute

start_magnet: Magnet = CLOSEST

start_port class-attribute instance-attribute

start_port: str | None = None

style class-attribute instance-attribute

style: Style = Style()

from_attribute_dict classmethod

from_attribute_dict(
    data: dict[str, Any],
    suffix: str = "",
    fallback: Union[EdgeProperties, None] = None,
) -> EdgeProperties

from_data_dict classmethod

from_data_dict(data: dict[str, Any])

Magnet

Bases: Enum

TOP class-attribute instance-attribute

TOP = 1

LEFT class-attribute instance-attribute

LEFT = 2

RIGHT class-attribute instance-attribute

RIGHT = 4

BOTTOM class-attribute instance-attribute

BOTTOM = 3

CLOSEST class-attribute instance-attribute

CLOSEST = 5

ArrowTip

Bases: Enum

ARROW class-attribute instance-attribute

ARROW = 'arrow'

EdgeRoutingMode

Bases: Enum

STRAIGHT class-attribute instance-attribute

STRAIGHT = 'straight'

ORTHOGONAL class-attribute instance-attribute

ORTHOGONAL = 'orthogonal'

EdgeSegmentDrawingMode

Bases: Enum

BOX class-attribute instance-attribute

BOX = 'box'

BOX_ROUNDED class-attribute instance-attribute

BOX_ROUNDED = 'box_round'

BOX_HEAVY class-attribute instance-attribute

BOX_HEAVY = 'box_heavy'

BOX_DOUBLE class-attribute instance-attribute

BOX_DOUBLE = 'box_double'

ASCII class-attribute instance-attribute

ASCII = 'ascii'

SINGLE_CHARACTER class-attribute instance-attribute

SINGLE_CHARACTER = 'single_character'