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
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 _add_albums(self, albums): """ Add albums to the view Start lazy loading @param [album ids as int] """ if albums and not self._stop: widget = AlbumSimpleWidget(albums.pop(0), self._requisition.width, self._requisition.height) self._albumbox.insert(widget, -1) widget.show_all() self._lazy_queue.append(widget) GLib.idle_add(self._add_albums, albums) else: GLib.idle_add(self._lazy_loading) self._viewport.add(self._albumbox)
def _add_albums(self, albums): """ Add albums to the view Start lazy loading @param [album ids as int] """ if albums and not self._stop: widget = AlbumSimpleWidget(albums.pop(0), self._genre_ids, self._artist_ids) self._albumbox.insert(widget, -1) widget.show() self._lazy_queue.append(widget) GLib.idle_add(self._add_albums, albums) else: self._stop = False GLib.idle_add(self.lazy_loading) if self._viewport.get_child() is None: self._viewport.add(self._albumbox)
def __add_albums(self, albums): """ Add albums to the view Start lazy loading @param [album ids as int] """ if self._stop: self._stop = False return if albums: widget = AlbumSimpleWidget(albums.pop(0), self.__genre_ids, self.__artist_ids) widget.connect('overlayed', self._on_overlayed) self._box.insert(widget, -1) widget.show() self._lazy_queue.append(widget) GLib.idle_add(self.__add_albums, albums) else: GLib.idle_add(self.lazy_loading) if self._viewport.get_child() is None: self._viewport.add(self._box)
def populate(self, albums): """ Populate albums @param is compilation as bool """ # Add first album to get album size, # used to precalculate next albums size if albums: widget = AlbumSimpleWidget(albums.pop(0)) widget.init_widget() widget.show_all() self._albumbox.insert(widget, -1) # Keep album requisition self._requisition = widget.get_preferred_size()[1] self._add_albums(albums)