def _path_to_human_readable_name(self, path): path = os.path.normpath(path) name = os.path.basename(path) include_extensions = self._include_extensions if not include_extensions: name, extension = os.path.splitext(name) return stringtools.to_space_delimited_lowercase(name)
def _target_kwargs_to_target_summary_lines(self, target): result = [] for kwarg in getattr(target, "kwargs", []): name = stringtools.to_space_delimited_lowercase(kwarg) value = self._io_manager._get_one_line_menu_summary(getattr(target, kwarg)) result.append("{}: {}".format(name, value)) return result
def _path_to_human_readable_name(self, path): path = os.path.normpath(path) name = os.path.basename(path) include_extensions = self._include_extensions if not include_extensions: name, extension = os.path.splitext(name) return stringtools.to_space_delimited_lowercase(name)
def _target_kwargs_to_target_summary_lines(self, target): result = [] for kwarg in getattr(target, 'kwargs', []): name = stringtools.to_space_delimited_lowercase(kwarg) value = self._io_manager._get_one_line_menu_summary( getattr(target, kwarg)) result.append('{}: {}'.format(name, value)) return result
def _get_target_summary_lines(self): result = [] if self.target is not None: for attribute_detail in self._attribute_manifest: target_attribute_name = attribute_detail.name name = stringtools.to_space_delimited_lowercase(target_attribute_name) value = self._io_manager._get_one_line_menu_summary(getattr(self.target, target_attribute_name)) result.append("{}: {}".format(name, value)) return result
def breadcrumb(self): r'''Gets autoeditor breadcrumb. Returns none. ''' if self._breadcrumb is None: name = type(self.target).__name__ name = stringtools.to_space_delimited_lowercase(name) return name return self._breadcrumb
def breadcrumb(self): r"""Gets autoeditor breadcrumb. Returns none. """ if self._breadcrumb is None: name = type(self.target).__name__ name = stringtools.to_space_delimited_lowercase(name) return name return self._breadcrumb
def _get_target_summary_lines(self): result = [] if self.target is not None: for attribute_detail in self._attribute_manifest: target_attribute_name = attribute_detail.name name = stringtools.to_space_delimited_lowercase( target_attribute_name) value = self._io_manager._get_one_line_menu_summary( getattr(self.target, target_attribute_name)) result.append('{}: {}'.format(name, value)) return result
def _make_asset_selection_breadcrumb( self, human_readable_target_name=None, infinitival_phrase=None, is_storehouse=False, ): if human_readable_target_name is None: name = self._manager_class.__name__ name = stringtools.to_space_delimited_lowercase(name) human_readable_target_name = name if infinitival_phrase: return 'select {} {}:'.format( human_readable_target_name, infinitival_phrase, ) elif is_storehouse: return 'select storehouse' else: return 'select {}:'.format(human_readable_target_name)
def _make_asset_selection_breadcrumb( self, human_readable_target_name=None, infinitival_phrase=None, is_storehouse=False, ): if human_readable_target_name is None: name = self._manager_class.__name__ name = stringtools.to_space_delimited_lowercase(name) human_readable_target_name = name if infinitival_phrase: return 'select {} {}:'.format( human_readable_target_name, infinitival_phrase, ) elif is_storehouse: return 'select storehouse' else: return 'select {}:'.format(human_readable_target_name)
def program_name(self): r'''The name of the script, callable from the command line. ''' name = type(self).__name__[:type(self).__name__.rfind('Script')] return stringtools.to_space_delimited_lowercase(name).replace(' ', '-')
def program_name(self): r'''The name of the script, callable from the command line. ''' name = type(self).__name__[:type(self).__name__.rfind('Script')] return stringtools.to_space_delimited_lowercase(name).replace(' ', '-')
def __illustrate__( self, annotate=False, verbose=True, package_name=None, **kwargs ): r"""Illustrates music specifier. :: >>> piano_glissando_music_specifier = consort.MusicSpecifier( ... attachment_handler=consort.AttachmentHandler( ... glissando=spannertools.Glissando(), ... ), ... color=None, ... labels=[], ... pitch_handler=consort.AbsolutePitchHandler( ... pitch_specifier="c' f' c'' f'' c''' c'' c' c'''", ... ), ... rhythm_maker=consort.CompositeRhythmMaker( ... last=rhythmmakertools.IncisedRhythmMaker( ... incise_specifier=rhythmmakertools.InciseSpecifier( ... prefix_counts=[0], ... suffix_talea=[1], ... suffix_counts=[1], ... talea_denominator=16, ... ), ... ), ... default=rhythmmakertools.EvenDivisionRhythmMaker( ... denominators=(4,), ... duration_spelling_specifier=rhythmmakertools.DurationSpellingSpecifier( ... decrease_durations_monotonically=True, ... forbidden_written_duration=(1, 4), ... forbid_meter_rewriting=True, ... ), ... ), ... ), ... ) :: >>> illustration = piano_glissando_music_specifier.__illustrate__( ... annotate=True, ... verbose=False, ... ) Returns LilyPond file. """ import consort score_template = consort.StringQuartetScoreTemplate( split=False, without_instruments=False, ) segment_maker = consort.SegmentMaker( desired_duration_in_seconds=10, discard_final_silence=True, annotate_colors=True, annotate_phrasing=annotate, permitted_time_signatures=[ (3, 8), (4, 8), (5, 8), (6, 8), (7, 8), ], score_template=score_template, tempo=indicatortools.Tempo((1, 4), 72), timespan_quantization=(1, 8), ) timespan_maker = consort.TaleaTimespanMaker( initial_silence_talea=rhythmmakertools.Talea( counts=[0, 2, 1], denominator=8, ), playing_talea=rhythmmakertools.Talea( counts=[3, 2, 1, 4, 5, 3, 1, 2], denominator=8, ), playing_groupings=[2, 1, 2, 3, 1, 3, 4, 1, 2, 3], repeat=True, silence_talea=rhythmmakertools.Talea( counts=[1, 2, 3, 1, 2, 4], denominator=8, ), step_anchor=Right, synchronize_groupings=False, synchronize_step=False, timespan_specifier=consort.TimespanSpecifier( minimum_duration=durationtools.Duration(1, 8), ), ) segment_maker.add_setting( timespan_maker=timespan_maker, violin_1=self, violin_2=self, viola=self, cello=self, ) segment_metadata = collections.OrderedDict( segment_count=1, segment_number=1, ) lilypond_file, segment_metadata = segment_maker( segment_metadata=segment_metadata, verbose=verbose, ) consort_stylesheet_path = os.path.join( consort.__path__[0], 'stylesheets', 'stylesheet.ily', ) consort_stylesheet_path = os.path.abspath(consort_stylesheet_path) lilypond_file = new( lilypond_file, includes=[consort_stylesheet_path], use_relative_includes=False, date_time_token=False, ) if package_name is not None: header = lilypondfiletools.Block('header') title = stringtools.to_space_delimited_lowercase(package_name) title = title.title() title = markuptools.Markup(title).override(('font-name', 'Didot')) header.title = title header.tagline = markuptools.Markup('""') lilypond_file.items.insert(0, header) return lilypond_file
def _spaced_class_name(self): return stringtools.to_space_delimited_lowercase(type(self).__name__)
def _spaced_class_name(self): return stringtools.to_space_delimited_lowercase(type(self).__name__)