Exemple #1
0
    def __init__(self, albums, move_to_new_screen_callback, name="albums",
        tab_title=_("Albums")):
        Tab.__init__(self, name, tab_title, move_to_new_screen_callback)

        # Start the loading animation while the menu is loading
        self.throbber = LoadingAnimation(0.6, 0.1)
        self.throbber.show()
        self.add(self.throbber)

        if len(albums) < 4:
            x_percent = 0.2928
            visible_rows = 1
            visible_cols = 3
        elif len(albums) < 13:
            x_percent = 0.1464
            visible_rows = 2
            visible_cols = 6
        else:
            x_percent = 0.1098
            visible_rows = 3
            visible_cols = 8

        # Create albums menu
        self.menu = ImageMenu(0.07, 0.16, x_percent, self.y_for_x(x_percent))
        self.menu.visible_rows = visible_rows
        self.menu.visible_cols = visible_cols
        self.menu.items_per_col = self.menu.visible_rows
        self.add(self.menu)

        albums_list = [[album.album_art_url, album] for album in albums]
        self.menu.async_add_albums(albums_list)

        self.li = ListIndicator(0.77, 0.8, 0.18, 0.045,
            ListIndicator.HORIZONTAL)
        self.li.set_maximum(len(albums))
        self.li.show()
        self.add(self.li)

        # Create album information (displays current menuitem information)
        self.album_title = Label(0.045, "title", 0.22, 0.79, "")
        self.album_title.set_ellipsize(pango.ELLIPSIZE_END)
        self.album_title.set_line_wrap(False)
        self.album_title.width = 0.366
        self.add(self.album_title)

        self.album_artist = Label(0.037, "subtitle", 0.22, 0.86, "")
        self.album_artist.set_ellipsize(pango.ELLIPSIZE_END)
        self.album_artist.set_line_wrap(False)
        self.album_artist.width = 0.366
        self.add(self.album_artist)

        self.album_tracks = Label(0.037, "subtitle", 0.22, 0.91, "")
        self.add(self.album_tracks)

        self.connect('activated', self._on_activated)
        self.connect('deactivated', self._on_deactivated)
        self.menu.connect("moved", self._update_album_info)
        self.menu.connect("selected", self._handle_select)
        self.menu.connect("activated", self._on_activated)
        self.menu.connect("filled", self._on_menu_filled)
    def __init__(self,
                 media_player,
                 video_library,
                 move_to_new_screen_callback,
                 name="clips",
                 tab_title=_("Video clips")):
        Tab.__init__(self, name, tab_title, move_to_new_screen_callback)
        self.media_player = media_player
        self.video_library = video_library
        self.theme = self.config.theme
        self.list_indicator = None
        self.clip_info = None
        self.menu = None
        self.clip_title = None

        if self.video_library.get_number_of_video_clips() == 0:
            self._create_empty_library_notice()
        else:
            # Start the loading animation while the menu is loading
            self.throbber = LoadingAnimation(0.7, 0.1)
            self.throbber.show()
            self.add(self.throbber)

            self.menu = self._create_menu()
            self.add(self.menu)
            self.menu.connect("moved", self._update_clip_info)
            self.menu.connect("selected", self._handle_select)
            self.menu.connect("activated", self._on_activated)
            self.menu.connect("filled", self._on_menu_filled)

            self.connect('activated', self._on_activated)
            self.connect('deactivated', self._on_deactivated)
Exemple #3
0
    def __init__(self, video_library, move_to_new_screen_callback,
        name="movies", tab_title=_("Movies")):
        Tab.__init__(self, name, tab_title, move_to_new_screen_callback)

        self.video_library = video_library
        self.theme = self.config.theme
        self.list_indicator = None
        self.movie_info = None
        self.menu = None
        self.movie_plot = None
        self.movie_title = None

        if self.video_library.get_number_of_movies() == 0:
            self._create_empty_library_notice()
        else:
            # Start the loading animation while the menu is loading
            self.throbber = LoadingAnimation(0.1, 0.1)
            self.throbber.show()
            self.add(self.throbber)

            self.menu = self._create_menu()
            self.add(self.menu)
            self.menu.connect("moved", self._update_movie_info)
            self.menu.connect("selected", self._handle_select)
            self.menu.connect("activated", self._on_activated)
            self.menu.connect("filled", self._on_menu_filled)

            self.connect('activated', self._on_activated)
            self.connect('deactivated', self._on_deactivated)
Exemple #4
0
    def __init__(self, music_library, track, name="lyrics",
        tab_title=_("Lyrics")):
        Tab.__init__(self, name, tab_title)
        self.track = track
        self.lyrics_area = None
        self.library = music_library
        self.lyrics_text = ""

        if self.track.has_lyrics():
            self.lyrics_text = self.track.lyrics
            lyrics = Label(0.037, "subtitle", 0, 0, self.lyrics_text)
            lyrics.set_line_wrap_mode(pango.WRAP_WORD)
            lyrics.width = 0.366

            self.lyrics_area = ScrollArea(0.5, 0.23, 0.4, 0.57, lyrics)
            self.lyrics_area.connect("activated", self._on_activated)
            self.add(self.lyrics_area)

            self.connect('activated', self._on_activated)
            self.connect('deactivated', self._on_deactivated)
        else:
            # Display throbber animation while searching for lyrics
            self.throbber = LoadingAnimation(0.7, 0.5, 0.1)
            self.throbber.show()
            self.add(self.throbber)
            self.track.fetch_lyrics(self._lyrics_search_callback)
 def _create_empty_library_notice(self):
     """
     Create an information box that is displayed if there are no indexed
     movies.
     """
     message = _(
         "There are no indexed Video Clips in the Entertainer media "
         "library. Please add some folders containing video clips "
         "to the Library using the configuration tool.")
     Tab.show_empty_tab_notice(self, _("No video clips available!"), message)
Exemple #6
0
    def setUp(self):
        '''Set up the test.'''
        EntertainerTest.setUp(self)

        self.tab_group = TabGroup(0.95, 0.13, 'title')

        tab1 = Tab("tab1", "title1", None)
        self.tab2 = Tab("foo", "title2", None)

        self.tab_group.add_tab(tab1)
        self.tab_group.add_tab(self.tab2)
Exemple #7
0
 def _create_empty_library_notice(self):
     """
     Create an information box that is displayed if there are no indexed
     movies.
     """
     message = _(
         "There are no indexed movies in Entertainer media library.  To "
         "add movies, click on 'content' button on toolbar and open "
         "'videos' tab. Now click on 'add' button and select some folders "
         "which contains movie files.")
     Tab.show_empty_tab_notice(self, _("No movies available!"), message)
 def _create_empty_library_notice(self):
     """
     Create an information box that is displayed if there are no indexed
     movies.
     """
     message = _(
         "There are no indexed Video Clips in the Entertainer media "
         "library. Please add some folders containing video clips "
         "to the Library using the configuration tool.")
     Tab.show_empty_tab_notice(self, _("No video clips available!"),
                               message)
Exemple #9
0
 def _create_empty_library_notice(self):
     """
     Create an information box that is displayed if there are no indexed
     movies.
     """
     message = _(
         "There are no indexed movies in Entertainer media library.  To "
         "add movies, click on 'content' button on toolbar and open "
         "'videos' tab. Now click on 'add' button and select some folders "
         "which contains movie files.")
     Tab.show_empty_tab_notice(self, _("No movies available!"), message)
Exemple #10
0
    def __init__(self, tracks, move_to_new_screen_callback, name="tracks",
        tab_title=_("Tracks")):
        Tab.__init__(self, name, tab_title, move_to_new_screen_callback)

        # Start the loading animation while the menu is loading
        self.throbber = LoadingAnimation(0.1, 0.1)
        self.throbber.show()
        self.add(self.throbber)

        self.menu = TextMenu(0.0586, 0.2083, 0.2928, 0.0781)
        self.menu.items_per_row = 3
        self.menu.visible_rows = 7
        self.menu.visible_cols = 3
        self.menu.active = False
        self.menu.cursor = None
        self.add(self.menu)

        tracks_list = [[track.title, None, track] for track in tracks]
        self.menu.async_add_artists(tracks_list)

        self.track_title = Label(0.045, "title", 0.22, 0.79, "")
        self.track_title.set_ellipsize(pango.ELLIPSIZE_END)
        self.track_title.set_line_wrap(False)
        self.track_title.width = 0.366
        self.add(self.track_title)

        self.track_number = Label(0.037, "subtitle", 0.22, 0.86, "")
        self.track_number.set_ellipsize(pango.ELLIPSIZE_END)
        self.track_number.set_line_wrap(False)
        self.track_number.width = 0.366
        self.add(self.track_number)

        self.track_length = Label(0.037, "subtitle", 0.22, 0.91, "")
        self.add(self.track_length)

        self.li = ListIndicator(0.77, 0.8, 0.18, 0.045,
            ListIndicator.VERTICAL)
        self.li.set_maximum(len(tracks))
        self.li.show()
        self.add(self.li)

        self.connect('activated', self._on_activated)
        self.connect('deactivated', self._on_deactivated)
        self.menu.connect("moved", self._update_track_info)
        self.menu.connect("selected", self._handle_select)
        self.menu.connect("activated", self._on_activated)
        self.menu.connect("filled", self._on_menu_filled)
Exemple #11
0
    def __init__(self, music_library, artists, move_to_new_screen_callback,
        name="artists", tab_title=_("Artists")):
        Tab.__init__(self, name, tab_title, move_to_new_screen_callback)
        self.library = music_library

        # Start the loading animation while the menu is loading
        self.throbber = LoadingAnimation(0.1, 0.1)
        self.throbber.show()
        self.add(self.throbber)

        self.menu = TextMenu(0.057, 0.208, 0.293, 0.078)
        self.menu.items_per_row = 3
        self.menu.visible_rows = 7
        self.menu.visible_cols = 3
        self.menu.active = False
        self.menu.cursor = None
        self.add(self.menu)

        artists_list = [[artist, None, artist] for artist in artists]
        self.menu.async_add_artists(artists_list)

        # Create artist label
        self.artist_title = Label(0.0416, "title", 0.22, 0.794, "")
        self.artist_title.set_ellipsize(pango.ELLIPSIZE_END)
        self.artist_title.set_line_wrap(False)
        self.artist_title.width = 0.366
        self.add(self.artist_title)

        self.artist_albums = Label(0.0365, "subtitle", 0.22, 0.86, "")
        self.add(self.artist_albums)

        self.artist_tracks = Label(0.0365, "subtitle", 0.22, 0.911, "")
        self.add(self.artist_tracks)

        # Create artist menu list indicator
        self.li = ListIndicator(0.77, 0.8, 0.18, 0.045,
            ListIndicator.VERTICAL)
        self.li.set_maximum(len(artists))
        self.add(self.li)

        self.connect('activated', self._on_activated)
        self.connect('deactivated', self._on_deactivated)
        self.menu.connect("moved", self._update_artist_info)
        self.menu.connect("selected", self._handle_select)
        self.menu.connect("activated", self._on_activated)
        self.menu.connect("filled", self._on_menu_filled)
Exemple #12
0
    def __init__(self,
                 media_player,
                 track,
                 name="playing",
                 tab_title=_("Currently playing")):
        Tab.__init__(self, name, tab_title)

        album = track.album

        # Track name
        if track.number == 0:
            track_label_text = track.title
        else:
            track_label_text =  _("From %(number)d. %(title)s") % \
                {'number': track.number, 'title': track.title}

        self.track_label = Label(0.05, "text", 0.5, 0.33, track_label_text)
        self.track_label.set_ellipsize(pango.ELLIPSIZE_END)
        self.track_label.width = 0.4
        self.add(self.track_label)

        # Album name
        if album.year == 0:
            album_label_text = _("From %(title)s") % {'title': album.title}
        else:
            album_label_text = _("From %(title)s, %(year)s") % \
                {'title': album.title, 'year': album.year}

        self.album_label = Label(0.042, "subtitle", 0.5, 0.43,
                                 album_label_text)
        self.album_label.set_ellipsize(pango.ELLIPSIZE_END)
        self.album_label.width = 0.4
        self.add(self.album_label)

        # Artist name
        artist_text = _("By %(artist)s") % {'artist': track.artist}
        self.artist_label = Label(0.042, "subtitle", 0.5, 0.53, artist_text)
        self.artist_label.set_ellipsize(pango.ELLIPSIZE_END)
        self.artist_label.width = 0.4
        self.add(self.artist_label)

        self.progress_bar = ProgressBar(0.5, 0.667, 0.4, 0.04)
        self.progress_bar.media_player = media_player
        self.add(self.progress_bar)
Exemple #13
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)
Exemple #14
0
    def __init__(self, media_player, track, name="playing",
            tab_title=_("Currently playing")):
        Tab.__init__(self, name, tab_title)

        album = track.album

        # Track name
        if track.number == 0:
            track_label_text = track.title
        else:
            track_label_text =  _("From %(number)d. %(title)s") % \
                {'number': track.number, 'title': track.title}

        self.track_label = Label(0.05, "text", 0.5, 0.33, track_label_text)
        self.track_label.set_ellipsize(pango.ELLIPSIZE_END)
        self.track_label.width = 0.4
        self.add(self.track_label)

        # Album name
        if album.year == 0:
            album_label_text = _("From %(title)s") % {'title': album.title}
        else:
            album_label_text = _("From %(title)s, %(year)s") % \
                {'title': album.title, 'year': album.year}

        self.album_label = Label(0.042, "subtitle", 0.5, 0.43, album_label_text)
        self.album_label.set_ellipsize(pango.ELLIPSIZE_END)
        self.album_label.width = 0.4
        self.add(self.album_label)

        # Artist name
        artist_text = _("By %(artist)s") % {'artist': track.artist}
        self.artist_label = Label(0.042, "subtitle", 0.5, 0.53, artist_text)
        self.artist_label.set_ellipsize(pango.ELLIPSIZE_END)
        self.artist_label.width = 0.4
        self.add(self.artist_label)

        self.progress_bar = ProgressBar(0.5, 0.667, 0.4, 0.04)
        self.progress_bar.media_player = media_player
        self.add(self.progress_bar)
Exemple #15
0
 def test_add_tab(self):
     '''Test the use of the add_tab method.'''
     tabs = len(self.tab_group)
     self.tab_group.add_tab(Tab("tab3", "title3", None))
     self.assertEqual(len(self.tab_group), tabs + 1)
Exemple #16
0
 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)
Exemple #17
0
    def __init__(self,
                 albums,
                 move_to_new_screen_callback,
                 name="albums",
                 tab_title=_("Albums")):
        Tab.__init__(self, name, tab_title, move_to_new_screen_callback)

        # Start the loading animation while the menu is loading
        self.throbber = LoadingAnimation(0.6, 0.1)
        self.throbber.show()
        self.add(self.throbber)

        if len(albums) < 4:
            x_percent = 0.2928
            visible_rows = 1
            visible_cols = 3
        elif len(albums) < 13:
            x_percent = 0.1464
            visible_rows = 2
            visible_cols = 6
        else:
            x_percent = 0.1098
            visible_rows = 3
            visible_cols = 8

        # Create albums menu
        self.menu = ImageMenu(0.07, 0.16, x_percent, self.y_for_x(x_percent))
        self.menu.visible_rows = visible_rows
        self.menu.visible_cols = visible_cols
        self.menu.items_per_col = self.menu.visible_rows
        self.add(self.menu)

        albums_list = [[album.album_art_url, album] for album in albums]
        self.menu.async_add_albums(albums_list)

        self.li = ListIndicator(0.77, 0.8, 0.18, 0.045,
                                ListIndicator.HORIZONTAL)
        self.li.set_maximum(len(albums))
        self.li.show()
        self.add(self.li)

        # Create album information (displays current menuitem information)
        self.album_title = Label(0.045, "title", 0.22, 0.79, "")
        self.album_title.set_ellipsize(pango.ELLIPSIZE_END)
        self.album_title.set_line_wrap(False)
        self.album_title.width = 0.366
        self.add(self.album_title)

        self.album_artist = Label(0.037, "subtitle", 0.22, 0.86, "")
        self.album_artist.set_ellipsize(pango.ELLIPSIZE_END)
        self.album_artist.set_line_wrap(False)
        self.album_artist.width = 0.366
        self.add(self.album_artist)

        self.album_tracks = Label(0.037, "subtitle", 0.22, 0.91, "")
        self.add(self.album_tracks)

        self.connect('activated', self._on_activated)
        self.connect('deactivated', self._on_deactivated)
        self.menu.connect("moved", self._update_album_info)
        self.menu.connect("selected", self._handle_select)
        self.menu.connect("activated", self._on_activated)
        self.menu.connect("filled", self._on_menu_filled)