예제 #1
0
 def _add_tweaks_and_direction(self, command):
     strings = []
     contributions = tweak(self)._list_format_contributions()
     strings.extend(contributions)
     string = self._add_direction(command)
     strings.append(string)
     return strings
예제 #2
0
파일: Hairpin.py 프로젝트: gsy/gmajor
 def _tweaked_start_command_strings(self):
     strings = []
     contributions = tweak(self)._list_format_contributions()
     strings.extend(contributions)
     string = rf'\{self.shape_string}'
     string = self._add_direction(string)
     strings.append(string)
     return strings
예제 #3
0
 def _tweaked_start_command_strings(self):
     strings = []
     contributions = tweak(self)._list_format_contributions()
     strings.extend(contributions)
     start_command = self._start_command
     start_command = self._add_direction(start_command)
     strings.append(start_command)
     return strings
예제 #4
0
    def __copy__(self, *arguments):
        """
        Copies spanner.

        Does not copy spanner leaves.
        """
        new = type(self)(*self.__getnewargs__())
        if getattr(self, '_lilypond_setting_name_manager', None) is not None:
            new._lilypond_setting_name_manager = copy.copy(setting(self))
        if getattr(self, '_tweaks', None) is not None:
            new._tweaks = copy.copy(tweak(self))
        self._copy_keywords(new)
        return new
예제 #5
0
    def _match_anchor_leaf(self):
        from .Chord import Chord
        from .Note import Note

        first_grace = abjad_inspect(self).leaf(0)
        if not isinstance(first_grace, (Note, Chord)):
            message = f"must start with note or chord:\n"
            message += f"    {repr(self)}"
            raise Exception(message)
        anchor_leaf = self._get_on_beat_anchor_leaf()
        if isinstance(anchor_leaf,
                      (Note, Chord)) and isinstance(first_grace,
                                                    (Note, Chord)):
            if isinstance(first_grace, Note):
                chord = Chord(first_grace)
                mutate(first_grace).replace(chord)
                first_grace = chord
            anchor_pitches = abjad_inspect(anchor_leaf).pitches()
            highest_pitch = list(sorted(anchor_pitches))[-1]
            if highest_pitch not in first_grace.note_heads:
                first_grace.note_heads.append(highest_pitch)
            grace_mate_head = first_grace.note_heads.get(highest_pitch)
            tweak(grace_mate_head).font_size = 0
            tweak(grace_mate_head).transparent = True
예제 #6
0
    def tweaks(self) -> LilyPondTweakManager:
        r"""
        Gets tweaks.

        ..  container:: example

            >>> note_head = abjad.NoteHead("cs''")
            >>> note_head.tweaks
            LilyPondTweakManager()

            >>> abjad.tweak(note_head).color = 'red'
            >>> abjad.f(note_head)
            \tweak color #red
            cs''

        """
        return tweak(self)