VisualizationConfig

VisualizationConfig(
    direction: SequenceDirection = SequenceDirection.LEFT_TO_RIGHT,
    node_styles: Mapping[type[OmkObject], NodeStyle] = dict(),
    edge_styles: Mapping[EdgeType, EdgeStyle] = dict(),
    sync_bar: EdgeStyle = SYNC_BAR_STYLE,
    label: Callable[[OmkObject], str] = default_label,
    font_name: str = 'Helvetica',
    splines: str = 'line',
    node_sep: float = 0.15,
    rank_sep: float = 0.35,
)

Everything a GraphRenderer is told: the direction, style overrides by class and by edge type, the label hook, and the graph-wide settings.

>>> from openmusickit.objects.note_event import NoteEvent
>>> config = VisualizationConfig(node_styles={NoteEvent: NodeStyle(shape="circle")})
>>> config.node_style(NoteEvent(tones=set())).shape, config.node_style(Part(name="x")).shape
('circle', 'plain')
>>> config.edge_style(EdgeType.NEXT).style, config.direction
('solid', <SequenceDirection.LEFT_TO_RIGHT: 'LR'>)

Attributes

Name Description
direction
node_styles
edge_styles
sync_bar
label
font_name
splines
node_sep
rank_sep

Methods

Name Description
node_style The style of node: the entry for the most specific class in its
edge_style The style of edges of edge_type: the override, else the default.

node_style

node_style(node: OmkObject)

The style of node: the entry for the most specific class in its MRO, an override beating the default for the same class.

edge_style

edge_style(edge_type: EdgeType)

The style of edges of edge_type: the override, else the default.