def _make_global_context_block( font_size=3, minimum_distance=10, padding=4, ): assert isinstance(font_size, (int, float)) assert isinstance(padding, (int, float)) block = ContextBlock( type_='Engraver_group', name='GlobalContext', ) block.consists_commands.append('Axis_group_engraver') block.consists_commands.append('Time_signature_engraver') time_signature_grob = override(block).time_signature time_signature_grob.X_extent = (0, 0) time_signature_grob.X_offset = Scheme( 'ly:self-alignment-interface::x-aligned-on-self' ) time_signature_grob.Y_extent = (0, 0) time_signature_grob.break_align_symbol = False time_signature_grob.break_visibility = Scheme( 'end-of-line-invisible', ) time_signature_grob.font_size = font_size time_signature_grob.self_alignment_X = Scheme('center') spacing_vector = SpacingVector( 0, minimum_distance, padding, 0, ) grob = override(block).vertical_axis_group grob.default_staff_staff_spacing = spacing_vector return block
def _make_markup_score_block(selection): from abjad.tools import lilypondfiletools from abjad.tools import schemetools from abjad.tools import scoretools selection = copy.deepcopy(selection) staff = scoretools.Staff(selection) staff.context_name = 'RhythmicStaff' staff.remove_commands.append('Time_signature_engraver') staff.remove_commands.append('Staff_symbol_engraver') override(staff).stem.direction = Up #override(staff).stem.length = 4 override(staff).stem.length = 5 override(staff).tuplet_bracket.bracket_visibility = True override(staff).tuplet_bracket.direction = Up override(staff).tuplet_bracket.padding = 1.25 override(staff).tuplet_bracket.shorten_pair = (-1, -1.5) scheme = schemetools.Scheme('tuplet-number::calc-fraction-text') override(staff).tuplet_number.text = scheme set_(staff).tuplet_full_length = True layout_block = lilypondfiletools.Block(name='layout') layout_block.indent = 0 layout_block.ragged_right = True score = scoretools.Score([staff]) override(score).spacing_spanner.spacing_increment = 0.5 set_(score).proportional_notation_duration = False return score, layout_block
def _populate_grob_revert_format_contributions(component, bundle): from abjad.tools import scoretools from abjad.tools.topleveltools.override import override if not isinstance(component, scoretools.Leaf): manager = override(component) contributions = manager._list_format_contributions('revert') bundle.grob_reverts.extend(contributions)
def _populate_grob_override_format_contributions(component, bundle): from abjad.tools import scoretools from abjad.tools.topleveltools.override import override result = [] is_once = isinstance(component, scoretools.Leaf) contributions = override(component)._list_format_contributions( 'override', is_once=is_once, ) for string in result[:]: if 'NoteHead' in string and 'pitch' in string: contributions.remove(string) bundle.grob_overrides.extend(contributions)
def __copy__(self, *arguments): r'''Copies spanner. Does not copy spanner leaves. Returns new spanner. ''' new = type(self)(*self.__getnewargs__()) if getattr(self, '_lilypond_grob_name_manager', None) is not None: new._lilypond_grob_name_manager = copy.copy(override(self)) if getattr(self, '_lilypond_setting_name_manager', None) is not None: new._lilypond_setting_name_manager = copy.copy(setting(self)) if getattr(self, '_lilypond_tweak_manager', None) is not None: new._lilypond_tweak_manager = copy.copy(tweak(self)) self._copy_keyword_args(new) return new
def _make_score_block(self, selection): from abjad.tools import lilypondfiletools from abjad.tools import scoretools selection = copy.deepcopy(selection) staff = scoretools.Staff(selection) staff.context_name = 'RhythmicStaff' staff.remove_commands.append('Time_signature_engraver') staff.remove_commands.append('Staff_symbol_engraver') override(staff).stem.direction = Up override(staff).stem.length = 4 override(staff).tuplet_bracket.bracket_visibility = True override(staff).tuplet_bracket.direction = Up override(staff).tuplet_bracket.padding = 1.25 override(staff).tuplet_bracket.shorten_pair = (-1, -1.5) scheme = schemetools.Scheme('tuplet-number::calc-fraction-text') override(staff).tuplet_number.text = scheme set_(staff).font_size = -2 set_(staff).tuplet_full_length = True layout_block = lilypondfiletools.Block(name='layout') layout_block.indent = 0 layout_block.ragged_right = True score = scoretools.Score([staff]) set_(score).proportional_notation_duration = False return score, layout_block