visualization.labels

labels

Default labels for the nodes of a visualization, and the HTML-like building blocks that layout places: the sync bar’s blocks, the title block, the spanner markers.

Everything here produces text. A label that starts with < and ends with > is an HTML-like Graphviz label (dot.is_html_label); default_label writes one when it needs a superscript or a second font size, and plain text otherwise. Text that goes into an HTML-like label passes through escape.

No musical system is imported. A duration is asked for numerator, denominator, dots and ratio (WSMN’s MetricalDuration has them), a clef for its sign, a chord for its str(), so a system the core does not know still gets a readable label, and a system it does know gets a glyph.

The sizes and glyph tables are module constants, meant to be tuned.

Attributes

Name Description
OCTAVE_POINT_SIZE
GLYPH_POINT_SIZE
CLEF_POINT_SIZE
SMALL_POINT_SIZE
DESCRIPTION_POINT_SIZE
DESCRIPTION_COLOR
NOTE_GLYPHS
REST_GLYPHS
AUGMENTATION_DOT
TIE
CLEF_GLYPHS
SPANNER_BRACKETS

Functions

Name Description
escape text made safe inside an HTML-like label.
html_label An HTML-like label around inner.
sized text at point_size inside an HTML-like label.
duration_glyph The note glyph for a duration, or None where there is none.
rest_glyph The rest glyph for a duration, or None where there is none.
clock_label A clock duration as HH:MM:SS.ffff.
duration_label A duration as text: its glyph where it has one, a clock time, a fraction
tone_label A tone’s display form as an HTML-like fragment, a trailing octave
sorted_tones Tones lowest first where they compare, else by display form.
clef_glyph The glyph for a clef whose sign is one the table knows, with its
default_label A concise label for any object: its content where it has a display
spanner_markers The start and end marker labels of a spanner: text with an opening
title_block The score’s title block: a bordered table with the title in bold and
sync_block A block of a sync bar: a dot resting on the bar with time beside it,