예제 #1
0
 def __init__(self, album_id, genre_id, popover, size_group):
     """
         Init detailed album widget
         @param album id as int
         @param genre id as int
         @param size group as Gtk.SizeGroup
     """
     AlbumDetailedWidget.__init__(self, album_id, genre_id, [], popover, size_group)
     self._artist_label.set_text(self._album.artist_name)
     self._artist_label.show()
예제 #2
0
 def __init__(self, album_id, genre_ids, artist_ids, show_cover):
     """
         Init detailed album widget
         @param album id as int
         @param genre ids as [int]
         @param artist ids as [int]
         @param show cover as bool
     """
     AlbumDetailedWidget.__init__(self, album_id, genre_ids, artist_ids,
                                  show_cover)
     self._artist_label.set_text(", ".join(self._album.artists))
     self._artist_label.show()
예제 #3
0
 def __init__(self, album_id, genre_ids, artist_ids, update_albums=True):
     """
         Init detailed album widget
         @param album id as int
         @param genre ids as [int]
         @param artist ids as [int]
         @param update albums as bool: update albums on play
     """
     AlbumDetailedWidget.__init__(self, album_id, genre_ids, artist_ids,
                                  update_albums)
     self._artist_label.set_text(", ".join(self._album.artists))
     self._artist_label.show()
예제 #4
0
 def __init__(self, album_id, genre_id, pop_allowed, size_group):
     """
         Init detailed album widget
         @param album id as int
         @param genre id as int
         @param parent width as int
         @param pop_allowed as bool if widget can show popovers
         @param size group as Gtk.SizeGroup
     """
     AlbumDetailedWidget.__init__(self, album_id, genre_id, pop_allowed, size_group)
     self._artist_label.set_text(self._album.artist_name)
     self._artist_label.show()
예제 #5
0
 def __init__(self, album_id, genre_ids, artist_ids,
              size_group, update_albums=True):
     """
         Init detailed album widget
         @param album id as int
         @param genre ids as [int]
         @param artist ids as [int]
         @param size group as Gtk.SizeGroup
         @param update albums as bool: update albums on play
     """
     AlbumDetailedWidget.__init__(self, album_id, genre_ids, artist_ids,
                                  size_group, update_albums)
     self._artist_label.set_text(self._album.artist_name)
     self._artist_label.show()
예제 #6
0
 def _add_albums(self, albums, genre_id):
     size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
     if albums and not self._stop:
         widget = AlbumDetailedWidget(albums.pop(0),
                                      genre_id,
                                      self._show_menu,
                                      False,
                                      size_group)
         widget.show()
         start_new_thread(widget.populate, ())
         self._albumbox.add(widget)
         GLib.idle_add(self._add_albums, albums, genre_id)
     else:
         self._stop = False
예제 #7
0
 def _add_albums(self, albums):
     """
         Pop an album and add it to the view,
         repeat operation until album list is empty
         @param [album ids as int]
     """
     size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
     widget = AlbumDetailedWidget(albums.pop(0), self._genre_id, self._artist_id is not None, size_group)
     widget.connect("finished", self._on_album_finished, albums)
     widget.show()
     t = Thread(target=widget.populate)
     t.daemon = True
     t.start()
     self._albumbox.add(widget)
예제 #8
0
 def _add_albums(self, albums):
     """
         Pop an album and add it to the view,
         repeat operation until album list is empty
         @param [album ids as int]
     """
     size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
     widget = AlbumDetailedWidget(albums.pop(0),
                                  self._genre_id,
                                  self._pop_allowed,
                                  False,
                                  size_group)
     widget.connect('finished', self._on_album_finished, albums)
     widget.show()
     start_new_thread(widget.populate, ())
     self._albumbox.add(widget)
예제 #9
0
 def _add_albums(self, albums, genre_id):
     """
         Pop an album and add it to the view,
         repeat operation until album list is empty
         @param [album ids as int]
         @param genre id as int
     """
     size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
     if albums and not self._stop:
         widget = AlbumDetailedWidget(albums.pop(0),
                                      genre_id,
                                      self._pop_allowed,
                                      False,
                                      size_group)
         widget.show()
         start_new_thread(widget.populate, ())
         self._albumbox.add(widget)
         GLib.idle_add(self._add_albums, albums, genre_id)
     else:
         self._stop = False
예제 #10
0
 def _add_albums(self, albums):
     """
         Pop an album and add it to the view,
         repeat operation until album list is empty
         @param [album ids as int]
     """
     if albums and not self._stop:
         album_id = albums.pop(0)
         widget = AlbumDetailedWidget(album_id,
                                      self._genre_ids,
                                      self._artist_ids,
                                      self._show_cover)
         self._lazy_queue.append(widget)
         widget.show()
         self._albumbox.add(widget)
         GLib.idle_add(self._add_albums, albums)
     else:
         self._spinner.stop()
         self._spinner.hide()
         self.emit('populated')
         GLib.idle_add(self.lazy_loading)
예제 #11
0
 def _add_albums(self, albums):
     """
         Pop an album and add it to the view,
         repeat operation until album list is empty
         @param [album ids as int]
     """
     if albums and not self._stop:
         album_id = albums.pop(0)
         widget = AlbumDetailedWidget(album_id,
                                      self._genre_ids,
                                      self._artist_ids)
         self._lazy_queue.append(widget)
         # Not needed if only one album
         if self._albums_count == 1:
             widget.disable_play_all()
         widget.show()
         self._albumbox.add(widget)
         GLib.idle_add(self._add_albums, albums)
     else:
         if self._viewport.get_child() is None:
             self._viewport.add(self._albumbox)
         self.emit('populated')
         GLib.idle_add(self.lazy_loading)
예제 #12
0
 def _populate_context(self, album_id):
     size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
     self._context_widget = AlbumDetailedWidget(album_id,
                                                self._genre_id,
                                                True,
                                                True,
                                                size_group)
     start_new_thread(self._context_widget.populate, ())
     self._context_widget.show()
     view = AlbumContextView(self._context_widget)
     view.show()
     self._context.add(view)
     self._context.set_visible_child(view)
     self._context.clean_old_views(view)
예제 #13
0
 def _populate_context(self, album_id):
     """
         populate context view
         @param album id as int
     """
     size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
     self._context_widget = AlbumDetailedWidget(album_id,
                                                self._genre_id,
                                                True,
                                                True,
                                                size_group)
     self._context_widget.populate()
     self._context_widget.show()
     view = AlbumContextView(self._context_widget)
     view.show()
     self._context.add(view)
     self._context.set_visible_child(view)
     self._context.clean_old_views(view)
예제 #14
0
 def __add_albums(self, albums):
     """
         Pop an album and add it to the view,
         repeat operation until album list is empty
         @param [album ids as int]
     """
     if albums and not self._stop:
         album_id = albums.pop(0)
         widget = AlbumDetailedWidget(album_id, self._genre_ids,
                                      self._artist_ids, self.__show_cover)
         widget.set_filter_func(self._filter_func)
         widget.connect('overlayed', self._on_overlayed)
         self._lazy_queue.append(widget)
         widget.show()
         self._albumbox.add(widget)
         GLib.idle_add(self.__add_albums, albums)
     else:
         self.__spinner.stop()
         self.__spinner.hide()
         self.emit('populated')
         GLib.idle_add(self.lazy_loading)
예제 #15
0
 def _add_albums(self, albums):
     """
         Pop an album and add it to the view,
         repeat operation until album list is empty
         @param [album ids as int]
     """
     size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
     widget = AlbumDetailedWidget(albums.pop(0), self._genre_id,
                                  self._artist_id is not None, size_group)
     widget.connect('finished', self._on_album_finished, albums)
     widget.show()
     t = Thread(target=widget.populate)
     t.daemon = True
     t.start()
     self._albumbox.add(widget)
예제 #16
0
 def _add_albums(self, albums):
     """
         Pop an album and add it to the view,
         repeat operation until album list is empty
         @param [album ids as int]
     """
     size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
     widget = AlbumDetailedWidget(albums.pop(0),
                                  self._genre_ids,
                                  self._artist_ids,
                                  size_group)
     # Not needed if only one album
     if self._albums_count == 1:
         widget.disable_play_all()
     widget.connect('finished', self._on_album_finished, albums)
     widget.show()
     t = Thread(target=widget.populate)
     t.daemon = True
     t.start()
     self._albumbox.add(widget)
예제 #17
0
 def _add_albums(self, albums):
     """
         Pop an album and add it to the view,
         repeat operation until album list is empty
         @param [album ids as int]
     """
     if albums and not self._stop:
         album_id = albums.pop(0)
         widget = AlbumDetailedWidget(album_id,
                                      self._genre_ids,
                                      self._artist_ids)
         self._lazy_queue.append(widget)
         # Not needed if only one album
         if self._albums_count == 1:
             widget.disable_play_all()
         widget.show()
         self._albumbox.add(widget)
         GLib.idle_add(self._add_albums, albums)
     else:
         if self._viewport.get_child() is None:
             self._viewport.add(self._albumbox)
         self.emit('populated')
         GLib.idle_add(self.lazy_loading)
예제 #18
0
class AlbumView(View):
    """
        Init album view ui with a scrolled flow box and a scrolled context view
        @param navigation id as int
    """
    def __init__(self, navigation_id):
        View.__init__(self)
        self._signal = None
        self._context_album_id = None
        self._genre_id = navigation_id
        self._albumsongs = None
        self._context_widget = None

        self._albumbox = Gtk.FlowBox()
        self._albumbox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._albumbox.connect("child-activated", self._on_album_activated)
        self._albumbox.set_max_children_per_line(100)
        self._albumbox.show()

        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.add(self._albumbox)
        self._scrolledWindow.set_property('expand', True)

        self._context = ViewContainer(500)

        separator = Gtk.Separator()
        separator.show()

        self._paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
        self._paned.pack1(self._scrolledWindow)
        self._paned.pack2(self._context, True, False)
        height = Objects.settings.get_value('paned-context-height').get_int32()
        # We set a stupid max value, safe as self._context is shrinked
        if height == -1:
            height = Objects.window.get_allocated_height()
        self._paned.set_position(height)
        self._paned.connect('notify::position', self._on_position_notify)
        self._paned.show()
        self.add(self._paned)

    """
        Populate albums, thread safe
        @param navigation id as int
    """

    def populate(self, navigation_id):
        sql = Objects.db.get_cursor()
        if self._genre_id == Navigation.ALL:
            albums = Objects.albums.get_ids(None, None, sql)
        elif self._genre_id == Navigation.POPULARS:
            albums = Objects.albums.get_populars(sql)
        elif self._genre_id == Navigation.RECENTS:
            albums = Objects.albums.get_recents(sql)
        elif self._genre_id == Navigation.COMPILATIONS:
            albums = Objects.albums.get_compilations(navigation_id, sql)
        else:
            albums = Objects.albums.get_ids(None, self._genre_id, sql)
        GLib.idle_add(self._add_albums, albums)
        sql.close()

#######################
# PRIVATE             #
#######################

    """
        Return view children
        @return [AlbumWidget]
    """
    def _get_children(self):
        children = []
        for child in self._albumbox.get_children():
            for widget in child.get_children():
                children.append(widget)
        return children

    """
        populate context view
        @param album id as int
    """

    def _populate_context(self, album_id):
        size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
        self._context_widget = AlbumDetailedWidget(album_id, self._genre_id,
                                                   True, True, size_group)
        start_new_thread(self._context_widget.populate, ())
        self._context_widget.show()
        view = AlbumContextView(self._context_widget)
        view.show()
        self._context.add(view)
        self._context.set_visible_child(view)
        self._context.clean_old_views(view)

    """
        Save paned position
        @param paned as Gtk.Paned
        @param param as Gtk.Param
    """

    def _on_position_notify(self, paned, param):
        Objects.settings.set_value('paned-context-height',
                                   GLib.Variant('i', paned.get_position()))
        return False

    """
        Show Context view for activated album
        @param flowbox, children
    """

    def _on_album_activated(self, flowbox, child):
        if self._context_album_id == child.get_child().get_id():
            if Objects.settings.get_value('auto-play'):
                Objects.player.play_album(self._context_album_id)
            else:
                self._context_album_id = None
                self._context.hide()
        else:
            self._context_album_id = child.get_child().get_id()
            self._populate_context(self._context_album_id)
            self._context.show()

    """
        Pop an album and add it to the view,
        repeat operation until album list is empty
        @param [album ids as int]
    """

    def _add_albums(self, albums):
        if albums and not self._stop:
            widget = AlbumSimpleWidget(albums.pop(0))
            widget.show()
            self._albumbox.insert(widget, -1)
            GLib.idle_add(self._add_albums, albums)
        else:
            self._stop = False
예제 #19
0
class AlbumsView(View):
    """
        Show albums in a box
    """

    def __init__(self, genre_id, is_compilation):
        """
            Init album view
            @param genre id as int
            @param is compilation as bool
        """
        View.__init__(self)
        self._signal = None
        self._context_album_id = None
        self._genre_id = genre_id
        self._is_compilation = is_compilation
        self._albumsongs = None
        self._context_widget = None

        self._albumbox = Gtk.FlowBox()
        self._albumbox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._albumbox.connect('child-activated', self._on_album_activated)
        self._albumbox.set_property('column-spacing', 5)
        self._albumbox.set_property('row-spacing', 5)
        self._albumbox.set_homogeneous(True)
        self._albumbox.set_max_children_per_line(1000)
        self._albumbox.show()

        self._viewport.set_property('valign', Gtk.Align.START)
        self._viewport.set_property('margin', 5)
        self._viewport.add(self._albumbox)
        self._scrolledWindow.set_property('expand', True)

        self._context = ViewContainer(500)

        separator = Gtk.Separator()
        separator.show()

        self._paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
        self._paned.pack1(self._scrolledWindow, True, False)
        self._paned.pack2(self._context, False, False)
        height = Lp.settings.get_value('paned-context-height').get_int32()
        # We set a stupid max value, safe as self._context is shrinked
        if height == -1:
            height = Lp.window.get_allocated_height()
        self._paned.set_position(height)
        self._paned.connect('notify::position', self._on_position_notify)
        self._paned.show()
        self.add(self._paned)

    def populate(self):
        """
            Populate albums
            @param is compilation as bool
            @thread safe
        """
        albums = self._get_albums()
        GLib.idle_add(self._add_albums, albums)

#######################
# PRIVATE             #
#######################
    def _get_albums(self):
        """
            Get albums
            @return album ids as [int]
            @thread safe
        """
        sql = Lp.db.get_cursor()
        if self._genre_id == Type.ALL:
            if self._is_compilation:
                albums = Lp.albums.get_compilations(None,
                                                    sql)
            else:
                albums = Lp.albums.get_ids(None, None, sql)
        elif self._genre_id == Type.POPULARS:
            albums = Lp.albums.get_populars(sql)
        elif self._genre_id == Type.RECENTS:
            albums = Lp.albums.get_recents(sql)
        elif self._genre_id == Type.RANDOMS:
            albums = Lp.albums.get_randoms(sql)
        elif self._is_compilation:
            albums = Lp.albums.get_compilations(self._genre_id,
                                                sql)
        else:
            albums = []
            if Lp.settings.get_value('show-compilations'):
                albums += Lp.albums.get_compilations(self._genre_id,
                                                    sql)
            albums += Lp.albums.get_ids(None, self._genre_id, sql)
        sql.close()
        return albums

    def _get_children(self):
        """
            Return view children
            @return [AlbumWidget]
        """
        children = []
        for child in self._albumbox.get_children():
            widget = child.get_child()
            children.append(widget)
        if self._context_widget is not None:
            children.append(self._context_widget)
        return children

    def _populate_context(self, album_id):
        """
            populate context view
            @param album id as int
        """
        size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
        self._context_widget = AlbumDetailedWidget(album_id,
                                                   self._genre_id,
                                                   True,
                                                   True,
                                                   size_group)
        start_new_thread(self._context_widget.populate, ())
        self._context_widget.show()
        view = AlbumContextView(self._context_widget)
        view.show()
        self._context.add(view)
        self._context.set_visible_child(view)
        self._context.clean_old_views(view)

    def _add_albums(self, albums):
        """
            Pop an album and add it to the view,
            repeat operation until album list is empty
            @param [album ids as int]
        """
        if albums and not self._stop:
            widget = AlbumSimpleWidget(albums.pop(0))
            widget.show()
            self._albumbox.insert(widget, -1)
            GLib.idle_add(self._add_albums, albums)
        else:
            self._stop = False

    def _on_position_notify(self, paned, param):
        """
            Save paned position
            @param paned as Gtk.Paned
            @param param as Gtk.Param
        """
        Lp.settings.set_value('paned-context-height',
                              GLib.Variant('i', paned.get_position()))
        return False

    def _on_album_activated(self, flowbox, child):
        """
            Show Context view for activated album
            @param flowbox as Gtk.Flowbox
            @child as Gtk.FlowboxChild
        """
        if self._context_album_id == child.get_child().get_id():
            self._context_album_id = None
            self._context.hide()
            self._context_widget.destroy()
            self._context_widget = None
        else:
            self._context_album_id = child.get_child().get_id()
            if Lp.settings.get_value('auto-play'):
                Lp.player.play_album(self._context_album_id, self._genre_id)
            self._populate_context(self._context_album_id)
            self._context.show()
예제 #20
0
class AlbumView(View):
    """
        Init album view ui with a scrolled flow box and a scrolled context view
        @param navigation id as int
    """
    def __init__(self, navigation_id):
        View.__init__(self)
        self._signal = None
        self._context_album_id = None
        self._genre_id = navigation_id
        self._albumsongs = None
        self._context_widget = None

        self._albumbox = Gtk.FlowBox()
        self._albumbox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._albumbox.connect("child-activated", self._on_album_activated)
        self._albumbox.set_max_children_per_line(100)
        self._albumbox.show()

        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.add(self._albumbox)
        self._scrolledWindow.set_property('expand', True)

        self._context = ViewContainer(500)

        separator = Gtk.Separator()
        separator.show()

        self._paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
        self._paned.pack1(self._scrolledWindow)
        self._paned.pack2(self._context, True, False)
        height = Objects.settings.get_value(
                                         'paned-context-height').get_int32()
        # We set a stupid max value, safe as self._context is shrinked
        if height == -1:
            height = Objects.window.get_allocated_height()
        self._paned.set_position(height)
        self._paned.connect('notify::position', self._on_position_notify)
        self._paned.show()
        self.add(self._paned)

    """
        Populate albums, thread safe
        @param navigation id as int
    """
    def populate(self, navigation_id):
        sql = Objects.db.get_cursor()
        if self._genre_id == Navigation.ALL:
            albums = Objects.albums.get_ids(None, None, sql)
        elif self._genre_id == Navigation.POPULARS:
            albums = Objects.albums.get_populars(sql)
        elif self._genre_id == Navigation.RECENTS:
            albums = Objects.albums.get_recents(sql)
        elif self._genre_id == Navigation.COMPILATIONS:
            albums = Objects.albums.get_compilations(navigation_id,
                                                     sql)
        else:
            albums = Objects.albums.get_ids(None, self._genre_id, sql)
        GLib.idle_add(self._add_albums, albums)
        sql.close()

#######################
# PRIVATE             #
#######################
    """
        Return view children
        @return [AlbumWidget]
    """
    def _get_children(self):
        children = []
        for child in self._albumbox.get_children():
            for widget in child.get_children():
                children.append(widget)
        return children

    """
        populate context view
        @param album id as int
    """
    def _populate_context(self, album_id):
        size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
        self._context_widget = AlbumDetailedWidget(album_id,
                                                   self._genre_id,
                                                   True,
                                                   True,
                                                   size_group)
        start_new_thread(self._context_widget.populate, ())
        self._context_widget.show()
        view = AlbumContextView(self._context_widget)
        view.show()
        self._context.add(view)
        self._context.set_visible_child(view)
        self._context.clean_old_views(view)

    """
        Save paned position
        @param paned as Gtk.Paned
        @param param as Gtk.Param
    """
    def _on_position_notify(self, paned, param):
        Objects.settings.set_value(
                            'paned-context-height',
                            GLib.Variant('i', paned.get_position()))
        return False

    """
        Show Context view for activated album
        @param flowbox, children
    """
    def _on_album_activated(self, flowbox, child):
        if self._context_album_id == child.get_child().get_id():
            if Objects.settings.get_value('auto-play'):
                Objects.player.play_album(self._context_album_id)
            else:
                self._context_album_id = None
                self._context.hide()
        else:
            self._context_album_id = child.get_child().get_id()
            self._populate_context(self._context_album_id)
            self._context.show()

    """
        Pop an album and add it to the view,
        repeat operation until album list is empty
        @param [album ids as int]
    """
    def _add_albums(self, albums):
        if albums and not self._stop:
            widget = AlbumSimpleWidget(albums.pop(0))
            widget.show()
            self._albumbox.insert(widget, -1)
            GLib.idle_add(self._add_albums, albums)
        else:
            self._stop = False
예제 #21
0
class AlbumsView(View):
    """
        Show albums in a box
    """
    def __init__(self, genre_id, is_compilation):
        """
            Init album view
            @param genre id as int
            @param is compilation as bool
        """
        View.__init__(self)
        self._signal = None
        self._context_album_id = None
        self._genre_id = genre_id
        self._is_compilation = is_compilation
        self._albumsongs = None
        self._context_widget = None

        self._albumbox = Gtk.FlowBox()
        self._albumbox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._albumbox.connect('child-activated', self._on_album_activated)
        self._albumbox.set_property('column-spacing', 5)
        self._albumbox.set_property('row-spacing', 5)
        self._albumbox.set_homogeneous(True)
        self._albumbox.set_max_children_per_line(1000)
        self._albumbox.show()

        self._viewport.set_property('valign', Gtk.Align.START)
        self._viewport.set_property('margin', 5)
        self._viewport.add(self._albumbox)
        self._scrolledWindow.set_property('expand', True)

        self._context = ViewContainer(500)

        separator = Gtk.Separator()
        separator.show()

        self._paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
        self._paned.pack1(self._scrolledWindow, True, False)
        self._paned.pack2(self._context, False, False)
        height = Lp.settings.get_value('paned-context-height').get_int32()
        # We set a stupid max value, safe as self._context is shrinked
        if height == -1:
            height = Lp.window.get_allocated_height()
        self._paned.set_position(height)
        self._paned.connect('notify::position', self._on_position_notify)
        self._paned.show()
        self.add(self._paned)

    def populate(self, albums):
        """
            Populate albums
            @param is compilation as bool
        """
        self._add_albums(albums)

#######################
# PRIVATE             #
#######################

    def _get_children(self):
        """
            Return view children
            @return [AlbumWidget]
        """
        children = []
        for child in self._albumbox.get_children():
            widget = child.get_child()
            children.append(widget)
        if self._context_widget is not None:
            children.append(self._context_widget)
        return children

    def _populate_context(self, album_id):
        """
            populate context view
            @param album id as int
        """
        size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
        self._context_widget = AlbumDetailedWidget(album_id, self._genre_id,
                                                   True, True, size_group)
        self._context_widget.populate()
        self._context_widget.show()
        view = AlbumContextView(self._context_widget)
        view.show()
        self._context.add(view)
        self._context.set_visible_child(view)
        self._context.clean_old_views(view)

    def _add_albums(self, albums):
        """
            Pop an album and add it to the view,
            repeat operation until album list is empty
            @param [album ids as int]
        """
        if albums and not self._stop:
            widget = AlbumSimpleWidget(albums.pop(0))
            widget.show()
            self._albumbox.insert(widget, -1)
            GLib.idle_add(self._add_albums, albums)
        else:
            self._stop = False

    def _on_position_notify(self, paned, param):
        """
            Save paned position
            @param paned as Gtk.Paned
            @param param as Gtk.Param
        """
        Lp.settings.set_value('paned-context-height',
                              GLib.Variant('i', paned.get_position()))
        return False

    def _on_album_activated(self, flowbox, child):
        """
            Show Context view for activated album
            @param flowbox as Gtk.Flowbox
            @child as Gtk.FlowboxChild
        """
        if self._context_album_id == child.get_child().get_id():
            self._context_album_id = None
            self._context.hide()
            self._context_widget.destroy()
            self._context_widget = None
        else:
            self._context_album_id = child.get_child().get_id()
            if Lp.settings.get_value('auto-play'):
                Lp.player.play_album(self._context_album_id, self._genre_id)
            self._populate_context(self._context_album_id)
            self._context.show()