コード例 #1
0
ファイル: factory.py プロジェクト: project-owner/Peppy
 def create_arrow_button(self, bb, name, key, location, label_text, image_area=40):
     """ Create Arrow button (e.g. Left, Next Page etc.)
     
     :param bb: bounding box
     :param name: button name
     :param key: keyboard key associated with button
     :param location: image location inside of bounding box
     :param label_text: button label text
     :param image_area: percentage of height occupied by button image
     
     :return: arrow button
     """
     s = State()
     s.name = name
     s.bounding_box = bb
     s.keyboard_key = key
     s.bgr = self.config[COLORS][COLOR_DARK]
     s.show_bgr = True
     s.show_img = True
     s.show_label = True
     s.image_location = location
     s.label_location = CENTER
     s.image_area_percent = image_area
     s.label_text_height = 44
     s.l_name = label_text
     s.auto_update = True
     s.text_color_normal = self.config[COLORS][COLOR_BRIGHT]
     s.text_color_selected = self.config[COLORS][COLOR_CONTRAST]
     s.text_color_disabled = self.config[COLORS][COLOR_MEDIUM]
     s.text_color_current = s.text_color_normal
     self.set_state_icons(s)
     b = Button(self.util, s)
     return b
コード例 #2
0
ファイル: factory.py プロジェクト: GregoryWest501/Peppy
    def get_icon_bounding_box(self,
                              constr,
                              location,
                              image_area,
                              image_size,
                              padding,
                              show_label=True):
        """ Create icon bounding box

        :param constr: bounding box
        :param location: image location
        :param image_area: image area in bounding box
        :param image_size: image size inside of image area
        :param padding: padding
        """
        s = State()
        s.show_img = True
        s.show_label = show_label
        s.image_location = location
        s.image_area_percent = image_area
        image_size_percent = image_size
        s.bounding_box = constr
        s.padding = padding
        layout = ButtonLayout(s)
        box = layout.image_rectangle
        box.h = (box.h / 100) * image_size_percent

        return box
コード例 #3
0
ファイル: factory.py プロジェクト: GregoryWest501/Peppy
    def create_arrow_button(self,
                            bb,
                            name,
                            key,
                            location,
                            label_text,
                            image_area,
                            image_size,
                            arrow_labels=True,
                            rest_command=None):
        """ Create Arrow button (e.g. Left, Next Page etc.)
        
        :param bb: bounding box
        :param name: button name
        :param key: keyboard key associated with button
        :param location: image location inside of bounding box
        :param label_text: button label text
        :param image_area: percentage of height occupied by button image
        :param arrow_labels: show arrow label or not
        :param rest_command: REST API command assigned to the button

        :return: arrow button
        """
        s = State()
        s.name = name
        s.bounding_box = bb
        s.keyboard_key = key
        s.bgr = self.config[BACKGROUND][FOOTER_BGR_COLOR]
        s.show_bgr = True
        s.show_img = True
        if arrow_labels:
            s.show_label = True
        else:
            s.show_label = False
        s.image_location = location
        s.label_location = CENTER
        s.label_text_height = 40
        s.l_name = label_text
        s.auto_update = True
        s.image_size_percent = image_area / 100
        s.image_area_percent = image_area
        s.text_color_normal = self.config[COLORS][COLOR_BRIGHT]
        s.text_color_selected = self.config[COLORS][COLOR_CONTRAST]
        s.text_color_disabled = self.config[COLORS][COLOR_MEDIUM]
        s.text_color_current = s.text_color_normal
        if rest_command:
            s.rest_commands = [rest_command]
        self.set_state_icons(s)
        if image_size != 100:
            self.resize_image(s, image_size)
        b = Button(self.util, s)
        return b