Esempio n. 1
0
    def list_visible_asset_package_path_and_score_title_pairs(
        self,
        in_built_in_asset_library=True, 
        in_user_asset_library=True,
        in_built_in_score_packages=True, 
        in_user_score_packages=True,
        head=None,
        ):
        r'''Lists visible asset package path and score title pairs.

        Example. List visible built-in score package path and title pairs:

        ::

            >>> for x in wrangler.list_visible_asset_package_path_and_score_title_pairs(
            ...     in_user_asset_library=False, 
            ...     in_user_score_packages=False,
            ...     ):
            ...     x[0]
            ...     x[1]
            ...     print
            '...scoremanagertools.scorepackages.blue_example_score'
            'Blue Example Score (2013)'
            <BLANKLINE>
            '...scoremanagertools.scorepackages.green_example_score'
            'Green Example Score (2013)'
            <BLANKLINE>
            '...scoremanagertools.scorepackages.red_example_score'
            'Red Example Score (2013)'
            <BLANKLINE>

        Returns list.
        '''
        result = []
        scores_to_show = self.session.scores_to_show
        for asset_manager in PackageWrangler.list_asset_managers(
            self,
            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,
            head=head,
            ):
            tags = asset_manager._get_metadatas()
            is_mothballed = tags.get('is_mothballed', False)
            if scores_to_show == 'all' or \
                (scores_to_show == 'active' and not is_mothballed) or \
                (scores_to_show == 'mothballed' and is_mothballed):
                year_of_completion = tags.get('year_of_completion')
                if year_of_completion:
                    title_with_year = '{} ({})'.format(tags['title'], year_of_completion)
                else:
                    title_with_year = '{}'.format(tags['title'])
                result.append((asset_manager.package_path, title_with_year))
        return result
Esempio n. 2
0
    def list_visible_asset_managers(
        self,
        in_built_in_asset_library=True, 
        in_user_asset_library=True,
        in_built_in_score_packages=True, 
        in_user_score_packages=True,
        head=None,
        ):
        r'''Lists visible asset managers.

        Example. List visible score package managers:

        ::

            >>> for x in wrangler.list_visible_asset_managers(
            ...     in_user_asset_library=False, 
            ...     in_user_score_packages=False,
            ...     ):
            ...     x
            ScorePackageManager('.../scorepackages/blue_example_score')
            ScorePackageManager('.../scorepackages/green_example_score')
            ScorePackageManager('.../scorepackages/red_example_score')

        Returns list.
        '''
        result = []
        scores_to_show = self.session.scores_to_show
        for asset_manager in PackageWrangler.list_asset_managers(
            self,
            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,
            head=head,
            ):
            is_mothballed = asset_manager._get_metadata('is_mothballed')
            if scores_to_show == 'all':
                result.append(asset_manager)
            elif scores_to_show == 'active' and not is_mothballed:
                result.append(asset_manager)
            elif scores_to_show == 'mothballed' and is_mothballed:
                result.append(asset_manager)
        return result
 def __init__(self, session=None):
     from experimental.tools import scoremanagertools
     PackageWrangler.__init__(self, session=session)
     self._material_package_maker_wrangler = \
         scoremanagertools.wranglers.MaterialPackageMakerWrangler(
             session=self.session)