Exemplo n.º 1
0
    def create_wallpaper_dict(self):
        '''Get the wallpapers from the profile, the Kano Draw pictures
        and find which ones are unlocked
        '''

        self.images = {}

        self.get_wallpapers(wallpaper_path)
        self.get_wallpapers(kano_draw_path)

        cm = ContentManager.from_local()
        for co in cm.list_local_objects(spec='wallpapers'):
            wallpaper_dir = co.get_data('wallpapers').get_dir()
            self.get_wallpapers(wallpaper_dir)

        # To get info about which environments are unlocked we first calculate
        # badges then we take the 'achieved' attribute of an environment and
        # add it to the attribute of our local list of wallpapers
        #
        #   NOTE: it relies on the wallpapers in kano-desktop to me named as
        #   their respective rule in kano-profile with the following pattern:
        #
        #         [rule_name]-background[name_pattern]
        #         e.g. [arcade_hall]-background[-4-3.png]
        environments = calculate_badges()['environments']['all']
        for environment, attributes in environments.iteritems():
            try:
                self.images[environment]['unlocked'] = attributes['achieved']
            except:
                pass
    def create_wallpaper_dict(self):
        '''Get the wallpapers from the profile, the Kano Draw pictures
        and find which ones are unlocked
        '''

        self.images = {}

        self.get_wallpapers(wallpaper_path)
        self.get_wallpapers(kano_draw_path)

        cm = ContentManager.from_local()
        for co in cm.list_local_objects(spec='wallpapers'):
            wallpaper_dir = co.get_data('wallpapers').get_dir()
            self.get_wallpapers(wallpaper_dir)

        # To get info about which environments are unlocked we first calculate
        # badges then we take the 'achieved' attribute of an environment and
        # add it to the attribute of our local list of wallpapers
        #
        #   NOTE: it relies on the wallpapers in kano-desktop to me named as
        #   their respective rule in kano-profile with the following pattern:
        #
        #         [rule_name]-background[name_pattern]
        #         e.g. [arcade_hall]-background[-4-3.png]
        environments = calculate_badges()['environments']['all']
        for environment, attributes in environments.iteritems():
            try:
                self.images[environment]['unlocked'] = attributes['achieved']
            except:
                pass
Exemplo n.º 3
0
    def _populate_environment_structures(self, conf_data, env_cat):
        """ Populates internal structures related to environments (backgrounds)
        :param conf_data: YAML format configuration structure read from file
        """
        # TODO conf_data is not used any more in this function, maybe remove it
        envirs = calculate_badges()

        for _, env in envirs[self.env_label]['all'].iteritems():
            env_obj = AvatarEnvironment.from_data(env)
            env_cat.add_item(env_obj)
Exemplo n.º 4
0
def filter_item_info():
    '''This is a dictionary of the names and the corresponding
    bg colour, badge description etc.
    '''
    badge_dictionary = calculate_badges()['badges']
    badge_list = []

    for category, cat_dict in badge_dictionary.iteritems():
        for filename, item_dict in cat_dict.iteritems():
            if 'order' not in item_dict:
                item_dict['order'] = 0
            item_dict['category'] = category
            item_dict['name'] = filename

            badge_list.append(item_dict)

    badge_list = sorted(badge_list, key=lambda k: k['order'], reverse=False)

    return badge_list
Exemplo n.º 5
0
def filter_item_info():
    '''This is a dictionary of the names and the corresponding
    bg colour, badge description etc.
    '''
    badge_dictionary = calculate_badges()['badges']
    badge_list = []

    for category, cat_dict in badge_dictionary.iteritems():
        for filename, item_dict in cat_dict.iteritems():
            if 'order' not in item_dict:
                item_dict['order'] = 0
            item_dict['category'] = category
            item_dict['name'] = filename

            badge_list.append(item_dict)

    badge_list = sorted(badge_list, key=lambda k: k['order'], reverse=False)

    return badge_list