Пример #1
0
 def _make_asset_storehouse_menu_entries(
     self,
     in_built_in_asset_library=True,
     in_user_asset_library=True,
     in_built_in_score_packages=True,
     in_user_score_packages=True,
     ):
     from experimental.tools import scoremanagertools
     keys, display_strings = [], []
     keys.append(
         self.asset_storehouse_filesystem_path_in_user_asset_library)
     display_strings.append('My {}'.format(self._breadcrumb))
     wrangler = scoremanagertools.wranglers.ScorePackageWrangler(
         session=self.session)
     for manager in wrangler.list_asset_managers(
         in_built_in_asset_library=in_built_in_asset_library,
         in_user_asset_library=in_user_asset_library,
         in_built_in_score_packages=in_built_in_score_packages,
         in_user_score_packages=in_user_score_packages,
         ):
         display_strings.append(manager._get_title())
         path_parts = (manager.filesystem_path,) + \
             self.score_package_asset_storehouse_path_infix_parts
         key = os.path.join(*path_parts)
         keys.append(key)
     return sequencetools.zip_sequences_cyclically(
         display_strings, [None], [None], keys)
Пример #2
0
def make_multiplied_quarter_notes(
    pitches, 
    multiplied_durations,
    ):
    r'''Make quarter notes with `pitches` and `multiplied_durations`:

    ::

        >>> args = [[0, 2, 4, 5], [(1, 4), (1, 5), (1, 6), (1, 7)]]
        >>> scoretools.make_multiplied_quarter_notes(*args)
        Selection(Note("c'4 * 1"), Note("d'4 * 4/5"), Note("e'4 * 2/3"), Note("f'4 * 4/7"))

    Read `pitches` cyclically where the length of `pitches` is
    less than the length of `multiplied_durations`:

    ::

        >>> args = [[0], [(1, 4), (1, 5), (1, 6), (1, 7)]]
        >>> scoretools.make_multiplied_quarter_notes(*args)
        Selection(Note("c'4 * 1"), Note("c'4 * 4/5"), Note("c'4 * 2/3"), Note("c'4 * 4/7"))

    Read `multiplied_durations` cyclically where the length of
    `multiplied_durations` is less than the length of `pitches`:

    ::

        >>> args = [[0, 2, 4, 5], [(1, 5)]]
        >>> scoretools.make_multiplied_quarter_notes(*args)
        Selection(Note("c'4 * 4/5"), Note("d'4 * 4/5"), Note("e'4 * 4/5"),
        Note("f'4 * 4/5"))

    Returns list of zero or more newly constructed notes.
    '''
    from abjad.tools import scoretools

    multiplied_durations = [durationtools.Duration(x) for x in multiplied_durations]
    quarter_notes = []

    for pitch, duration in sequencetools.zip_sequences_cyclically(pitches, multiplied_durations):
        quarter_note = scoretools.Note(pitch, durationtools.Duration(1, 4))
        duration = durationtools.Duration(duration)
        multiplier = durationtools.Multiplier(duration / durationtools.Duration(1, 4))
        attach(multiplier, quarter_note)
        quarter_notes.append(quarter_note)

    quarter_notes = selectiontools.Selection(quarter_notes)
    return quarter_notes
Пример #3
0
 def _make_asset_menu_entries(self):
     file_names = self._list_directory()
     file_names = [x for x in file_names if x[0].isalpha()]
     file_paths = []
     for file_name in file_names:
         file_path = os.path.join(self.filesystem_path, file_name)
         file_paths.append(file_path)
     display_strings = file_names[:]
     menu_entries = []
     if display_strings:
         menu_entries = sequencetools.zip_sequences_cyclically(
             display_strings,
             [None],
             [None],
             file_paths,
             )
     return menu_entries
 def _make_asset_menu_entries(self, head=None):
     names = self.list_asset_names(head=head)
     paths = self.list_asset_packagesystem_paths(head=head)
     assert len(names) == len(paths)
     return sequencetools.zip_sequences_cyclically(
         names, [None], [None], paths)