def __init__(self, util, listener): """ Initializer :param util: utility object :param listener: screen menu event listener """ Screen.__init__(self, util, KEY_GENRE) self.genre_menu = GenreMenu(util, (0, 0, 0), self.layout.CENTER) self.genre_menu.add_listener(listener) self.add_menu(self.genre_menu)
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.abc_menu.add_menu_observers(update_observer, redraw_observer) self.navigator.add_observers(update_observer, redraw_observer)
def __init__(self, util, listeners): """ Initializer :param util: utility object :param listener: screen menu event listener """ Screen.__init__(self, util, KEY_LANGUAGE) self.language_menu = LanguageMenu(util, (0, 0, 0), self.layout.CENTER) self.language_menu.add_listener(listeners) self.add_menu(self.language_menu)
def __init__(self, util, listeners, voice_assistant): """ Initializer :param util: utility object :param listener: screen menu event listener """ self.util = util config = util.config screen_layout = BorderLayout(util.screen_rect) top = int((util.screen_rect.h * PERCENT_SAVERS) / 100) bottom = util.screen_rect.h - top screen_layout.set_pixel_constraints(top, bottom, 0, 0) layout = BorderLayout(screen_layout.TOP) layout.set_percent_constraints(PERCENT_TOP_HEIGHT, 0, 0, 0) Screen.__init__(self, util, "", PERCENT_TOP_HEIGHT, voice_assistant, "saver_title", title_layout=layout.TOP) factory = Factory(util) self.bounding_box = util.screen_rect self.saver_menu = SaverMenu(util, None, layout.CENTER) self.add_component(self.saver_menu) b = config[BACKGROUND][HEADER_BGR_COLOR] c = config[COLORS][COLOR_CONTRAST] font_size = (layout.TOP.h * PERCENT_TITLE_FONT) / 100.0 label = config[LABELS][SCREENSAVER] self.screen_title.set_text(label) layout = BorderLayout(screen_layout.BOTTOM) layout.set_percent_constraints(PERCENT_DELAY_TITLE, PERCENT_DELAY_TITLE, 0, 0) self.delay_menu = SaverDelayMenu(util, None, layout.CENTER) self.add_component(self.delay_menu) layout.TOP.y += 2 layout.TOP.h -= 2 self.saver_delay_title = factory.create_output_text( "saver_delay_title", layout.TOP, b, c, int(font_size)) label = config[LABELS][DELAY] self.saver_delay_title.set_text(label) self.add_component(self.saver_delay_title) b = self.config[BACKGROUND][FOOTER_BGR_COLOR] self.navigator = SaverNavigator(util, listeners, b, layout.BOTTOM) self.add_component(self.navigator) self.top_menu_enabled = True
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.abc_menu.add_menu_observers(update_observer, redraw_observer) for b in self.buttons: self.add_button_observers(b, update_observer, redraw_observer)
def add_screen_observers(self, update_observer, redraw_observer, title_to_json): """ 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, title_to_json) self.add_button_observers(self.shutdown_button, update_observer, redraw_observer=None) self.shutdown_button.add_cancel_listener(redraw_observer) self.screen_title.add_listener(title_to_json) self.add_button_observers(self.play_button, update_observer, redraw_observer=None) self.add_button_observers(self.home_button, update_observer, redraw_observer, release=False) self.add_button_observers(self.info_button, update_observer, redraw_observer) self.info_popup.add_menu_observers(update_observer, redraw_observer) self.add_button_observers(self.left_button, update_observer, redraw_observer, release=False) self.add_button_observers(self.right_button, update_observer, redraw_observer, release=False) self.add_button_observers(self.page_down_button, update_observer, redraw_observer) self.add_button_observers(self.page_up_button, update_observer, redraw_observer) self.volume.add_slide_listener(update_observer) self.volume.add_knob_listener(update_observer) self.volume.add_press_listener(update_observer) self.volume.add_motion_listener(update_observer) self.add_button_observers(self.genres_button, update_observer, redraw_observer, release=False) self.station_menu.add_listener(update_observer) self.station_menu.add_change_logo_listener(redraw_observer)
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.saver_menu.add_menu_observers(update_observer, redraw_observer, release=False) self.saver_menu.add_move_listener(redraw_observer) self.navigator.add_observers(update_observer, redraw_observer)
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.navigator.add_observers(update_observer, redraw_observer) self.book_menu.update_observer = update_observer self.book_menu.redraw_observer = redraw_observer self.book_menu.add_menu_loaded_listener(redraw_observer) self.book_menu.add_menu_observers(update_observer, redraw_observer) self.add_loading_listener(redraw_observer)
def __init__(self, util, listeners, voice_assistant, state): """ 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 self.layout = BorderLayout(self.bounding_box) self.layout.set_percent_constraints(PERCENT_TOP_HEIGHT, PERCENT_BOTTOM_HEIGHT, 0, 0) Screen.__init__(self, util, "", PERCENT_TOP_HEIGHT, voice_assistant, "cd_tracks_screen_title", True, self.layout.TOP) color_dark_light = self.config[COLORS][COLOR_DARK_LIGHT] self.current_cd_drive_name = self.config[CD_PLAYBACK][CD_DRIVE_NAME] self.current_cd_drive_id = self.config[CD_PLAYBACK][CD_DRIVE_ID] self.filelist = self.get_filelist() self.file_menu = FileMenu(self.filelist, util, None, (0, 0, 0), self.layout.CENTER, align=ALIGN_LEFT) self.go_cd_player = listeners[KEY_PLAYER] self.file_menu.add_play_file_listener(self.play_track) Container.add_component(self, self.file_menu) listeners[GO_LEFT_PAGE] = self.file_menu.page_down listeners[GO_RIGHT_PAGE] = self.file_menu.page_up listeners[KEY_EJECT] = self.eject_cd listeners[KEY_REFRESH] = self.refresh_tracks connected_cd_drives = self.cdutil.get_cd_drives_number() self.navigator = CdTracksNavigator(util, connected_cd_drives, self.layout.BOTTOM, listeners, color_dark_light) Container.add_component(self, self.navigator) self.file_menu.add_left_number_listener( self.navigator.left_button.change_label) self.file_menu.add_right_number_listener( self.navigator.right_button.change_label) self.file_menu.update_buttons() self.page_turned = False self.animated_title = True
def __init__(self, util, listeners, voice_assistant): """ Initializer :param util: utility object :param listener: screen menu event listener """ self.util = util config = util.config screen_layout = BorderLayout(config[SCREEN_RECT]) top = int((config[SCREEN_RECT].h * PERCENT_SAVERS) / 100) bottom = config[SCREEN_RECT].h - top screen_layout.set_pixel_constraints(top, bottom, 0, 0) layout = BorderLayout(screen_layout.TOP) layout.set_percent_constraints(PERCENT_TOP_HEIGHT, 0, 0, 0) Screen.__init__(self, util, "", PERCENT_TOP_HEIGHT, voice_assistant, "saver_title", title_layout=layout.TOP) factory = Factory(util) self.bounding_box = config[SCREEN_RECT] self.bgr = (0, 0, 0) self.saver_menu = SaverMenu(util, (0, 0, 0), layout.CENTER) self.add_component(self.saver_menu) d = config[COLORS][COLOR_DARK_LIGHT] c = config[COLORS][COLOR_CONTRAST] font_size = (layout.TOP.h * PERCENT_TITLE_FONT)/100.0 label = config[LABELS][SCREENSAVER] self.screen_title.set_text(label) layout = BorderLayout(screen_layout.BOTTOM) layout.set_percent_constraints(PERCENT_DELAY_TITLE, PERCENT_DELAY_TITLE, 0, 0) self.delay_menu = SaverDelayMenu(util, (0, 0, 0), layout.CENTER) self.add_component(self.delay_menu) layout.TOP.y += 1 layout.TOP.h -= 1 self.saver_delay_title = factory.create_output_text("saver_delay_title", layout.TOP, d, c, int(font_size)) label = config[LABELS][DELAY] self.saver_delay_title.set_text(label) self.add_component(self.saver_delay_title) buttons = factory.create_home_player_buttons(self, layout.BOTTOM, listeners) self.home_button = buttons[0] self.player_button = buttons[1] self.top_menu_enabled = True
def __init__(self, util, change_language, listeners, voice_assistant): """ Initializer :param util: utility object :param listener: screen menu event listener """ Screen.__init__(self, util, LANGUAGE, PERCENT_TOP_HEIGHT, voice_assistant) self.language_menu = LanguageMenu(util, None, self.layout.CENTER) self.language_menu.add_listener(change_language) self.add_menu(self.language_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.file_menu.add_menu_observers(update_observer, redraw_observer=None, release=False) self.file_menu.add_change_folder_listener(redraw_observer) self.file_menu.add_menu_navigation_listeners(redraw_observer) self.file_menu.add_left_number_listener(redraw_observer) self.file_menu.add_right_number_listener(redraw_observer) self.navigator.add_observers(update_observer, redraw_observer)
def __init__(self, util, listeners, rows, columns, voice_assistant, d=None, turn_page=None, page_in_title=True, show_loading=False): """ Initializer :param util: utility object :param listeners: file browser listeners :param rows: menu rows :param d: dictionary with menu button flags :param turn_page: turn page callback :param util: utility object """ self.util = util self.config = util.config self.factory = Factory(util) self.bounding_box = util.screen_rect self.player = None self.turn_page = turn_page self.page_in_title = page_in_title self.show_loading = show_loading self.cache = Cache(self.util) self.layout = BorderLayout(self.bounding_box) self.layout.set_percent_constraints(PERCENT_TOP_HEIGHT, PERCENT_BOTTOM_HEIGHT, 0, 0) Screen.__init__(self, util, "", PERCENT_TOP_HEIGHT, voice_assistant, "menu_screen_screen_title", True, self.layout.TOP) self.menu_layout = self.layout.CENTER if d: self.menu_button_layout = self.get_menu_button_layout(d) self.img_rect = self.menu_button_layout.image_rectangle listeners[GO_LEFT_PAGE] = self.previous_page listeners[GO_RIGHT_PAGE] = self.next_page self.total_pages = 0 self.current_page = 1 self.menu = None
def __init__(self, util, listeners, voice_assistant): """ Initializer :param util: utility object :param listener: screen menu event listener :param voice_assistant: voice assistant """ Screen.__init__(self, util, COLLECTION, PERCENT_TOP_HEIGHT, voice_assistant) self.set_loading(text=util.config[LABELS][LOADING]) self.menu = CollectionMenu(util, (0, 0, 0, 0), self.layout.CENTER, font_size=self.font_size) self.reset_loading() self.menu.add_listener(listeners[COLLECTION]) self.add_component(self.menu) self.navigator = CollectionNavigator(util, listeners, self.layout.BOTTOM) self.add_component(self.navigator)
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.saver_menu.add_menu_observers(update_observer, redraw_observer, release=False) self.saver_menu.add_move_listener(redraw_observer) self.delay_menu.add_menu_observers(update_observer, redraw_observer, release=False) self.delay_menu.add_move_listener(redraw_observer) self.add_button_observers(self.home_button, update_observer, redraw_observer, release=False) self.add_button_observers(self.player_button, update_observer, redraw_observer, release=False)
def __init__(self, util, listeners, voice_assistant): """ Initializer :param util: utility object :param listener: screen menu event listener """ Screen.__init__(self, util, KEY_HOME, PERCENT_TOP_HEIGHT, voice_assistant) self.home_menu = HomeMenu(util, None, self.layout.CENTER) self.home_menu.add_listener(listeners[KEY_MODE]) self.add_menu(self.home_menu) c = self.config[COLORS][COLOR_DARK_LIGHT] self.home_navigation_menu = HomeNavigatorMenu(util, listeners, c, self.layout.BOTTOM) self.add_menu(self.home_navigation_menu)
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 __init__(self, util, change_language, listeners, voice_assistant): """ Initializer :param util: utility object :param listener: screen menu event listener """ Screen.__init__(self, util, "", PERCENT_TOP_HEIGHT, voice_assistant) self.language_menu = LanguageMenu(util, None, self.layout.CENTER) self.language_menu.add_listener(change_language) self.add_menu(self.language_menu) config = util.config self.label = config[LABELS][LANGUAGE] lang = config[CURRENT][LANGUAGE] l_name = config[LABELS][lang] txt = self.label + ": " + l_name self.screen_title.set_text(txt) self.navigator = LanguageNavigator(util, self.layout.BOTTOM, listeners) self.add_navigator(self.navigator) self.link_borders()
def __init__(self, util, listeners, voice_assistant): """ Initializer :param util: utility object :param listener: screen menu event listener """ Screen.__init__(self, util, KEY_HOME, PERCENT_TOP_HEIGHT, voice_assistant) self.home_menu = HomeMenu(util, None, self.layout.CENTER) self.home_menu.add_listener(listeners[KEY_MODE]) self.add_menu(self.home_menu) self.navigator = HomeNavigator(util, self.layout.BOTTOM, listeners) self.add_navigator(self.navigator) self.link_borders() if self.home_menu.get_selected_item() == None: length = len(self.navigator.components) if length > 0: b = self.navigator.components[length - 1] b.set_selected(True)
def add_screen_observers(self, update_observer, redraw_observer, title_to_json, start_time_control=None, stop_time_control=None): """ Add screen observers :param update_observer: observer for updating the screen :param redraw_observer: observer to redraw the whole screen :param title_to_json: :param start_time_control: :param stop_time_control: """ self.update_observer = update_observer self.redraw_observer = redraw_observer Screen.add_screen_observers(self, update_observer, redraw_observer, title_to_json) self.add_button_observers(self.shutdown_button, update_observer, redraw_observer=None) self.shutdown_button.add_cancel_listener(redraw_observer) self.screen_title.add_listener(title_to_json) self.add_button_observers(self.play_button, update_observer, redraw_observer=None) self.add_button_observers(self.home_button, update_observer, redraw_observer) if self.order_button: self.add_button_observers(self.order_button, update_observer, redraw_observer) if self.info_button: self.add_button_observers(self.info_button, update_observer, redraw_observer) self.add_button_observers(self.left_button, update_observer, redraw_observer=None) self.left_button.add_label_listener(update_observer) self.add_button_observers(self.right_button, update_observer, redraw_observer=None) self.right_button.add_label_listener(update_observer) self.volume.add_slide_listener(update_observer) self.volume.add_knob_listener(update_observer) self.volume.add_press_listener(update_observer) self.volume.add_motion_listener(update_observer) if self.center_button: self.add_button_observers(self.center_button, update_observer, redraw_observer, press=False, release=False) if self.order_popup: self.order_popup.add_menu_observers(update_observer, redraw_observer) if self.info_popup: self.info_popup.add_menu_observers(update_observer, redraw_observer) if self.show_time_control: self.add_button_observers(self.time_volume_button, update_observer, redraw_observer, release=False) self.time_control.web_seek_listener = update_observer if start_time_control: self.time_control.add_start_timer_listener(start_time_control) if stop_time_control: self.time_control.add_stop_timer_listener(stop_time_control) self.time_control.slider.add_slide_listener(update_observer) self.time_control.slider.add_knob_listener(update_observer) self.time_control.slider.add_press_listener(update_observer) self.time_control.slider.add_motion_listener(update_observer)
def __init__(self, util, listeners, screen_title, show_arrow_labels=True, show_order=True, show_info=True, show_time_control=True, voice_assistant=None): """ Initializer :param util: utility object :param listeners: screen event listeners :param screen_title: screen title/id :param show_arrow_labels: True - show arrow lables, False - don't show :param show_order: True - show the order button/popup, False - don't show :param show_info: True - show the info button/popup, False - don't show :param show_time_control: True - show the time control, False - don't show :param voice_assistant: the voice assistant """ self.util = util self.config = util.config self.factory = Factory(util) self.player = listeners[KEY_PLAY] self.bounding_box = util.screen_rect self.show_order = show_order self.show_info = show_info self.show_time_control = show_time_control self.order_button = None self.info_button = None self.order_popup = None self.info_popup = None self.top_height = self.config[PLAYER_SCREEN][TOP_HEIGHT_PERCENT] self.bottom_height = self.config[PLAYER_SCREEN][BOTTOM_HEIGHT_PERCENT] self.button_height = self.config[PLAYER_SCREEN][BUTTON_HEIGHT_PERCENT] self.popup_width = self.config[PLAYER_SCREEN][POPUP_WIDTH_PERCENT] self.image_location = self.config[PLAYER_SCREEN][IMAGE_LOCATION] self.layout = self.get_layout() Screen.__init__(self, util, "", self.top_height, voice_assistant, screen_title, True, self.layout.TOP) self.layout = self.get_layout() self.custom_button = None self.center_button = None self.create_left_panel(self.layout, show_arrow_labels) self.create_right_panel(self.layout, show_arrow_labels) self.create_bottom_panel(self.layout.BOTTOM) self.player_screen = True self.animated_title = True self.arrow_keys = [ kbd_keys[KEY_LEFT], kbd_keys[KEY_RIGHT], kbd_keys[KEY_UP], kbd_keys[KEY_DOWN] ] self.player_keys = [kbd_keys[KEY_PLAY_PAUSE], kbd_keys[KEY_MUTE]] self.volume_keys = [kbd_keys[KEY_VOLUME_UP], kbd_keys[KEY_VOLUME_DOWN]] self.previous_next_keys = [ kbd_keys[KEY_PAGE_DOWN], kbd_keys[KEY_PAGE_UP] ] self.playlist = [] self.current_index = 0
def __init__(self, util, listeners, voice_assistant, timer_lock, start_timer_thread): """ Initializer :param util: utility object :param listeners: screen navigator listeners :param voice_assistant: voice assistant :param timer_lock: lock object :param start_timer_thread: start timer thread function """ self.util = util self.timer_lock = timer_lock self.start_timer_thread = start_timer_thread self.config = util.config self.screen_layout = BorderLayout(util.screen_rect) self.screen_layout.set_percent_constraints(PERCENT_TITLE, PERCENT_NAV_HEIGHT, 0, 0) Screen.__init__(self, util, "", PERCENT_NAV_HEIGHT, voice_assistant, "timer_title", title_layout=self.screen_layout.TOP) self.bounding_box = util.screen_rect label = self.config[LABELS][TIMER] self.screen_title.set_text(label) try: self.config[TIMER] except: self.config[TIMER] = {} c = GridLayout(self.screen_layout.CENTER) c.set_pixel_constraints(2, 1) layout = BorderLayout(c.get_next_constraints()) layout.set_percent_constraints(0, 0, PERCENT_CLOCK, 100 - PERCENT_CLOCK) gap = layout.h * 0.1 layout.LEFT.w -= gap * 3 layout.LEFT.h -= gap digits = util.image_util.get_flipclock_digits(layout.LEFT) change_codes = [HOURS_INCREMENT_SLEEP, MINUTES_INCREMENT_SLEEP, HOURS_DECREMENT_SLEEP, MINUTES_DECREMENT_SLEEP] self.sleep_menu = SleepMenu(util, layout, gap, digits, self.handle_button, timer_lock, self.sleep_change_callback, change_codes) self.sleep_menu.clock.select_key(self.sleep_menu.clock.h_top) self.active_key_menu = self.sleep_menu self.add_component(self.sleep_menu) self.menu_index = HOURS_INCREMENT_SLEEP self.sleep_menu.clock.add_change_listener(self.handle_clock_change) layout = BorderLayout(c.get_next_constraints()) layout.set_percent_constraints(0, 0, PERCENT_CLOCK, 100 - PERCENT_CLOCK) change_codes = [HOURS_INCREMENT_WAKE_UP, MINUTES_INCREMENT_WAKE_UP, HOURS_DECREMENT_WAKE_UP, MINUTES_DECREMENT_WAKE_UP] self.wake_up_menu = WakeUpMenu(util, layout, gap, digits, self.handle_button, timer_lock, self.wake_up_change_callback, change_codes) self.add_component(self.wake_up_menu) self.wake_up_menu.clock.add_change_listener(self.handle_clock_change) self.navigator = TimerNavigator(self.util, self.screen_layout.BOTTOM, listeners, self.config[COLORS][COLOR_DARK_LIGHT]) self.add_component(self.navigator) self.menu_functions = { HOURS_INCREMENT_SLEEP: self.sleep_menu.clock.increment_hours, MINUTES_INCREMENT_SLEEP: self.sleep_menu.clock.increment_minutes, HOURS_DECREMENT_SLEEP: self.sleep_menu.clock.decrement_hours, MINUTES_DECREMENT_SLEEP: self.sleep_menu.clock.decrement_minutes, HOURS_INCREMENT_WAKE_UP: self.wake_up_menu.clock.increment_hours, MINUTES_INCREMENT_WAKE_UP: self.wake_up_menu.clock.increment_minutes, HOURS_DECREMENT_WAKE_UP: self.wake_up_menu.clock.decrement_hours, MINUTES_DECREMENT_WAKE_UP: self.wake_up_menu.clock.decrement_minutes } self.clean_draw_update()
def __init__(self, listeners, util, get_current_playlist, voice_assistant, player_stop=None, arrow_labels=True, active_file_button=True, show_time_control=True, show_order=True, show_info=True): """ Initializer :param listeners: screen listeners :param util: utility object :param get_current_playlist: current playlist getter :param voice_assistant: voice assistant :param player_stop: stop player function """ self.util = util self.config = util.config self.cdutil = CdUtil(util) self.factory = Factory(util) self.image_util = util.image_util self.top_height = self.config[PLAYER_SCREEN][TOP_HEIGHT_PERCENT] self.bottom_height = self.config[PLAYER_SCREEN][BOTTOM_HEIGHT_PERCENT] self.button_height = self.config[PLAYER_SCREEN][BUTTON_HEIGHT_PERCENT] self.popup_width = self.config[PLAYER_SCREEN][POPUP_WIDTH_PERCENT] self.image_location = self.config[PLAYER_SCREEN][IMAGE_LOCATION] self.stop_player = player_stop self.get_current_playlist = get_current_playlist self.show_time_control = show_time_control self.bounding_box = util.screen_rect self.layout = self.get_layout() self.voice_assistant = voice_assistant Screen.__init__(self, util, "", self.top_height, voice_assistant, "file_player_screen_title", True, self.layout.TOP) self.layout = self.get_layout() self.create_left_panel(self.layout, listeners, arrow_labels) self.create_right_panel(self.layout, listeners, arrow_labels) if not active_file_button: listeners[AUDIO_FILES] = None self.file_button = self.factory.create_file_button( self.layout.CENTER, listeners[AUDIO_FILES]) self.add_component(self.file_button) self.audio_files = self.get_audio_files() self.home_button.add_release_listener(listeners[KEY_HOME]) self.shutdown_button.add_release_listener(listeners[KEY_SHUTDOWN]) self.left_button.add_release_listener(self.go_left) self.right_button.add_release_listener(self.go_right) self.show_order = show_order self.show_info = show_info self.order_button = None self.info_button = None self.order_popup = None self.info_popup = None self.playback_order = self.config[PLAYER_SETTINGS][PLAYBACK_ORDER] self.bottom_center_layout = self.layout.BOTTOM if self.show_order or self.show_info: self.start_screensaver = listeners[SCREENSAVER] self.go_info_screen = listeners[KEY_INFO] self.add_popups() self.volume = self.factory.create_volume_control( self.bottom_center_layout) self.volume.add_slide_listener( self.get_listener(listeners, KEY_SET_VOLUME)) self.volume.add_slide_listener( self.get_listener(listeners, KEY_SET_CONFIG_VOLUME)) self.volume.add_slide_listener( self.get_listener(listeners, KEY_SET_SAVER_VOLUME)) self.volume.add_knob_listener(self.get_listener(listeners, KEY_MUTE)) self.volume_visible = False self.volume.set_visible(self.volume_visible) self.add_component(self.volume) if self.show_time_control: self.time_control = self.factory.create_time_control( self.bottom_center_layout) if KEY_SEEK in listeners.keys(): self.time_control.add_seek_listener(listeners[KEY_SEEK]) self.play_button.add_listener(PAUSE, self.time_control.pause) self.play_button.add_listener(KEY_PLAY, self.time_control.resume) if self.config[PLAYER_SETTINGS][PAUSE]: self.time_control.pause() self.add_component(self.time_control) self.left_button.add_release_listener( self.play_button.draw_default_state) self.right_button.add_release_listener( self.play_button.draw_default_state) self.play_listeners = [] self.add_play_listener(self.get_listener(listeners, KEY_PLAY)) self.current_folder = self.config[FILE_PLAYBACK][CURRENT_FOLDER] self.file_button.state.cover_art_folder = self.util.file_util.get_cover_art_folder( self.current_folder) self.playlist_size = 0 self.player_screen = True self.cd_album = None self.animated_title = True if self.order_popup: Container.add_component(self, self.order_popup) if self.info_popup: Container.add_component(self, self.info_popup)
def __init__(self, util, listeners, voice_assistant): """ Initializer :param util: utility object :param listeners: listeners :param voice_assistant: voice assistant """ self.util = util self.config = util.config self.factory = Factory(util) self.check_internet_connectivity = listeners[KEY_CHECK_INTERNET] self.go_home = listeners[KEY_HOME] self.set_modes = listeners[KEY_SET_MODES] self.linux = self.config[LINUX_PLATFORM] self.wifi_util = WiFiUtil(util) self.bluetooth_util = self.util.get_bluetooth_util() self.bounding_box = util.screen_rect layout = BorderLayout(self.bounding_box) layout.set_percent_constraints(PERCENT_TOP_HEIGHT, PERCENT_BOTTOM_HEIGHT, 0, 0) rows = 7 if self.linux and self.config[USAGE][USE_BLUETOOTH]: rows = 7 else: rows = 6 columns = 1 d = [rows, columns] MenuScreen.__init__(self, util, listeners, rows, columns, voice_assistant, d, None, page_in_title=False, show_loading=False) self.title = self.config[LABELS]["network"] self.set_title(1) center_layout = BorderLayout(self.menu_layout) center_layout.set_percent_constraints(0, 0, 47, 0) left_layout = center_layout.LEFT right_layout = center_layout.CENTER label_layout = GridLayout(left_layout) label_layout.set_pixel_constraints(rows, columns) label_layout.get_next_constraints() value_layout = GridLayout(right_layout) value_layout.set_pixel_constraints(rows, columns) value_layout.get_next_constraints() self.network_panel = Container(util, self.menu_layout) rect = pygame.Rect(self.menu_layout.x, self.menu_layout.y + 1, self.menu_layout.w, self.menu_layout.h - 1) b = util.config[BACKGROUND][MENU_BGR_COLOR] bgr = Component(util, rect, 0, 0, self.menu_layout, bgr=b) bgr.name = "network.panel.bgr" self.network_panel.add_component(bgr) self.internet_label = self.add_label(label_layout, self.network_panel, 1) self.ethernet_label = self.add_label(label_layout, self.network_panel, 2) self.wifi_network_label = self.add_label(label_layout, self.network_panel, 3) self.wifi_ip_label = self.add_label(label_layout, self.network_panel, 4) if self.linux and self.config[USAGE][USE_BLUETOOTH]: self.bluetooth_label = self.add_label(label_layout, self.network_panel, 5) self.internet = self.add_value(value_layout, self.network_panel, 1) self.ethernet_ip = self.add_value(value_layout, self.network_panel, 2) self.wifi_network = self.add_value(value_layout, self.network_panel, 3) self.wifi_ip = self.add_value(value_layout, self.network_panel, 4) if self.linux and self.config[USAGE][USE_BLUETOOTH]: self.bluetooth = self.add_value(value_layout, self.network_panel, 5) self.add_component(self.network_panel) listeners[KEY_REFRESH] = self.set_current listeners[KEY_DISCONNECT] = self.disconnect_wifi listeners[KEY_BLUETOOTH_REMOVE] = self.remove_bluetooth_devices self.navigator = NetworkNavigator(self.util, self.layout.BOTTOM, listeners) self.navigator.components[0].set_selected(True) self.add_navigator(self.navigator) self.original_networks = None self.networks = None self.current_network = None self.current_wifi_network = None self.clicked = False Screen.link_borders(self, False)
def __init__(self, util, get_current_playlist, playlist_provider, listeners, voice_assistant): """ Initializer :param util: utility object :param listeners: file browser listeners """ self.util = util self.config = util.config 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, "file_browser_screen_title", True, layout.TOP) color_dark_light = self.config[COLORS][COLOR_DARK_LIGHT] current_folder = self.util.file_util.current_folder d = {"current_title" : current_folder} if self.config[FILE_PLAYBACK][CURRENT_FILE_PLAYBACK_MODE] == FILE_PLAYLIST: f = self.config[FILE_PLAYBACK][CURRENT_FOLDER] p = self.config[FILE_PLAYBACK][CURRENT_FILE_PLAYLIST] d = f + os.sep + p self.screen_title.set_text(d) rows = 3 columns = 3 self.filelist = None playback_mode = self.config[FILE_PLAYBACK][CURRENT_FILE_PLAYBACK_MODE] if not playback_mode: self.config[FILE_PLAYBACK][CURRENT_FILE_PLAYBACK_MODE] = playback_mode = FILE_AUDIO if playback_mode == FILE_AUDIO or playback_mode == FILE_RECURSIVE: folder_content = self.util.load_folder_content(current_folder, rows, columns, layout.CENTER) self.filelist = Page(folder_content, rows, columns) elif playback_mode == FILE_PLAYLIST: s = State() s.folder = self.config[FILE_PLAYBACK][CURRENT_FOLDER] s.music_folder = self.config[AUDIO][MUSIC_FOLDER] s.file_name = self.config[FILE_PLAYBACK][CURRENT_FILE_PLAYLIST] pl = self.get_filelist_items(get_current_playlist) if len(pl) == 0: pl = self.util.load_playlist(s, playlist_provider, rows, columns) else: pl = self.util.load_playlist_content(pl, rows, columns) self.filelist = Page(pl, rows, columns) self.file_menu = FileMenu(self.filelist, util, playlist_provider, (0, 0, 0), layout.CENTER) Container.add_component(self, self.file_menu) self.file_menu.add_change_folder_listener(self.screen_title.set_text) self.file_menu.add_play_file_listener(listeners[KEY_PLAY_FILE]) listeners[GO_LEFT_PAGE] = self.file_menu.page_down listeners[GO_RIGHT_PAGE] = self.file_menu.page_up listeners[GO_USER_HOME] = self.file_menu.switch_to_user_home listeners[GO_ROOT] = self.file_menu.switch_to_root listeners[GO_TO_PARENT] = self.file_menu.switch_to_parent_folder self.navigator = Navigator(util, layout.BOTTOM, listeners, color_dark_light) left = str(self.filelist.get_left_items_number()) right = str(self.filelist.get_right_items_number()) self.navigator.left_button.change_label(left) self.navigator.right_button.change_label(right) self.file_menu.add_left_number_listener(self.navigator.left_button.change_label) self.file_menu.add_right_number_listener(self.navigator.right_button.change_label) Container.add_component(self, self.navigator) self.page_turned = False
def __init__(self, listeners, util, voice_assistant, screen_mode=STATION): """ Initializer :param util: utility object :param listener: screen menu event listener """ self.util = util self.config = util.config self.factory = Factory(util) self.screen_mode = screen_mode self.bounding_box = util.screen_rect self.favorites_util = FavoritesUtil(self.util) layout = BorderLayout(self.bounding_box) k = self.bounding_box.w / self.bounding_box.h percent_menu_width = (100.0 - PERCENT_TOP_HEIGHT - PERCENT_BOTTOM_HEIGHT) / k panel_width = (100.0 - percent_menu_width) / 2.0 layout.set_percent_constraints(PERCENT_TOP_HEIGHT, PERCENT_BOTTOM_HEIGHT, panel_width, panel_width) Screen.__init__(self, util, "", PERCENT_TOP_HEIGHT, voice_assistant, "station_screen_title", True, layout.TOP) tmp = Menu(util, (0, 0, 0), self.bounding_box, None, None) folders = self.util.get_stations_folders() if folders: panel_layout = BorderLayout(layout.RIGHT) panel_layout.set_percent_constraints(PERCENT_SIDE_BOTTOM_HEIGHT, PERCENT_SIDE_BOTTOM_HEIGHT, 0, 0) self.genres = util.load_stations_folders(panel_layout.BOTTOM) self.genres[ KEY_FAVORITES] = self.favorites_util.get_favorites_button_state( panel_layout.BOTTOM) current_genre_name = list(self.genres.keys())[0] self.current_genre = self.genres[current_genre_name] self.items_per_line = self.items_per_line(layout.CENTER.w) items = [] if self.screen_mode == STATION: k = STATIONS + "." + self.config[CURRENT][LANGUAGE] try: self.config[k] self.current_genre = self.genres[self.config[k] [CURRENT_STATIONS]] except: self.config[k] = {} self.config[k][CURRENT_STATIONS] = self.current_genre.name items = self.load_stations( self.config[CURRENT][LANGUAGE], self.current_genre.name, self.items_per_line * self.items_per_line) elif self.screen_mode == STREAM: items = util.load_streams(self.items_per_line * self.items_per_line) self.playlist = Page(items, self.items_per_line, self.items_per_line) self.station_menu = StationMenu(self.playlist, util, screen_mode, (0, 0, 0), layout.CENTER) if self.station_menu.is_button_defined(): d = {"current_title": self.station_menu.button.state.l_name} self.screen_title.set_text(d) Container.add_component(self, self.station_menu) self.stop_player = listeners[KEY_STOP] self.create_left_panel(layout, listeners) self.create_right_panel(layout, listeners) self.home_button.add_release_listener(listeners[KEY_HOME]) if self.screen_mode == STATION: self.genres_button.add_release_listener(listeners[KEY_GENRES]) self.shutdown_button.add_release_listener( self.favorites_util.save_favorites) self.shutdown_button.add_release_listener(listeners[KEY_SHUTDOWN]) self.left_button.add_release_listener( self.station_menu.switch_to_previous_station) self.left_button.add_release_listener(self.update_arrow_button_labels) self.page_down_button.add_release_listener( self.station_menu.switch_to_previous_page) self.page_down_button.add_release_listener( self.update_arrow_button_labels) self.right_button.add_release_listener( self.station_menu.switch_to_next_station) self.right_button.add_release_listener(self.update_arrow_button_labels) self.page_up_button.add_release_listener( self.station_menu.switch_to_next_page) self.page_up_button.add_release_listener( self.update_arrow_button_labels) self.station_menu.add_listener(listeners[KEY_PLAY]) self.station_menu.add_listener(self.screen_title.set_state) self.station_menu.add_listener(self.update_arrow_button_labels) self.station_menu.add_mode_listener(self.mode_listener) self.volume = self.factory.create_volume_control(layout.BOTTOM) self.volume.add_slide_listener(listeners[KEY_SET_VOLUME]) self.volume.add_slide_listener(listeners[KEY_SET_CONFIG_VOLUME]) self.volume.add_slide_listener(listeners[KEY_SET_SAVER_VOLUME]) self.volume.add_knob_listener(listeners[KEY_MUTE]) Container.add_component(self, self.volume) self.player_screen = True if self.current_genre.name == KEY_FAVORITES: self.favorites_mode = True else: self.favorites_mode = False self.favorites_util.set_favorites_in_config(self.items_per_line)
def __init__(self, listeners, util, voice_assistant, screen_mode=STATION): """ Initializer :param util: utility object :param listener: screen menu event listener """ self.util = util self.config = util.config self.factory = Factory(util) self.screen_mode = screen_mode self.bounding_box = util.screen_rect self.favorites_util = FavoritesUtil(self.util) self.top_height = self.config[PLAYER_SCREEN][TOP_HEIGHT_PERCENT] self.bottom_height = self.config[PLAYER_SCREEN][BOTTOM_HEIGHT_PERCENT] self.button_height = self.config[PLAYER_SCREEN][BUTTON_HEIGHT_PERCENT] self.popup_width = self.config[PLAYER_SCREEN][POPUP_WIDTH_PERCENT] self.image_location = self.config[PLAYER_SCREEN][IMAGE_LOCATION] self.layout = self.get_layout() Screen.__init__(self, util, "", self.top_height, voice_assistant, "station_screen_title", True, self.layout.TOP) self.layout = self.get_layout() folders = self.util.get_stations_folders() if folders: panel_layout = self.get_panel_layout(self.layout, LOCATION_RIGHT) panel_layout.set_percent_constraints(self.button_height, self.button_height, 0, 0) self.genres = util.load_stations_folders(panel_layout.BOTTOM) self.genres[ KEY_FAVORITES] = self.favorites_util.get_favorites_button_state( panel_layout.BOTTOM) current_genre_name = list(self.genres.keys())[0] self.current_genre = self.genres[current_genre_name] self.items_per_line = self.items_per_line(self.layout.CENTER.w) items = [] if self.screen_mode == STATION: k = STATIONS + "." + self.config[CURRENT][LANGUAGE] try: self.config[k] self.current_genre = self.genres[self.config[k] [CURRENT_STATIONS]] except: self.config[k] = {} self.config[k][CURRENT_STATIONS] = self.current_genre.name items = self.load_stations( self.config[CURRENT][LANGUAGE], self.current_genre.name, self.items_per_line * self.items_per_line) elif self.screen_mode == STREAM: items = util.load_streams(self.items_per_line * self.items_per_line) self.playlist = Page(items, self.items_per_line, self.items_per_line) self.station_menu = StationMenu( self.playlist, util, screen_mode, self.config[BACKGROUND][SCREEN_BGR_COLOR], self.layout.CENTER) if self.station_menu.is_button_defined(): d = {"current_title": self.station_menu.button.state.l_name} self.screen_title.set_text(d) Container.add_component(self, self.station_menu) self.stop_player = listeners[KEY_STOP] self.create_left_panel(self.layout, listeners) self.create_right_panel(self.layout, listeners) self.home_button.add_release_listener(listeners[KEY_HOME]) if self.screen_mode == STATION: self.genres_button.add_release_listener(listeners[KEY_GENRES]) self.shutdown_button.add_release_listener( self.favorites_util.save_favorites) self.shutdown_button.add_release_listener(listeners[KEY_SHUTDOWN]) self.left_button.add_release_listener( self.station_menu.switch_to_previous_station) self.left_button.add_release_listener(self.update_arrow_button_labels) self.page_down_button.add_release_listener( self.station_menu.switch_to_previous_page) self.page_down_button.add_release_listener( self.update_arrow_button_labels) self.right_button.add_release_listener( self.station_menu.switch_to_next_station) self.right_button.add_release_listener(self.update_arrow_button_labels) self.page_up_button.add_release_listener( self.station_menu.switch_to_next_page) self.page_up_button.add_release_listener( self.update_arrow_button_labels) self.station_menu.add_listener(listeners[KEY_PLAY]) self.station_menu.add_listener(self.screen_title.set_state) self.station_menu.add_listener(self.update_arrow_button_labels) self.station_menu.add_mode_listener(self.mode_listener) self.info_button = None self.info_popup = None self.start_screensaver = listeners[SCREENSAVER] bottom_layout = BorderLayout(self.layout.BOTTOM) bottom_layout.set_percent_constraints(0, 0, 0, self.popup_width) volume_layout = bottom_layout.CENTER volume_layout.w -= 2 volume_layout.x += 1 self.volume = self.factory.create_volume_control(volume_layout) self.volume.add_slide_listener(listeners[KEY_SET_VOLUME]) self.volume.add_slide_listener(listeners[KEY_SET_CONFIG_VOLUME]) self.volume.add_slide_listener(listeners[KEY_SET_SAVER_VOLUME]) self.volume.add_knob_listener(listeners[KEY_MUTE]) self.add_component(self.volume) self.player_screen = True self.add_popup(bottom_layout.RIGHT) if self.current_genre.name == KEY_FAVORITES: self.favorites_mode = True else: self.favorites_mode = False self.favorites_util.set_favorites_in_config(self.items_per_line) self.animated_title = True
def __init__(self, listeners, util, get_current_playlist, voice_assistant, player_stop=None): """ Initializer :param listeners: screen listeners :param util: utility object :param get_current_playlist: current playlist getter :param voice_assistant: voice assistant :param player_stop: stop player function """ self.util = util self.config = util.config self.cdutil = CdUtil(util) self.factory = Factory(util) self.stop_player = player_stop self.get_current_playlist = get_current_playlist self.bounding_box = util.screen_rect self.layout = BorderLayout(self.bounding_box) k = self.bounding_box.w / self.bounding_box.h percent_menu_width = (100.0 - PERCENT_TOP_HEIGHT - PERCENT_BOTTOM_HEIGHT) / k panel_width = (100.0 - percent_menu_width) / 2.0 self.layout.set_percent_constraints(PERCENT_TOP_HEIGHT, PERCENT_BOTTOM_HEIGHT, panel_width, panel_width) self.voice_assistant = voice_assistant Screen.__init__(self, util, "", PERCENT_TOP_HEIGHT, voice_assistant, "file_player_screen_title", True, self.layout.TOP) self.layout = BorderLayout(self.bounding_box) self.layout.set_percent_constraints(PERCENT_TOP_HEIGHT, PERCENT_BOTTOM_HEIGHT, panel_width, panel_width) self.create_left_panel(self.layout, listeners) self.create_right_panel(self.layout, listeners) self.file_button = self.factory.create_file_button( self.layout.CENTER, listeners[AUDIO_FILES]) Container.add_component(self, self.file_button) self.audio_files = self.get_audio_files() self.home_button.add_release_listener(listeners[KEY_HOME]) self.shutdown_button.add_release_listener(listeners[KEY_SHUTDOWN]) self.left_button.add_release_listener(self.go_left) self.right_button.add_release_listener(self.go_right) self.volume = self.factory.create_volume_control(self.layout.BOTTOM) self.volume.add_slide_listener(listeners[KEY_SET_VOLUME]) self.volume.add_slide_listener(listeners[KEY_SET_CONFIG_VOLUME]) self.volume.add_slide_listener(listeners[KEY_SET_SAVER_VOLUME]) self.volume.add_knob_listener(listeners[KEY_MUTE]) self.volume_visible = False self.volume.set_visible(self.volume_visible) Container.add_component(self, self.volume) self.time_control = self.factory.create_time_control( self.layout.BOTTOM) self.time_control.add_seek_listener(listeners[KEY_SEEK]) self.play_button.add_listener(PAUSE, self.time_control.pause) self.play_button.add_listener(KEY_PLAY, self.time_control.resume) self.left_button.add_release_listener( self.play_button.draw_default_state) self.right_button.add_release_listener( self.play_button.draw_default_state) if self.config[PLAYER_SETTINGS][PAUSE]: self.time_control.pause() Container.add_component(self, self.time_control) self.play_listeners = [] self.add_play_listener(listeners[KEY_PLAY]) self.current_folder = self.config[FILE_PLAYBACK][CURRENT_FOLDER] self.file_button.state.cover_art_folder = self.util.file_util.get_cover_art_folder( self.current_folder) self.playlist_size = 0 self.player_screen = True self.cd_album = None
def __init__(self, util, get_current_playlist, playlist_provider, listeners, voice_assistant): """ Initializer :param util: utility object :param listeners: file browser listeners """ self.util = util self.config = util.config 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, "file_browser_screen_title", True, layout.TOP) current_folder = self.util.file_util.current_folder d = {"current_title": current_folder} if self.config[FILE_PLAYBACK][ CURRENT_FILE_PLAYBACK_MODE] == FILE_PLAYLIST: f = self.config[FILE_PLAYBACK][CURRENT_FOLDER] p = self.config[FILE_PLAYBACK][CURRENT_FILE_PLAYLIST] d = f + os.sep + p self.screen_title.set_text(d) rows = self.config[FILE_BROWSER_ROWS] columns = self.config[FILE_BROWSER_COLUMNS] self.filelist = None playback_mode = self.config[FILE_PLAYBACK][CURRENT_FILE_PLAYBACK_MODE] if not playback_mode: self.config[FILE_PLAYBACK][ CURRENT_FILE_PLAYBACK_MODE] = playback_mode = FILE_AUDIO button_box = Rect(0, 0, layout.CENTER.w / columns, layout.CENTER.h / rows) if self.config[ALIGN_BUTTON_CONTENT_X] == 'center': location = TOP else: location = self.config[ALIGN_BUTTON_CONTENT_X] icon_box = self.factory.get_icon_bounding_box(button_box, location, self.config[IMAGE_AREA], self.config[IMAGE_SIZE], self.config[PADDING]) icon_box_without_label = self.factory.get_icon_bounding_box( button_box, location, 100, 100, self.config[PADDING], False) if playback_mode == FILE_AUDIO or playback_mode == FILE_RECURSIVE: folder_content = self.util.load_folder_content( current_folder, rows, columns, icon_box, icon_box_without_label) self.filelist = Page(folder_content, rows, columns) elif playback_mode == FILE_PLAYLIST: s = State() s.folder = self.config[FILE_PLAYBACK][CURRENT_FOLDER] s.music_folder = self.config[AUDIO][MUSIC_FOLDER] s.file_name = self.config[FILE_PLAYBACK][CURRENT_FILE_PLAYLIST] pl = self.get_filelist_items(get_current_playlist) if len(pl) == 0: pl = self.util.load_playlist(s, playlist_provider, rows, columns) else: pl = self.util.load_playlist_content(pl, rows, columns) self.filelist = Page(pl, rows, columns) self.file_menu = FileMenu(self.filelist, util, playlist_provider, layout.CENTER, location, icon_box, icon_box_without_label) self.file_menu.parent_screen = self self.add_menu(self.file_menu) self.file_menu.add_change_folder_listener(self.screen_title.set_text) self.file_menu.add_play_file_listener(listeners[KEY_PLAY_FILE]) listeners[GO_LEFT_PAGE] = self.file_menu.page_down listeners[GO_RIGHT_PAGE] = self.file_menu.page_up listeners[GO_USER_HOME] = self.file_menu.switch_to_user_home listeners[GO_ROOT] = self.file_menu.switch_to_root listeners[GO_TO_PARENT] = self.file_menu.switch_to_parent_folder b = self.config[BACKGROUND][FOOTER_BGR_COLOR] self.navigator = Navigator(util, layout.BOTTOM, listeners, b) left = str(self.filelist.get_left_items_number()) right = str(self.filelist.get_right_items_number()) self.navigator.left_button.change_label(left) self.navigator.right_button.change_label(right) self.file_menu.add_left_number_listener( self.navigator.left_button.change_label) self.file_menu.add_right_number_listener( self.navigator.right_button.change_label) self.add_component(self.navigator) self.page_turned = False self.animated_title = True