GregoryREvans / evans

Gregory Rowland Evans' Abjad library.

Home Page:http://www.gregoryrowlandevans.com/perllan/api/evans/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clean up insertion process in LogicalTieCollection

GregoryREvans opened this issue · comments

Need to clean up insertion process in LogicalTieCollection. Should be able to be initialized with a list or a selection, but currently one must use the following process:

import abjad
from evans.consort_reviv.LogicalTieCollection import LogicalTieCollection

clef = abjad.Clef('treble')

staff = abjad.Staff("c'4 d' e' f' g' a' b' c''")

abjad.attach(clef, staff[0])

selection = abjad.select(staff[:2]).leaves(pitched=True)
for note in selection:
    abjad.override(note).note_head.color = 'red'

target_timespan = abjad.Timespan(start_offset=(2, 4), stop_offset=(4, 4))

tie_selection = abjad.select(staff).logical_ties()
tie_collection = LogicalTieCollection()
for tie in tie_selection:
    tie_collection.insert(tie)

for tie in tie_collection.find_logical_ties_intersecting_timespan(target_timespan):
    for leaf in tie:
        leaf.written_pitch = leaf.written_pitch + 6
        abjad.override(leaf).note_head.color = 'blue'

abjad.f(staff)

Does this really need to be fixed? abjad.Container() can't be initialized with contents.

Move to tyfwr? Or clean up consort_reviv?

No longer relevant.