示例#1
0
    def _build_menu(category):
        """
        Builds menu options for a category

        May return None if errors occured
        """
        is_positions = category == FilterSprite.POS

        selections = FilterSprite._sprite_map.get(category, None)
        if selections is None:
            return None

        sorted_keys = sorted(selections.keys())

        menu = []

        # now the items
        for code in sorted_keys:
            name = selections[code]
            if is_positions and type(name) is not str:
                menu.append((StaticSprite.lean_tostring(name), code))

            else:
                menu.append((name, code))

        return menu
示例#2
0
    def _status(self, useheader, headerstring, shownose, showemote):
        """
        Builds string representation of this Filter according to given
        status props
        :param useheader: True will use the block header from menutils,
            False will not
        :param headerstring: the string to use in the header
        :param shownose: True will show the nose part of the filter, False
            will not
        :param showemote: True will show the emote part of the filter, False
            will not
        """
        # setup initial strings
        if useheader:
            msg = [menutils.header(headerstring)]
        else:
            msg = [self._tab + headerstring]

        # lean and position check
        if self.position is None:
            position = None
            is_lean = None
        elif self.is_lean:
            position = StaticSprite.lean_tostring(self.position)
            is_lean = True
        else:
            position = self.position
            is_lean = self.is_lean

        # now add each filter piece
        self.__fmt_flt(msg, "Position:", position)
        self.__fmt_flt(msg, "Is Lean:", is_lean)
        self.__fmt_flt(msg, "Eyes:", self.eyes)
        self.__fmt_flt(msg, "Eyebrows:", self.eyebrows)
        if shownose:
            self.__fmt_flt(msg, "Nose:", self.nose)
        self.__fmt_flt(msg, "Blush:", self.blush)
        self.__fmt_flt(msg, "Tears:", self.tears)
        self.__fmt_flt(msg, "Sweatdrop:", self.sweatdrop)
        if showemote:
            self.__fmt_flt(msg, "Emote:", self.emote)
        self.__fmt_flt(msg, "Mouth:", self.mouth)

        return "".join(msg)