Esempio n. 1
0
 def _get_lilypond_format_bundle(self, leaf):
     import abjad
     bundle = self._get_basic_lilypond_format_bundle(leaf)
     if leaf is self[-1] and not self.forbid_restarting:
         bundle.after.commands.append(r'\stopStaff')
         bundle.after.commands.append(r'\startStaff')
     if leaf is self[0]:
         bundle.before.commands.append(r'\stopStaff')
         if isinstance(self.lines, int):
             override = abjad.LilyPondGrobOverride(
                 lilypond_type='Staff',
                 grob_name='StaffSymbol',
                 once=True,
                 property_path='line-count',
                 value=self.lines,
             )
             string = override.override_string
             bundle.before.commands.append(string)
         else:
             override = abjad.LilyPondGrobOverride(
                 lilypond_type='Staff',
                 grob_name='StaffSymbol',
                 once=True,
                 property_path='line-positions',
                 value=abjad.SchemeVector(self.lines),
             )
             string = override.override_string
             bundle.before.commands.append(string)
         bundle.before.commands.append(r'\startStaff')
     return bundle
def test_scoretools_Container_context_settings_01():
    r'''Noncontext containers bracket context abjad.settings at opening.
    '''

    container = abjad.Container("c'8 d'8 e'8 f'8")
    abjad.setting(container).score.beam_exceptions = abjad.SchemeVector()

    assert format(container) == abjad.String.normalize(r'''
        {
            \set Score.beamExceptions = #'()
            c'8
            d'8
            e'8
            f'8
        }
        ''')
 def _make_glissando_map(fret_combination, context_name):
     binary_list = fret_combination.as_binary_list()
     binary_list.reverse()
     glissando_map_list = []
     for i, finger in enumerate(binary_list):
         if finger == 1:
             mapping = abjad.SchemePair((i, i))
             glissando_map_list.append(mapping)
     if binary_list is None or binary_list == [0, 0, 0, 0, 0, 0]:
         return None
     else:
         glissando_map_vector = abjad.SchemeVector(glissando_map_list)
         glissando_map = abjad.lilypondnametools.LilyPondContextSetting(
             context_name=context_name,
             context_property='glissandoMap',
             value=glissando_map_vector)
         return glissando_map
def test_Tuplet_context_settings_01():
    """
    Tuplet bracket context abjad.settings at before slot.
    """

    tuplet = abjad.Tuplet((2, 3), "c'8 d'8 e'8 f'8")
    abjad.setting(tuplet).score.beam_exceptions = abjad.SchemeVector()

    assert format(tuplet) == abjad.String.normalize(r"""
        \set Score.beamExceptions = #'()
        \tweak edge-height #'(0.7 . 0)
        \times 2/3 {
            c'8
            d'8
            e'8
            f'8
        }
        """)
Esempio n. 5
0
def test_Container_context_settings_01():
    """
    Noncontext containers bracket context abjad.settings at opening.
    """

    container = abjad.Container("c'8 d'8 e'8 f'8")
    abjad.setting(container).score.beam_exceptions = abjad.SchemeVector()

    assert abjad.lilypond(container) == abjad.String.normalize(
        r"""
        {
            \set Score.beamExceptions = #'()
            c'8
            d'8
            e'8
            f'8
        }
        """
    )
Esempio n. 6
0
def test_lilypondproxytools_LilyPondGrobNameManager___setattr___41():
    r'''Override LilyPond StaffSymbol grob.
    '''

    staff = abjad.Staff("c'8 d'8 e'8 f'8")
    abjad.override(staff).staff_symbol.line_positions = \
        abjad.SchemeVector([-4, -2, 2, 4])

    assert format(staff) == abjad.String.normalize(r'''
        \new Staff
        \with
        {
            \override StaffSymbol.line-positions = #'(-4 -2 2 4)
        }
        {
            c'8
            d'8
            e'8
            f'8
        }
        ''')
Esempio n. 7
0
def test_LilyPondGrobNameManager___setattr___33():
    """
    Override LilyPond StaffSymbol grob.
    """

    staff = abjad.Staff("c'8 d'8 e'8 f'8")
    abjad.override(staff).staff_symbol.line_positions = abjad.SchemeVector(
        [-4, -2, 2, 4])

    assert format(staff) == abjad.String.normalize(r"""
        \new Staff
        \with
        {
            \override StaffSymbol.line-positions = #'(-4 -2 2 4)
        }
        {
            c'8
            d'8
            e'8
            f'8
        }
        """)