def label_sections_in_treble_in_blue(treble, section_lengths): treble_sections = sequencetools.partition_by_lengths( treble[:], section_lengths, cyclic = True) for section_index, treble_section in enumerate(treble_sections): section_number = section_index + 1 if 1 < len(treble_section): treble_leaves = list(iterate.naive(treble_section, _Leaf)) bracket = Bracket(treble_leaves[1:]) bracket.staff_padding = 8 bracket.color = 'blue' bracket.dash_period = 2 bracket.dash_fraction = 0.25 section_markup = '\halign #0 \with-color #blue \circle { %s } " "' section_markup %= section_number bracket.bound_details__left__text = Markup(section_markup) bracket.bound_details__left__stencil_align_dir_y = 'center' else: first_note = treble_section[0][1] section_markup = '\with-color #blue \circle { %s } " "' section_markup %= section_number first_note.markup.up.append(section_markup) first_note.text.staff_padding = 8