Beispiel #1
0
    def __init__(self, media_player, move_to_new_screen_callback):
        Screen.__init__(self, 'Main', move_to_new_screen_callback)

        self.media_player = media_player
        self.media_player.connect("stop", self.update)
        self.media_player.connect("play", self.update)
        self.media_player.connect('refresh', self._update_preview_title)

        self.theme = self.config.theme

        self._preview_title = None
        self.preview = clutter.Group() # Group that contains preview actors
        self.preview.set_position(self.get_abs_x(0.07), self.get_abs_y(0.1))
        self.preview.show()
        self.preview.set_opacity(0x00)
        self.add(self.preview)

        self.menu = self._create_main_menu()
        self.add(self.menu)

        self._update_preview_area()

        self.add(ClockLabel(0.13, "screentitle", 0, 0.87))

        self.menu.connect('selected', self._handle_select)
        self.menu.connect('moved', self._on_menu_moved)

        self.menu.active = True
Beispiel #2
0
    def __init__(self, media_player, move_to_new_screen_callback, episodes,
                 tv_series):
        Screen.__init__(self, 'TvEpisodes', move_to_new_screen_callback)

        self.episodes = episodes
        self.media_player = media_player
        self.theme = self.config.theme
        self.tv_series = tv_series

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87,
                             self.tv_series.title)
        self.add(screen_title)

        self.scroll_area = None
        self.title = None
        self.thumb = None
        self.menu = self._create_episode_menu()
        self.add(self.menu)
        self._create_episode_info_box()

        #List indicator
        self.li = ListIndicator(0.8, 0.9, 0.2, 0.045, ListIndicator.VERTICAL)
        self.li.set_maximum(len(self.episodes))
        self.add(self.li)

        self.menu.connect("moved", self._update_episode_info)
        self.menu.connect("selected", self._handle_select)
        self.menu.connect("activated", self._on_menu_activated)
Beispiel #3
0
    def __init__(self, media_player, move_to_new_screen_callback, episodes,
        tv_series):
        Screen.__init__(self, 'TvEpisodes', move_to_new_screen_callback)

        self.episodes = episodes
        self.media_player = media_player
        self.theme = self.config.theme
        self.tv_series = tv_series

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, self.tv_series.title)
        self.add(screen_title)

        self.scroll_area = None
        self.title = None
        self.thumb = None
        self.menu = self._create_episode_menu()
        self.add(self.menu)
        self._create_episode_info_box()

        #List indicator
        self.li = ListIndicator(0.8, 0.9, 0.2, 0.045, ListIndicator.VERTICAL)
        self.li.set_maximum(len(self.episodes))
        self.add(self.li)

        self.menu.connect("moved", self._update_episode_info)
        self.menu.connect("selected", self._handle_select)
        self.menu.connect("activated", self._on_menu_activated)
Beispiel #4
0
    def __init__(self, music_library, media_player):
        Screen.__init__(self, 'Disc')

        self.theme = self.config.theme
        self.music_library = music_library
        self.media_player = media_player
        # When album info is loaded we create Playlist object
        self.playlist = None

        self.art = None
        self.art2 = None
        self.in_behaviour = None
        self.out_behaviour = None
        self.li = None
        self.track_menu = None

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, _("Audio Disc"),
            "screen_title")
        self.add(screen_title)

        # Display throbber animation while loading CD metadata
        self.throbber = LoadingAnimation(0.5, 0.5, 0.1)
        self.throbber.show()
        self.add(self.throbber)

        # Create and initialize screen items
        self.has_disc = True
        gobject.timeout_add(500, self._get_disc_information)
Beispiel #5
0
    def __init__(self, media_player):
        Screen.__init__(self, 'VideoOSD', kind=Screen.OSD)

        self.theme = self.config.theme
        self.media_player = media_player
        self.media_player.connect('play', self._handle_play_pause)
        self.media_player.connect('pause', self._handle_play_pause)
        self.media_player.connect('skip-forward', self._handle_skip_forward)
        self.media_player.connect('skip-backward', self._handle_skip_backward)

        self._progress_bar = self._create_progress_bar()
        self.add(self._progress_bar)
        self.aspect_textures = None
        self.pause_texture = None
        self.seekbackward_texture = None
        self.seekforward_texture = None

        self.timeout_key = None
        self.progress_bar_timeout_key = None

        self.event_handlers.update({
            UserEvent.PLAYER_PLAY_PAUSE : self._handle_play_pause,
            UserEvent.PLAYER_SKIP_BACKWARD : self._handle_skip_backward,
            UserEvent.PLAYER_SKIP_FORWARD : self._handle_skip_forward,
            UserEvent.PLAYER_STOP : self._handle_stop,
            UserEvent.USE_ASPECT_RATIO_1 : self._handle_ratio_1,
            UserEvent.USE_ASPECT_RATIO_2 : self._handle_ratio_2,
            UserEvent.USE_ASPECT_RATIO_3 : self._handle_ratio_3,
            UserEvent.USE_ASPECT_RATIO_4 : self._handle_ratio_4
        })

        self._create_aspect_ratio_textures()

        self._create_navigation_textures()
Beispiel #6
0
    def __init__(self, current_photo_index, images):
        Screen.__init__(self, 'Photo')

        self.animate = self.config.show_effects
        self.slideshow_step = self.config.slideshow_step

        self.zoom_level = 1
        self.index = current_photo_index
        self.images = images
        self.slideshow = False
        # Slideshow gobject timeout tag
        self.slideshow_timeout_tag = None

        # Create black background
        self.background = clutter.Rectangle()
        self.background.set_size(self.config.stage_width,
                                 self.config.stage_height)
        self.background.set_color((0, 0, 0, 255))
        self.add(self.background)

        # Screen Title (Displayed at the bottom left corner)
        self.screen_title = Label(0.13, "screentitle", 0, 0.87,
                                  _("Information"))
        self.add(self.screen_title)

        self.texture = None
        self._change_image(self.index)
Beispiel #7
0
    def __init__(self, media_player, music_library,
                 move_to_new_screen_callback):
        Screen.__init__(self,
                        'Music',
                        move_to_new_screen_callback,
                        has_tabs=True)

        self.media_player = media_player
        self.theme = self.config.theme
        self.music_library = music_library

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, _("Music"))
        self.add(screen_title)

        if self.music_library.number_of_tracks() == 0:
            self._create_no_music_information()
        else:
            tab1 = ArtistsTab(music_library, music_library.get_all_artists(),
                              move_to_new_screen_callback)
            tab2 = AlbumsTab(music_library.get_all_albums(),
                             move_to_new_screen_callback)

            self.add_tab(tab1)
            self.add_tab(tab2)
Beispiel #8
0
    def __init__(self, media_player, music_library, move_to_new_screen_callback,
        album):
        Screen.__init__(self, 'Album', move_to_new_screen_callback)

        self.media_player = media_player
        self.theme = self.config.theme
        self.library = music_library
        self.album = album
        self.art = None
        self.track_menu = None

        # Create and initialize screen items
        self.track_menu = self._create_track_menu()
        self.add(self.track_menu)
        self._create_album_cover_texture()
        self._create_album_info()

        self.screen_title = Label(0.13, "screentitle", 0, 0.87, "")
        self.screen_title.set_ellipsize(pango.ELLIPSIZE_END)
        self.screen_title.width = 0.8
        self.add(self.screen_title)

        #List indicator
        self.li = ListIndicator(0.74, 0.85, 0.2, 0.045, ListIndicator.VERTICAL)
        self.li.set_maximum(len(self.album.tracks))
        self.add(self.li)

        self.track_menu.active = True
        self.track_menu.connect('selected', self._on_menu_selected)
        self.track_menu.connect('moved', self._display_selected_track)
Beispiel #9
0
    def __init__(self, current_photo_index, images):
        Screen.__init__(self, 'Photo')

        self.animate = self.config.show_effects
        self.slideshow_step = self.config.slideshow_step

        self.zoom_level = 1
        self.index = current_photo_index
        self.images = images
        self.slideshow = False
        # Slideshow gobject timeout tag
        self.slideshow_timeout_tag = None

        # Create black background
        self.background = clutter.Rectangle()
        self.background.set_size(
            self.config.stage_width, self.config.stage_height)
        self.background.set_color((0, 0, 0, 255))
        self.add(self.background)

        # Screen Title (Displayed at the bottom left corner)
        self.screen_title = Label(0.13, "screentitle", 0, 0.87,
            _("Information"))
        self.add(self.screen_title)

        self.texture = None
        self._change_image(self.index)
Beispiel #10
0
    def __init__(self, video_library, move_to_new_screen_callback, tv_series):
        Screen.__init__(self, 'TvSeries', move_to_new_screen_callback)

        self.theme = self.config.theme
        self.tv_series = tv_series
        self.video_library = video_library

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87,
                             self.tv_series.title)
        self.add(screen_title)

        self.art = None
        self.menu = None
        self._create_series_cover_texture()
        self.menu = self._create_season_menu()
        self.add(self.menu)

        #List indicator
        self.li = ListIndicator(0.8, 0.9, 0.2, 0.045, ListIndicator.VERTICAL)
        self.li.set_maximum(len(self.tv_series.seasons))
        self.add(self.li)

        self.menu.connect("moved", self._update_season_info)
        self.menu.connect("selected", self._handle_select)
Beispiel #11
0
    def setUp(self):
        '''Set up the test.'''
        EntertainerTest.setUp(self)

        self.screen = Screen()
        self.tabs_screen = Screen(has_tabs=True)
        self.tab = Tab('test')
        self.tabs_screen.add_tab(self.tab)

        self.select = UserEvent(UserEvent.NAVIGATE_SELECT)
Beispiel #12
0
    def setUp(self):
        '''Set up the test.'''
        EntertainerTest.setUp(self)

        self.screen = Screen()
        self.tabs_screen = Screen(has_tabs=True)
        self.tab = Tab('test')
        self.tabs_screen.add_tab(self.tab)

        self.select = UserEvent(UserEvent.NAVIGATE_SELECT)
Beispiel #13
0
    def __init__(self, media_player, video_library,
                 move_to_new_screen_callback):
        Screen.__init__(self, 'Video', has_tabs=True)

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, _("Videos"))
        self.add(screen_title)

        # Tabs
        tab1 = MoviesTab(video_library, move_to_new_screen_callback)
        tab2 = SeriesTab(video_library, move_to_new_screen_callback)
        tab3 = VideoClipsTab(media_player, video_library,
                             move_to_new_screen_callback)

        self.add_tab(tab1)
        self.add_tab(tab2)
        self.add_tab(tab3)
Beispiel #14
0
    def __init__(self, media_player, video_library,
        move_to_new_screen_callback):
        Screen.__init__(self, 'Video', has_tabs=True)

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, _("Videos"))
        self.add(screen_title)

        # Tabs
        tab1 = MoviesTab(video_library, move_to_new_screen_callback)
        tab2 = SeriesTab(video_library, move_to_new_screen_callback)
        tab3 = VideoClipsTab(media_player, video_library,
            move_to_new_screen_callback)

        self.add_tab(tab1)
        self.add_tab(tab2)
        self.add_tab(tab3)
Beispiel #15
0
    def __init__(self, move_to_new_screen_callback, title, images):
        Screen.__init__(self, 'Photographs', move_to_new_screen_callback)

        self.images = images

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, title)
        self.add(screen_title)

        # Image Title (over album list)
        self.image_title = Label(0.04167, "title", 0.0586, 0.7943, " ")
        self.image_title.set_ellipsize(pango.ELLIPSIZE_END)
        self.add(self.image_title)

        self.image_desc = Label(0.04167, "subtitle", 0.0586, 0.9115, " ")
        self.image_desc.set_line_wrap(True)
        self.image_desc.set_ellipsize(pango.ELLIPSIZE_END)
        self.add(self.image_desc)

        # Display throbber animation while loading photographs
        self.throbber = LoadingAnimation(0.9, 0.9)
        self.throbber.show()
        self.add(self.throbber)

        # List indicator
        self.li = None
        self._create_list_indicator()

        # Create photomenu
        self.menu = ImageMenu(0.03, 0.08, 0.12, self.y_for_x(0.12))
        self.menu.items_per_col = 3
        self.menu.visible_rows = 3
        self.menu.visible_cols = 8
        self.menu.active = True
        self.add(self.menu)

        photos = self.images
        photos_list = [[Texture(photo.get_thumbnail_url()), photo] \
            for photo in photos]
        self.menu.async_add(photos_list)

        self.menu.connect("selected", self._handle_select)
        self.menu.connect('moved', self._update_image_info)
        self.menu.connect("filled", self._on_menu_filled)
Beispiel #16
0
    def __init__(self, move_to_new_screen_callback, title, images):
        Screen.__init__(self, 'Photographs', move_to_new_screen_callback)

        self.images = images

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, title)
        self.add(screen_title)

        # Image Title (over album list)
        self.image_title = Label(0.04167, "title", 0.0586, 0.7943, " ")
        self.image_title.set_ellipsize(pango.ELLIPSIZE_END)
        self.add(self.image_title)

        self.image_desc = Label(0.04167, "subtitle", 0.0586, 0.9115, " ")
        self.image_desc.set_line_wrap(True)
        self.image_desc.set_ellipsize(pango.ELLIPSIZE_END)
        self.add(self.image_desc)

        # Display throbber animation while loading photographs
        self.throbber = LoadingAnimation(0.9, 0.9)
        self.throbber.show()
        self.add(self.throbber)

        # List indicator
        self.li = None
        self._create_list_indicator()

        # Create photomenu
        self.menu = ImageMenu(0.03, 0.08, 0.12, self.y_for_x(0.12))
        self.menu.items_per_col = 3
        self.menu.visible_rows = 3
        self.menu.visible_cols = 8
        self.menu.active = True
        self.add(self.menu)

        photos = self.images
        photos_list = [[Texture(photo.get_thumbnail_url()), photo] \
            for photo in photos]
        self.menu.async_add(photos_list)

        self.menu.connect("selected", self._handle_select)
        self.menu.connect('moved', self._update_image_info)
        self.menu.connect("filled", self._on_menu_filled)
Beispiel #17
0
    def __init__(self, move_to_previous_screen_callback, question,
        answers, callbacks=None):
        Screen.__init__(self, 'Question')

        self.move_to_previous_screen_callback = move_to_previous_screen_callback
        self.answers = answers

        if callbacks is None:
            callbacks = []
        self.callbacks = callbacks

        screen_title = Label(0.13, "screentitle", 0, 0.87, _("Question"))
        self.add(screen_title)

        question_label = Label(0.04167, "text", 0.095, 0.13, str(question))
        self.add(question_label)

        self.menu = None
        self.display_answers()
Beispiel #18
0
    def __init__(self, media_player):
        Screen.__init__(self, 'VideoOSD', kind=Screen.OSD)

        self.theme = self.config.theme
        self.media_player = media_player
        self.media_player.connect('play', self._handle_play_pause)
        self.media_player.connect('pause', self._handle_play_pause)
        self.media_player.connect('skip-forward', self._handle_skip_forward)
        self.media_player.connect('skip-backward', self._handle_skip_backward)

        self._progress_bar = self._create_progress_bar()
        self.add(self._progress_bar)
        self.aspect_textures = None
        self.pause_texture = None
        self.seekbackward_texture = None
        self.seekforward_texture = None

        self.timeout_key = None
        self.progress_bar_timeout_key = None

        self.event_handlers.update({
            UserEvent.PLAYER_PLAY_PAUSE:
            self._handle_play_pause,
            UserEvent.PLAYER_SKIP_BACKWARD:
            self._handle_skip_backward,
            UserEvent.PLAYER_SKIP_FORWARD:
            self._handle_skip_forward,
            UserEvent.PLAYER_STOP:
            self._handle_stop,
            UserEvent.USE_ASPECT_RATIO_1:
            self._handle_ratio_1,
            UserEvent.USE_ASPECT_RATIO_2:
            self._handle_ratio_2,
            UserEvent.USE_ASPECT_RATIO_3:
            self._handle_ratio_3,
            UserEvent.USE_ASPECT_RATIO_4:
            self._handle_ratio_4
        })

        self._create_aspect_ratio_textures()

        self._create_navigation_textures()
Beispiel #19
0
    def __init__(self, media_player, music_library, artist,
        move_to_new_screen_callback):
        Screen.__init__(self, 'Artist', move_to_new_screen_callback,
            has_tabs=True)
        self.media_player = media_player

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, artist)
        screen_title.set_ellipsize(pango.ELLIPSIZE_END)
        screen_title.width = 1
        self.add(screen_title)

        # Tabs
        albums = music_library.get_albums_by_artist(artist)
        if albums:
            tab1 = AlbumsTab(albums, move_to_new_screen_callback)
            self.add_tab(tab1)

        tracks = music_library.get_tracks_by_artist(artist)
        if tracks:
            tab2 = TracksTab(tracks, move_to_new_screen_callback)
            self.add_tab(tab2)
Beispiel #20
0
    def __init__(self,
                 move_to_previous_screen_callback,
                 question,
                 answers,
                 callbacks=None):
        Screen.__init__(self, 'Question')

        self.move_to_previous_screen_callback = move_to_previous_screen_callback
        self.answers = answers

        if callbacks is None:
            callbacks = []
        self.callbacks = callbacks

        screen_title = Label(0.13, "screentitle", 0, 0.87, _("Question"))
        self.add(screen_title)

        question_label = Label(0.04167, "text", 0.095, 0.13, str(question))
        self.add(question_label)

        self.menu = None
        self.display_answers()
Beispiel #21
0
    def __init__(self, media_player, music_library,
        move_to_new_screen_callback):
        Screen.__init__(self, 'Music', move_to_new_screen_callback,
            has_tabs=True)

        self.media_player = media_player
        self.theme = self.config.theme
        self.music_library = music_library

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, _("Music"))
        self.add(screen_title)

        if self.music_library.number_of_tracks() == 0:
            self._create_no_music_information()
        else:
            tab1 = ArtistsTab(music_library, music_library.get_all_artists(),
                move_to_new_screen_callback)
            tab2 = AlbumsTab(music_library.get_all_albums(),
                move_to_new_screen_callback)

            self.add_tab(tab1)
            self.add_tab(tab2)
Beispiel #22
0
    def __init__(self, media_player, movie, move_to_new_screen_callback):
        Screen.__init__(self, 'Movie', move_to_new_screen_callback)

        self.theme = self.config.theme
        self.media_player = media_player
        self.movie = movie

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, _("Movie"))
        self.add(screen_title)

        # Add the additional actions that are needed but not handled by default
        self.event_handlers.update({
            UserEvent.NAVIGATE_FIRST_PAGE : self._handle_first_page,
            UserEvent.NAVIGATE_LAST_PAGE : self._handle_last_page,
            UserEvent.NAVIGATE_PREVIOUS_PAGE : self._handle_previous_page,
            UserEvent.NAVIGATE_NEXT_PAGE : self._handle_next_page
        })

        self.menu = None
        self.scroll_area = None
        self.create_menu()
        self.create_movie_information()
Beispiel #23
0
    def __init__(self, image_library, move_to_new_screen_callback):
        Screen.__init__(self, 'PhotoAlbums', move_to_new_screen_callback)

        self.theme = self.config.theme
        self.image_library = image_library
        self.timeout = None  # Timeout key (this is used when scrolling menu)

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, _("Photographs"))
        self.add(screen_title)

        if self.image_library.get_number_of_albums() == 0:
            self._create_no_photos_information()
        else:
            # Album preview group
            self.preview = clutter.Group()
            self.preview.set_position(self.get_abs_x(0.07),
                                      self.get_abs_y(0.1953))
            self.preview.show()
            self.add(self.preview)

            self.preview_fade = None
            self.menu = None
            self.in_behaviour = None
            self.out_behaviour = None
            self.in_opacity = None
            self.out_opacity = None
            self.preview_textures = None
            self.menu = self._create_album_menu()
            self.add(self.menu)
            self.li = None
            self._create_list_indicator()

            self._update_album_preview(self.menu.selected_userdata)

            self.menu.connect('selected', self._handle_select)
            self.menu.connect('moved', self._display_selected_album)
Beispiel #24
0
    def __init__(self, image_library, move_to_new_screen_callback):
        Screen.__init__(self, 'PhotoAlbums', move_to_new_screen_callback)

        self.theme = self.config.theme
        self.image_library = image_library
        self.timeout = None # Timeout key (this is used when scrolling menu)

        # Screen Title (Displayed at the bottom left corner)
        screen_title = Label(0.13, "screentitle", 0, 0.87, _("Photographs"))
        self.add(screen_title)

        if self.image_library.get_number_of_albums() == 0:
            self._create_no_photos_information()
        else:
            # Album preview group
            self.preview = clutter.Group()
            self.preview.set_position(self.get_abs_x(0.07),
                self.get_abs_y(0.1953))
            self.preview.show()
            self.add(self.preview)

            self.preview_fade = None
            self.menu = None
            self.in_behaviour = None
            self.out_behaviour = None
            self.in_opacity = None
            self.out_opacity = None
            self.preview_textures = None
            self.menu = self._create_album_menu()
            self.add(self.menu)
            self.li = None
            self._create_list_indicator()

            self._update_album_preview(self.menu.selected_userdata)

            self.menu.connect('selected', self._handle_select)
            self.menu.connect('moved', self._display_selected_album)
Beispiel #25
0
    def __init__(self):
        Screen.__init__(self, 'Weather')

        # Screen Title
        self.add(Label(0.13, "screentitle", 0, 0.87, _("Weather")))

        self.weather = Weather(self.config.weather_location)

        location = Label(0.04167, "text", 0.50, 0.13, self.weather.location,
            font_weight="bold")
        location.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)
        self.add(location)

        # Show today's weather
        self.create_day(self.weather.forecasts[0], 0.1, 0.15)

        # Show tomorrow's weather
        self.create_day(self.weather.forecasts[1], 0.1, 0.5)

        # Show day 3
        self.create_day(self.weather.forecasts[2], 0.4, 0.5)

        # Show day 4
        self.create_day(self.weather.forecasts[3], 0.7, 0.5)
Beispiel #26
0
    def __init__(self, media_player, music_library, track):
        Screen.__init__(self, 'AudioPlay', has_tabs=True)

        self.theme = self.config.theme
        album = track.album

        # Create album art (this is displayed on all tab pages
        if (album.has_album_art()):
            pixbuf = gtk.gdk.pixbuf_new_from_file(album.album_art_url)
        else:
            pixbuf = gtk.gdk.pixbuf_new_from_file(
                self.theme.getImage("default_album_art"))
        self.art = EyeCandyTexture(0.1, 0.22, 0.3148, 0.5599, pixbuf)
        self.art.set_rotation(clutter.Y_AXIS, 25, 0, 0, 0)
        self.add(self.art)

        media_player.set_media(track)
        media_player.play()

        # Tabs
        tab1 = PlayingTab(media_player, track)
        tab2 = LyricsTab(music_library, track)
        self.add_tab(tab1)
        self.add_tab(tab2)
Beispiel #27
0
    def __init__(self, media_player, music_library, track):
        Screen.__init__(self, 'AudioPlay', has_tabs=True)

        self.theme = self.config.theme
        album = track.album

        # Create album art (this is displayed on all tab pages
        if(album.has_album_art()):
            pixbuf = gtk.gdk.pixbuf_new_from_file(album.album_art_url)
        else:
            pixbuf = gtk.gdk.pixbuf_new_from_file(
                self.theme.getImage("default_album_art"))
        self.art = EyeCandyTexture(0.1, 0.22, 0.3148, 0.5599, pixbuf)
        self.art.set_rotation(clutter.Y_AXIS, 25, 0, 0, 0)
        self.add(self.art)

        media_player.set_media(track)
        media_player.play()

        # Tabs
        tab1 = PlayingTab(media_player, track)
        tab2 = LyricsTab(music_library, track)
        self.add_tab(tab1)
        self.add_tab(tab2)
Beispiel #28
0
 def handle_user_event(self, event):
     '''Handle screen specific user events unless the library is empty.'''
     if self.music_library.number_of_tracks() == 0:
         return
     else:
         Screen.handle_user_event(self, event)
Beispiel #29
0
 def test_is_empty(self):
     '''Test the is_empty property.'''
     self.assertTrue(self.screen_history.is_empty)
     screen = Screen()
     self.screen_history.add_screen(screen)
     self.assertFalse(self.screen_history.is_empty)
Beispiel #30
0
 def handle_user_event(self, event):
     '''Handle screen specific user events unless the library is empty.'''
     if self.image_library.get_number_of_albums() == 0:
         return
     else:
         Screen.handle_user_event(self, event)
Beispiel #31
0
 def handle_user_event(self, event):
     '''Handle screen specific user events unless the library is empty.'''
     if self.music_library.number_of_tracks() == 0:
         return
     else:
         Screen.handle_user_event(self, event)
Beispiel #32
0
class ScreenTest(EntertainerTest):
    """Test for entertainerlib.gui.screens.screen"""

    def setUp(self):
        '''Set up the test.'''
        EntertainerTest.setUp(self)

        self.screen = Screen()
        self.tabs_screen = Screen(has_tabs=True)
        self.tab = Tab('test')
        self.tabs_screen.add_tab(self.tab)

        self.select = UserEvent(UserEvent.NAVIGATE_SELECT)

    def tearDown(self):
        '''Clean up after the test.'''
        EntertainerTest.tearDown(self)

    def test_create(self):
        '''Test correct Screen initialization.'''
        self.assertTrue(isinstance(self.screen, (Base, clutter.Group)))

    def test_size(self):
        '''Test that screen got set to the correct size'''
        self.assertEqual(self.screen.get_size(), (1366, 768))

    def test_has_tabs(self):
        '''Test that a screen with tabs contains a tab group.'''
        self.assertTrue(isinstance(self.tabs_screen.tab_group, TabGroup))

    def test_add_tab_for_tab_screen(self):
        '''Test adding a tab to a screen with tabs enabled.'''
        test_tab = Tab('another')
        self.tabs_screen.add_tab(test_tab)
        return_tab = self.tabs_screen.tab_group.tab('another')
        self.assertEqual(return_tab, test_tab)

    def test_add_tab_for_screen(self):
        '''Test adding a tab to a screen with no tabs enabled fails.'''
        self.assertRaises(ScreenException, self.screen.add_tab, self.tab)

    def test_tab_handle_user_event(self):
        '''Test screen correctly passes an event to the tab_group.'''
        self.assertFalse(self.tabs_screen.handle_user_event(self.select))

    def test_handle_user_event(self):
        '''Test the set of user events that are allowed by default.'''
        up = UserEvent(UserEvent.NAVIGATE_UP)
        down = UserEvent(UserEvent.NAVIGATE_DOWN)
        left = UserEvent(UserEvent.NAVIGATE_LEFT)
        right = UserEvent(UserEvent.NAVIGATE_RIGHT)
        not_handled = UserEvent(UserEvent.QUIT)

        self.assertFalse(self.screen.handle_user_event(self.select))
        self.assertFalse(self.screen.handle_user_event(up))
        self.assertFalse(self.screen.handle_user_event(down))
        self.assertFalse(self.screen.handle_user_event(left))
        self.assertFalse(self.screen.handle_user_event(right))
        self.assertFalse(self.screen.handle_user_event(not_handled))

    def test_kind(self):
        '''Test the kind property default and a set value.'''
        self.assertEqual(self.screen.kind, Screen.NORMAL)
        self.osd = Screen(kind=Screen.OSD)
        self.assertEqual(self.osd.kind, Screen.OSD)

    def test_name(self):
        '''Test the name property default and a set value.'''
        self.assertEqual(self.screen.name, '')
        self.named = Screen('Named')
        self.assertEqual(self.named.name, 'Named')
Beispiel #33
0
 def test_name(self):
     '''Test the name property default and a set value.'''
     self.assertEqual(self.screen.name, '')
     self.named = Screen('Named')
     self.assertEqual(self.named.name, 'Named')
Beispiel #34
0
 def test_kind(self):
     '''Test the kind property default and a set value.'''
     self.assertEqual(self.screen.kind, Screen.NORMAL)
     self.osd = Screen(kind=Screen.OSD)
     self.assertEqual(self.osd.kind, Screen.OSD)
Beispiel #35
0
 def handle_user_event(self, event):
     '''Handle screen specific user events unless the library is empty.'''
     if self.image_library.get_number_of_albums() == 0:
         return
     else:
         Screen.handle_user_event(self, event)
Beispiel #36
0
 def handle_user_event(self, event):
     '''Handle user events unless there is no disc.'''
     if self.has_disc:
         Screen.handle_user_event(self, event)
Beispiel #37
0
class ScreenTest(EntertainerTest):
    """Test for entertainerlib.gui.screens.screen"""
    def setUp(self):
        '''Set up the test.'''
        EntertainerTest.setUp(self)

        self.screen = Screen()
        self.tabs_screen = Screen(has_tabs=True)
        self.tab = Tab('test')
        self.tabs_screen.add_tab(self.tab)

        self.select = UserEvent(UserEvent.NAVIGATE_SELECT)

    def tearDown(self):
        '''Clean up after the test.'''
        EntertainerTest.tearDown(self)

    def test_create(self):
        '''Test correct Screen initialization.'''
        self.assertTrue(isinstance(self.screen, (Base, clutter.Group)))

    def test_size(self):
        '''Test that screen got set to the correct size'''
        self.assertEqual(self.screen.get_size(), (1366, 768))

    def test_has_tabs(self):
        '''Test that a screen with tabs contains a tab group.'''
        self.assertTrue(isinstance(self.tabs_screen.tab_group, TabGroup))

    def test_add_tab_for_tab_screen(self):
        '''Test adding a tab to a screen with tabs enabled.'''
        test_tab = Tab('another')
        self.tabs_screen.add_tab(test_tab)
        return_tab = self.tabs_screen.tab_group.tab('another')
        self.assertEqual(return_tab, test_tab)

    def test_add_tab_for_screen(self):
        '''Test adding a tab to a screen with no tabs enabled fails.'''
        self.assertRaises(ScreenException, self.screen.add_tab, self.tab)

    def test_tab_handle_user_event(self):
        '''Test screen correctly passes an event to the tab_group.'''
        self.assertFalse(self.tabs_screen.handle_user_event(self.select))

    def test_handle_user_event(self):
        '''Test the set of user events that are allowed by default.'''
        up = UserEvent(UserEvent.NAVIGATE_UP)
        down = UserEvent(UserEvent.NAVIGATE_DOWN)
        left = UserEvent(UserEvent.NAVIGATE_LEFT)
        right = UserEvent(UserEvent.NAVIGATE_RIGHT)
        not_handled = UserEvent(UserEvent.QUIT)

        self.assertFalse(self.screen.handle_user_event(self.select))
        self.assertFalse(self.screen.handle_user_event(up))
        self.assertFalse(self.screen.handle_user_event(down))
        self.assertFalse(self.screen.handle_user_event(left))
        self.assertFalse(self.screen.handle_user_event(right))
        self.assertFalse(self.screen.handle_user_event(not_handled))

    def test_kind(self):
        '''Test the kind property default and a set value.'''
        self.assertEqual(self.screen.kind, Screen.NORMAL)
        self.osd = Screen(kind=Screen.OSD)
        self.assertEqual(self.osd.kind, Screen.OSD)

    def test_name(self):
        '''Test the name property default and a set value.'''
        self.assertEqual(self.screen.name, '')
        self.named = Screen('Named')
        self.assertEqual(self.named.name, 'Named')