Exemple #1
0
    def __init__(self, window, player):
        BaseView.__init__(self, 'search', None, window, Gd.MainViewType.LIST)
        self._items = {}
        self.isStarred = None
        self.iter_to_clean = None

        scale = self.get_scale_factor()
        loading_icon_surface = DefaultIcon(scale).get(DefaultIcon.Type.loading,
                                                      ArtSize.small)
        self._loading_icon = Gdk.pixbuf_get_from_surface(
            loading_icon_surface, 0, 0, loading_icon_surface.get_width(),
            loading_icon_surface.get_height())

        self._add_list_renderers()
        self.player = player
        self.head_iters = [None, None, None, None]
        self.songs_model = self.model
        self.previous_view = None
        self.connect('no-music-found', self._no_music_found_callback)

        self.albums_selected = []
        self._albums = {}
        self._albumWidget = AlbumWidget(player, self)
        self.add(self._albumWidget)

        self.artists_albums_selected = []
        self._artists = {}
        self._artistAlbumsWidget = None

        self._view.get_generic_view().set_show_expanders(False)
        self.items_selected = []
        self.items_selected_callback = None

        self.found_items_number = None
Exemple #2
0
    def __init__(self, window, player):
        """Initialize

        :param GtkWidget window: The main window
        :param player: The main player object
        """
        BaseView.__init__(self, 'artists', _("Artists"), window,
                          Gd.MainViewType.LIST, True)

        self.player = player
        self._artists = {}
        self._albums_selected = []
        self._items_selected = []
        self._items_selected_callback = None
        self._artist_albums_stack = Gtk.Stack(
            transition_type=Gtk.StackTransitionType.CROSSFADE)
        self._artist_albums_widget = Gtk.Frame(shadow_type=Gtk.ShadowType.NONE,
                                               hexpand=True)
        self._artist_albums_stack.add_named(self._artist_albums_widget,
                                            "sidebar")
        self._artist_albums_stack.set_visible_child_name("sidebar")
        self._view.set_shadow_type(Gtk.ShadowType.IN)
        self._view.get_style_context().add_class('side-panel')
        self._view.set_hexpand(False)
        self._view.get_generic_view().get_selection().set_mode(
            Gtk.SelectionMode.SINGLE)
        self._grid.attach(self._artist_albums_stack, 2, 0, 2, 2)
        self._add_list_renderers()
        self._view.get_generic_view().get_style_context().remove_class(
            'content-view')
        self.show_all()
        self._view.hide()
Exemple #3
0
    def __init__(self, window, player):
        """Initialize

        :param GtkWidget window: The main window
        :param player: The main player object
        """
        BaseView.__init__(self, 'artists', _("Artists"), window,
                          Gd.MainViewType.LIST, True)

        self.player = player
        self._artists = {}
        self._albums_selected = []
        self._items_selected = []
        self._items_selected_callback = None
        self._artist_albums_stack = Gtk.Stack(
            transition_type=Gtk.StackTransitionType.CROSSFADE)
        self._artist_albums_widget = Gtk.Frame(shadow_type=Gtk.ShadowType.NONE,
                                               hexpand=True)
        self._artist_albums_stack.add_named(self._artist_albums_widget,
                                            "sidebar")
        self._artist_albums_stack.set_visible_child_name("sidebar")
        self.view.set_shadow_type(Gtk.ShadowType.IN)
        self.view.get_style_context().add_class('side-panel')
        self.view.set_hexpand(False)
        self.view.get_generic_view().get_selection().set_mode(
            Gtk.SelectionMode.SINGLE)
        self._grid.attach(self._artist_albums_stack, 2, 0, 2, 2)
        self._add_list_renderers()
        self.view.get_generic_view().get_style_context().remove_class(
            'content-view')
        self.show_all()
        self.view.hide()
Exemple #4
0
 def __init__(self, window, player):
     BaseView.__init__(self, 'albums', _("Albums"), window, None)
     self._albumWidget = AlbumWidget(player, self)
     self.player = player
     self.add(self._albumWidget)
     self.albums_selected = []
     self.all_items = []
     self.items_selected = []
     self.items_selected_callback = None
     self._add_list_renderers()
Exemple #5
0
 def __init__(self, window, player):
     BaseView.__init__(self, "albums", _("Albums"), window, None)
     self._albumWidget = AlbumWidget(player, self)
     self.player = player
     self.add(self._albumWidget)
     self.albums_selected = []
     self.all_items = []
     self.items_selected = []
     self.items_selected_callback = None
     self._add_list_renderers()
Exemple #6
0
    def _on_header_bar_toggled(self, button):
        BaseView._on_header_bar_toggled(self, button)

        view_selection = self._view.get_generic_view().get_selection()
        if button.get_active():
            self.text_renderer.set_fixed_size(178, -1)
            self._last_selection = view_selection.get_selected()[1]
            view_selection.set_mode(Gtk.SelectionMode.NONE)
        else:
            self.text_renderer.set_fixed_size(220, -1)
            view_selection.set_mode(Gtk.SelectionMode.SINGLE)
            if self._last_selection is not None:
                view_selection.select_iter(self._last_selection)
Exemple #7
0
    def _on_header_bar_toggled(self, button):
        BaseView._on_header_bar_toggled(self, button)

        view_selection = self.view.get_generic_view().get_selection()
        if button.get_active():
            self.text_renderer.set_fixed_size(178, -1)
            self._last_selection = view_selection.get_selected()[1]
            view_selection.set_mode(Gtk.SelectionMode.NONE)
        else:
            self.text_renderer.set_fixed_size(220, -1)
            view_selection.set_mode(Gtk.SelectionMode.SINGLE)
            if self._last_selection is not None:
                view_selection.select_iter(self._last_selection)
Exemple #8
0
    def __init__(self, window, player):
        BaseView.__init__(self, 'emptysearch', None, window, Gd.MainViewType.LIST)
        self._artistAlbumsWidget = None
        self._albumWidget = None
        self.player = player

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Music/NoMusic.ui')
        widget = builder.get_object('container')
        widget.set_vexpand(True)
        widget.set_hexpand(True)
        widget.get_children()[1].get_children()[1].set_text(_("Try a different search"))
        widget.show_all()
        self._box.add(widget)
Exemple #9
0
 def __init__(self, window, player):
     BaseView.__init__(self, 'songs', _("Songs"), window,
                       Gd.MainViewType.LIST)
     self._items = {}
     self.isStarred = None
     self.iter_to_clean = None
     self.view.get_generic_view().get_style_context()\
         .add_class('songs-list')
     self._iconHeight = 32
     self._iconWidth = 32
     self._add_list_renderers()
     self.view.get_generic_view().get_style_context().remove_class(
         'content-view')
     self.player = player
     self.player.connect('playlist-item-changed', self.update_model)
    def __init__(self, window, player):
        BaseView.__init__(self, 'emptysearch', None, window,
                          Gd.MainViewType.LIST)
        self._artistAlbumsWidget = None
        self._albumWidget = None
        self.player = player

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Music/NoMusic.ui')
        widget = builder.get_object('container')
        widget.set_vexpand(True)
        widget.set_hexpand(True)
        widget.get_children()[1].get_children()[1].set_text(
            _("Try a different search"))
        widget.show_all()
        self._box.add(widget)
Exemple #11
0
    def __init__(self, window, player):
        """Initialize

        :param GtkWidget window: The main window
        :param player: The main player object
        """
        BaseView.__init__(self, 'songs', _("Songs"),
                          window, Gd.MainViewType.LIST)

        self._offset = 0
        self._iter_to_clean = None

        view_style  = self.view.get_generic_view().get_style_context()
        view_style.add_class('songs-list')
        view_style.remove_class('content-view')

        self._add_list_renderers()

        self.player = player
        self.player.connect('playlist-item-changed', self.update_model)
Exemple #12
0
    def __init__(self, window, player):
        """Initialize

        :param GtkWidget window: The main window
        :param player: The main player object
        """
        BaseView.__init__(self, 'songs', _("Songs"), window,
                          Gd.MainViewType.LIST)

        self._offset = 0
        self._iter_to_clean = None

        view_style = self._view.get_generic_view().get_style_context()
        view_style.add_class('songs-list')
        view_style.remove_class('content-view')

        self._add_list_renderers()

        self.player = player
        self.player.connect('playlist-item-changed', self.update_model)
Exemple #13
0
    def __init__(self, window, player):
        BaseView.__init__(self, 'search', None, window, Gd.MainViewType.LIST)
        self._items = {}
        self.isStarred = None
        self.iter_to_clean = None

        scale = self.get_scale_factor()
        loading_icon_surface = DefaultIcon(scale).get(DefaultIcon.Type.loading,
                                                      ArtSize.small)
        self._loading_icon = Gdk.pixbuf_get_from_surface(
            loading_icon_surface,
            0,
            0,
            loading_icon_surface.get_width(),
            loading_icon_surface.get_height())

        self._add_list_renderers()
        self.player = player
        self.head_iters = [None, None, None, None]
        self.songs_model = self.model
        self.previous_view = None
        self.connect('no-music-found', self._no_music_found_callback)

        self.albums_selected = []
        self._albums = {}
        self._albumWidget = AlbumWidget(player, self)
        self.add(self._albumWidget)

        self.artists_albums_selected = []
        self._artists = {}
        self._artistAlbumsWidget = None

        self.view.get_generic_view().set_show_expanders(False)
        self.items_selected = []
        self.items_selected_callback = None

        self.found_items_number = None
    def __init__(self, window, player):
        self.playlists_sidebar = Gd.MainView()

        BaseView.__init__(self, 'playlists', _("Playlists"), window,
                          Gd.MainViewType.LIST, True, self.playlists_sidebar)

        self.view.get_generic_view().get_style_context()\
            .add_class('songs-list')
        self._add_list_renderers()
        self.view.get_generic_view().get_style_context().remove_class(
            'content-view')

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Music/PlaylistControls.ui')
        self.headerbar = builder.get_object('grid')
        self.name_label = builder.get_object('playlist_name')
        self.songs_count_label = builder.get_object('songs_count')
        self.menubutton = builder.get_object('playlist_menubutton')
        playlistPlayAction = Gio.SimpleAction.new('playlist_play', None)
        playlistPlayAction.connect('activate', self._on_play_activate)
        window.add_action(playlistPlayAction)
        self.playlistDeleteAction = Gio.SimpleAction.new(
            'playlist_delete', None)
        self.playlistDeleteAction.connect('activate', self._on_delete_activate)
        window.add_action(self.playlistDeleteAction)
        self._grid.insert_row(0)
        self._grid.attach(self.headerbar, 1, 0, 1, 1)

        self.playlists_model = Gtk.ListStore(
            GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING,
            GObject.TYPE_STRING, GdkPixbuf.Pixbuf, GObject.TYPE_OBJECT,
            GObject.TYPE_BOOLEAN, GObject.TYPE_INT, GObject.TYPE_STRING,
            GObject.TYPE_INT, GObject.TYPE_BOOLEAN, GObject.TYPE_INT)

        self.playlists_sidebar.set_view_type(Gd.MainViewType.LIST)
        self.playlists_sidebar.set_model(self.playlists_model)
        self.playlists_sidebar.set_hexpand(False)
        self.playlists_sidebar.get_style_context().add_class('side-panel')
        self.playlists_sidebar.get_generic_view().get_selection().set_mode(
            Gtk.SelectionMode.SINGLE)
        self.playlists_sidebar.connect('item-activated',
                                       self._on_playlist_activated)
        self._grid.insert_column(0)
        self._grid.child_set_property(self.stack, 'top-attach', 0)
        self._grid.child_set_property(self.stack, 'height', 2)
        self._add_sidebar_renderers()
        self.playlists_sidebar.get_generic_view().get_style_context(
        ).remove_class('content-view')

        self.iter_to_clean = None
        self.iter_to_clean_model = None
        self.current_playlist = None
        self.current_playlist_index = None
        self.pl_todelete = None
        self.pl_todelete_index = None
        self.really_delete = True
        self.songs_count = 0
        self.window = window
        self._update_songs_count()
        self.player = player
        self.player.connect('playlist-item-changed', self.update_model)
        playlists.connect('playlist-created', self._on_playlist_created)
        playlists.connect('playlist-updated', self.on_playlist_update)
        playlists.connect('song-added-to-playlist',
                          self._on_song_added_to_playlist)
        playlists.connect('song-removed-from-playlist',
                          self._on_song_removed_from_playlist)
        self.show_all()
Exemple #15
0
    def __init__(self, window, player):
        self.playlists_sidebar = Gd.MainView()

        BaseView.__init__(self, 'playlists', _("Playlists"), window,
                               Gd.MainViewType.LIST, True, self.playlists_sidebar)

        self.view.get_generic_view().get_style_context()\
            .add_class('songs-list')
        self._add_list_renderers()
        self.view.get_generic_view().get_style_context().remove_class('content-view')

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Music/PlaylistControls.ui')
        self.headerbar = builder.get_object('grid')
        self.name_label = builder.get_object('playlist_name')
        self.songs_count_label = builder.get_object('songs_count')
        self.menubutton = builder.get_object('playlist_menubutton')
        playlistPlayAction = Gio.SimpleAction.new('playlist_play', None)
        playlistPlayAction.connect('activate', self._on_play_activate)
        window.add_action(playlistPlayAction)
        self.playlistDeleteAction = Gio.SimpleAction.new('playlist_delete', None)
        self.playlistDeleteAction.connect('activate', self._on_delete_activate)
        window.add_action(self.playlistDeleteAction)
        self._grid.insert_row(0)
        self._grid.attach(self.headerbar, 1, 0, 1, 1)

        self.playlists_model = Gtk.ListStore(
            GObject.TYPE_STRING,
            GObject.TYPE_STRING,
            GObject.TYPE_STRING,
            GObject.TYPE_STRING,
            GdkPixbuf.Pixbuf,
            GObject.TYPE_OBJECT,
            GObject.TYPE_BOOLEAN,
            GObject.TYPE_INT,
            GObject.TYPE_STRING,
            GObject.TYPE_INT,
            GObject.TYPE_BOOLEAN,
            GObject.TYPE_INT
        )

        self.playlists_sidebar.set_view_type(Gd.MainViewType.LIST)
        self.playlists_sidebar.set_model(self.playlists_model)
        self.playlists_sidebar.set_hexpand(False)
        self.playlists_sidebar.get_style_context().add_class('side-panel')
        self.playlists_sidebar.get_generic_view().get_selection().set_mode(
            Gtk.SelectionMode.SINGLE)
        self.playlists_sidebar.connect('item-activated', self._on_playlist_activated)
        self._grid.insert_column(0)
        self._grid.child_set_property(self.stack, 'top-attach', 0)
        self._grid.child_set_property(self.stack, 'height', 2)
        self._add_sidebar_renderers()
        self.playlists_sidebar.get_generic_view().get_style_context().remove_class('content-view')

        self.iter_to_clean = None
        self.iter_to_clean_model = None
        self.current_playlist = None
        self.current_playlist_index = None
        self.pl_todelete = None
        self.pl_todelete_index = None
        self.really_delete = True
        self.songs_count = 0
        self.window = window
        self._update_songs_count()
        self.player = player
        self.player.connect('playlist-item-changed', self.update_model)
        playlists.connect('playlist-created', self._on_playlist_created)
        playlists.connect('playlist-updated', self.on_playlist_update)
        playlists.connect('song-added-to-playlist', self._on_song_added_to_playlist)
        playlists.connect('song-removed-from-playlist', self._on_song_removed_from_playlist)
        self.show_all()