Exemple #1
0
 def _get_lilypond_format_bundle(self, leaf):
     from abjad.tools import lilypondnametools
     from abjad.tools import schemetools
     from abjad.tools import systemtools
     lilypond_format_bundle = self._get_basic_lilypond_format_bundle(leaf)
     if self._is_my_only_leaf(leaf):
         context_setting = lilypondnametools.LilyPondContextSetting(
             context_name='Staff',
             context_property='pedalSustainStyle',
             value=schemetools.Scheme(self.style, quoting="'"),
         )
         lilypond_format_bundle.update(context_setting)
         string = self._kinds[self.kind][0]
         lilypond_format_bundle.right.spanner_starts.append(string)
         string = self._kinds[self.kind][1]
         lilypond_format_bundle.right.spanner_starts.append(string)
     elif self._is_my_first_leaf(leaf):
         context_setting = lilypondnametools.LilyPondContextSetting(
             context_name='Staff',
             context_property='pedalSustainStyle',
             value=schemetools.Scheme(self.style, quoting="'"),
         )
         lilypond_format_bundle.update(context_setting)
         string = self._kinds[self.kind][0]
         lilypond_format_bundle.right.spanner_starts.append(string)
     elif self._is_my_last_leaf(leaf):
         string = self._kinds[self.kind][1]
         lilypond_format_bundle.right.spanner_stops.append(string)
     return lilypond_format_bundle
 def _get_lilypond_format_bundle(self, leaf):
     from abjad.tools import lilypondnametools
     lilypond_format_bundle = self._get_basic_lilypond_format_bundle(leaf)
     if not self._is_beamable_component(leaf):
         return lilypond_format_bundle
     elif not self.use_stemlets and (
         not hasattr(leaf, 'written_pitch') and
         not hasattr(leaf, 'written_pitches')):
         return lilypond_format_bundle
     leaf_ids = [id(x) for x in self._get_leaves()]
     previous_leaf = leaf._get_leaf(-1)
     previous_leaf_is_joinable = self._leaf_is_joinable(
         previous_leaf, leaf_ids)
     next_leaf = leaf._get_leaf(1)
     next_leaf_is_joinable = self._leaf_is_joinable(next_leaf, leaf_ids)
     left_beam_count, right_beam_count = self._get_beam_counts(
         leaf,
         previous_leaf,
         previous_leaf_is_joinable,
         next_leaf,
         next_leaf_is_joinable,
         )
     if left_beam_count is not None:
         context_setting = lilypondnametools.LilyPondContextSetting(
             context_property='stemLeftBeamCount',
             value=left_beam_count,
             )
         lilypond_format_bundle.update(context_setting)
     if right_beam_count is not None:
         context_setting = lilypondnametools.LilyPondContextSetting(
             context_property='stemRightBeamCount',
             value=right_beam_count,
             )
         lilypond_format_bundle.update(context_setting)
     start_piece, stop_piece = self._get_start_and_stop_pieces(
         leaf,
         previous_leaf,
         next_leaf,
         leaf_ids,
         )
     if start_piece and stop_piece:
         lilypond_format_bundle.right.spanner_starts.extend([
             start_piece, stop_piece])
     elif start_piece:
         lilypond_format_bundle.right.spanner_starts.append(start_piece)
     elif stop_piece:
         lilypond_format_bundle.right.spanner_stops.append(stop_piece)
     return lilypond_format_bundle