示例#1
0
class CdDrivesScreen(Screen):
    """ File Browser Screen """
    def __init__(self, util, listeners, voice_assistant):
        """ Initializer
        
        :param util: utility object
        :param listeners: file browser listeners
        """
        self.util = util
        self.config = util.config
        self.cdutil = CdUtil(util)
        self.factory = Factory(util)
        self.bounding_box = util.screen_rect
        layout = BorderLayout(self.bounding_box)
        layout.set_percent_constraints(PERCENT_TOP_HEIGHT,
                                       PERCENT_BOTTOM_HEIGHT, 0, 0)
        Screen.__init__(self, util, "", PERCENT_TOP_HEIGHT, voice_assistant,
                        "cd_drives_screen_title", True, layout.TOP)

        self.cd_drive_id = self.config[CD_PLAYBACK][CD_DRIVE_ID]
        self.cd_track = self.config[CD_PLAYBACK][CD_TRACK]
        self.cd_track_time = self.config[CD_PLAYBACK][CD_TRACK_TIME]
        self.screen_title.set_text(self.config[LABELS][KEY_CD_DRIVES])

        self.cd_drives_menu = CdDrivesMenu(util, layout.CENTER,
                                           listeners[KEY_CD_TRACKS])
        drives_info = self.cdutil.get_cd_drives_info()
        l = self.cd_drives_menu.get_layout(drives_info)
        bb = l.get_next_constraints()
        drives = self.cdutil.get_cd_drives(self.font_size, (bb.w, bb.h))
        self.cd_drives_menu.set_items(drives, 0, listeners[KEY_CD_TRACKS])

        for b in self.cd_drives_menu.buttons.values():
            b.parent_screen = self

        Container.add_component(self, self.cd_drives_menu)

        factory = Factory(util)
        self.menu_buttons = factory.create_home_player_buttons(
            self, self.layout.BOTTOM, listeners)
        self.home_button = self.menu_buttons[0]
        self.player_button = self.menu_buttons[1]

    def add_screen_observers(self, update_observer, redraw_observer):
        """ Add screen observers
        
        :param update_observer: observer for updating the screen
        :param redraw_observer: observer to redraw the whole screen
        """
        Screen.add_screen_observers(self, update_observer, redraw_observer)

        self.cd_drives_menu.add_menu_observers(update_observer,
                                               redraw_observer)
        for b in self.menu_buttons:
            self.add_button_observers(b, update_observer, redraw_observer)
示例#2
0
    def __init__(self, util, listeners, voice_assistant):
        """ Initializer
        
        :param util: utility object
        :param listeners: file browser listeners
        """
        self.util = util
        self.config = util.config
        self.cdutil = CdUtil(util)
        self.factory = Factory(util)
        self.bounding_box = util.screen_rect
        layout = BorderLayout(self.bounding_box)
        layout.set_percent_constraints(PERCENT_TOP_HEIGHT,
                                       PERCENT_BOTTOM_HEIGHT, 0, 0)
        Screen.__init__(self, util, "", PERCENT_TOP_HEIGHT, voice_assistant,
                        "cd_drives_screen_title", True, layout.TOP)

        self.cd_drive_id = self.config[CD_PLAYBACK][CD_DRIVE_ID]
        self.cd_track = self.config[CD_PLAYBACK][CD_TRACK]
        self.cd_track_time = self.config[CD_PLAYBACK][CD_TRACK_TIME]
        self.screen_title.set_text(self.config[LABELS][KEY_CD_DRIVES])

        self.cd_drives_menu = CdDrivesMenu(util, layout.CENTER,
                                           listeners[KEY_CD_TRACKS])
        drives_info = self.cdutil.get_cd_drives_info()
        l = self.cd_drives_menu.get_layout(drives_info)
        bb = l.get_next_constraints()
        drives = self.cdutil.get_cd_drives(self.font_size, (bb.w, bb.h))
        self.cd_drives_menu.set_items(drives, 0, listeners[KEY_CD_TRACKS])

        for b in self.cd_drives_menu.buttons.values():
            b.parent_screen = self

        self.add_menu(self.cd_drives_menu)

        self.navigator = CdDrivesNavigator(util, self.layout.BOTTOM, listeners)
        self.navigator.get_button_by_name(KEY_HOME).set_selected(True)
        self.add_navigator(self.navigator)
        self.link_borders()
示例#3
0
文件: cddrives.py 项目: Rucia1/Peppy
    def __init__(self, util, listeners, voice_assistant):
        """ Initializer
        
        :param util: utility object
        :param listeners: file browser listeners
        """
        self.util = util
        self.config = util.config
        self.cdutil = CdUtil(util)
        self.factory = Factory(util)
        self.bounding_box = self.config[SCREEN_RECT]
        layout = BorderLayout(self.bounding_box)
        layout.set_percent_constraints(PERCENT_TOP_HEIGHT,
                                       PERCENT_BOTTOM_HEIGHT, 0, 0)
        Screen.__init__(self, util, "", PERCENT_TOP_HEIGHT, voice_assistant,
                        "file_browser_screen_title", True, layout.TOP)
        color_dark_light = self.config[COLORS][COLOR_DARK_LIGHT]

        self.cd_drive_id = self.config[CD_PLAYBACK][CD_DRIVE_ID]
        self.cd_track = self.config[CD_PLAYBACK][CD_TRACK]
        self.cd_track_time = self.config[CD_PLAYBACK][CD_TRACK_TIME]
        self.screen_title.set_text(self.config[LABELS][KEY_CD_DRIVES])

        self.cd_drives_menu = CdDrivesMenu(None, util, (0, 0, 0),
                                           layout.CENTER,
                                           listeners[KEY_CD_TRACKS])
        drives_info = self.cdutil.get_cd_drives_info()
        l = self.cd_drives_menu.get_layout(drives_info)
        bb = l.get_next_constraints()
        drives = self.cdutil.get_cd_drives(self.font_size, (bb.w, bb.h))
        self.cd_drives_menu.set_items(drives, 0, listeners[KEY_CD_TRACKS])
        Container.add_component(self, self.cd_drives_menu)

        factory = Factory(util)
        self.menu_buttons = factory.create_home_player_buttons(
            self, self.layout.BOTTOM, listeners)
        self.home_button = self.menu_buttons[0]
        self.player_button = self.menu_buttons[1]