Ejemplo n.º 1
0
 def create_station_button(self, s, bb, action=None):
     """ Create station button
     
     :param s: button state
     :param bb: bounding box
     :param action: event listener
     
     :return: station logo button
     """
     state = State()
     state.icon_base = s.icon_base
     state.index_in_page = s.index_in_page
     state.index = s.index
     state.scaled = getattr(s, "scaled", False)
     state.icon_base_scaled = s.icon_base_scaled
     state.name = "station_menu." + s.name
     state.l_name = s.l_name
     state.url = s.url
     state.keyboard_key = kbd_keys[KEY_SELECT]
     state.bounding_box = bb
     state.img_x = bb.x
     state.img_y = bb.y
     state.auto_update = False
     state.show_bgr = True
     state.show_img = True
     state.image_align_v = V_ALIGN_BOTTOM
     button = Button(self.util, state)
     button.add_release_listener(action)
     return button        
Ejemplo n.º 2
0
    def create_station_button(self, s, bb, action=None):
        """ Create station button

        :param s: button state
        :param bb: bounding box
        :param action: event listener

        :return: station logo button
        """
        state = State()
        state.icon_base = s.icon_base
        state.index_in_page = s.index_in_page
        state.index = s.index
        state.genre = s.genre
        state.scaled = getattr(s, "scaled", False)
        state.icon_base_scaled = s.icon_base_scaled
        state.name = "station_menu." + s.name
        state.l_name = s.l_name
        state.url = s.url
        state.keyboard_key = kbd_keys[KEY_SELECT]
        state.bounding_box = bb
        state.img_x = bb.x
        state.img_y = bb.y
        state.auto_update = False
        state.show_bgr = True
        state.show_img = True
        state.image_align_v = V_ALIGN_BOTTOM
        button = Button(self.util, state)
        button.add_release_listener(action)
        return button
Ejemplo n.º 3
0
    def get_center_button(self, s):
        """ Create the center button

        :param s: button state

        :return: station logo button
        """
        bb = Rect(self.layout.CENTER.x + 1, self.layout.CENTER.y + 1,
                  self.layout.CENTER.w - 1, self.layout.CENTER.h - 1)
        if not hasattr(s, "icon_base"):
            self.util.add_icon(s)

        state = State()
        state.icon_base = s.icon_base
        self.factory.set_state_scaled_icons(s, bb)
        state.index = s.index
        state.genre = s.genre
        state.scaled = getattr(s, "scaled", False)
        state.icon_base_scaled = s.icon_base_scaled
        state.name = "station." + s.name
        state.l_name = s.l_name
        state.url = s.url
        state.keyboard_key = kbd_keys[KEY_SELECT]
        state.bounding_box = bb
        state.img_x = bb.x
        state.img_y = bb.y
        state.auto_update = False
        state.show_bgr = True
        state.show_img = True
        state.logo_image_path = s.image_path
        state.image_align_v = V_ALIGN_BOTTOM
        state.comparator_item = self.current_state.comparator_item
        button = Button(self.util, state)

        img = button.components[1]
        self.logo_button_content = (img.image_filename, img.content,
                                    img.content_x, img.content_y)

        return button