Ejemplo n.º 1
0
    def _create_start_up_image(self):
        """We check what has been saved on kano-profile, and we use a default if
        something hasn't been specified
        """
        logger.debug("Creating start up image")

        # This is a dictionary so we can eaily reset the menus
        self.saved_selected_list = {}

        char, item = get_avatar()
        env = get_environment()

        item[self._parser.char_label] = char
        item[self._parser.env_label] = env

        self._parser.char_select(char)

        for category in self._cat_menu.categories:
            # TODO this is temporary for the kano-content demo
            if category not in item:
                obj_name = None
            else:
                obj_name = item[category]
            logger.debug("loading obj_name = {}".format(obj_name))

            if obj_name and obj_name in self._parser.list_avail_objs(category):
                logger.debug("Loading saved object {} for category {}".format(obj_name, category))
            else:
                logger.debug("Object {} for category {} not available".format(obj_name, category))

            # object_list.append(obj_name)
            self.select_pop_up_in_category(category, obj_name)
            self.menus[category]["pop_up"].hide()
            self.saved_selected_list[category] = obj_name
Ejemplo n.º 2
0
    def __init__(self, parser):
        Gtk.Fixed.__init__(self)

        self._parser = parser
        char, item = get_avatar()
        self._parser.char_select(char)
        self._cat_menu = CategoryMenu(self._parser)
        self._cat_menu.connect("category_item_selected", self.launch_pop_up_menu)
        self.categories = self._cat_menu.categories

        self.cat_position_x = 0
        self.cat_position_y = 0
        # Added an offset of 18 px to support the scrollbar category menu
        self.pop_up_pos_x = self.cat_position_x + self._cat_menu.item_width + 5 + 18
        self.pop_up_pos_y = self.cat_position_y
        self.put(self._cat_menu, 0, 0)

        self._initialise_pop_up_menus()
        self._create_start_up_image()
        self.show_all()
Ejemplo n.º 3
0
    def _create_start_up_image(self, char_item_tup=None, env=None):
        '''We check what has been saved on kano-profile, and we use a default if
        something hasn't been specified
        '''
        logger.debug("Creating start up image")

        # This is a dictionary so we can eaily reset the menus
        self.saved_selected_list = {}

        if char_item_tup is None:
            char, item = get_avatar()
        else:
            char, item = char_item_tup

        if env is None:
            env = get_environment()

        item[self._parser.char_label] = char
        item[self._parser.env_label] = env

        self._parser.char_select(char)

        for category in self._cat_menu.categories:
            # TODO this is temporary for the kano-content demo
            if category not in item:
                obj_name = None
            else:
                obj_name = item[category]
            logger.debug("loading obj_name = {}".format(obj_name))

            if obj_name and obj_name in self._parser.list_avail_objs(category):
                logger.debug("Loading saved object {} for category {}".format(
                    obj_name, category))
            else:
                logger.debug("Object {} for category {} not available".format(
                    obj_name, category))

            # object_list.append(obj_name)
            self.select_pop_up_in_category(category, obj_name)
            self.menus[category]['pop_up'].hide()
            self.saved_selected_list[category] = obj_name
Ejemplo n.º 4
0
    def __init__(self, parser, no_sync=False):
        Gtk.Fixed.__init__(self)

        self._parser = parser
        char, item = get_avatar(sync=not no_sync)
        self._parser.char_select(char)
        self._cat_menu = CategoryMenu(self._parser)
        self._cat_menu.connect('category_item_selected',
                               self.launch_pop_up_menu)
        self.categories = self._cat_menu.categories

        self.cat_position_x = 0
        self.cat_position_y = 0
        # Added an offset of 18 px to support the scrollbar category menu
        self.pop_up_pos_x = (self.cat_position_x + self._cat_menu.item_width +
                             5 + 18)
        self.pop_up_pos_y = self.cat_position_y
        self.put(self._cat_menu, 0, 0)

        self._initialise_pop_up_menus()
        self._create_start_up_image(char_item_tup=(char, item))
        self.show_all()