[gnome-music/wip/mschraal/async-queue] artistsview: Add delayed retrieval of artist art
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/async-queue] artistsview: Add delayed retrieval of artist art
- Date: Sat, 14 Aug 2021 23:59:36 +0000 (UTC)
commit 333d707c38ef91a46de7f3bec3d6b8effa55ca83
Author: Marinus Schraal <mschraal gnome org>
Date: Sun Aug 15 01:23:48 2021 +0200
artistsview: Add delayed retrieval of artist art
Delay retrieval of artist art to smoothen the load on startup.
gnomemusic/views/artistsview.py | 8 +++++++-
gnomemusic/widgets/artisttile.py | 8 ++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index 68f400bd5..dbef46b47 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -23,7 +23,7 @@
# delete this exception statement from your version.
from gettext import gettext as _
-from gi.repository import GObject, Gtk
+from gi.repository import GLib, GObject, Gtk
from gnomemusic.widgets.artistalbumswidget import ArtistAlbumsWidget
from gnomemusic.widgets.artisttile import ArtistTile
@@ -60,6 +60,7 @@ class ArtistsView(Gtk.Paned):
self._application = application
self._artists = {}
+ self._widget_counter = 1
self._selected_artist = None
self._loaded_artists = []
@@ -88,6 +89,11 @@ class ArtistsView(Gtk.Paned):
row = ArtistTile(coreartist)
row.props.text = coreartist.props.artist
+ GLib.timeout_add(
+ self._widget_counter * 300, row.retrieve,
+ priority=GLib.PRIORITY_LOW)
+ self._widget_counter = self._widget_counter + 1
+
return row
def _on_model_items_changed(self, model, position, removed, added):
diff --git a/gnomemusic/widgets/artisttile.py b/gnomemusic/widgets/artisttile.py
index eb1a152b1..e59367ba1 100644
--- a/gnomemusic/widgets/artisttile.py
+++ b/gnomemusic/widgets/artisttile.py
@@ -25,6 +25,7 @@
from gi.repository import GObject, Gtk
from gnomemusic.coreartist import CoreArtist
+from gnomemusic.defaulticon import DefaultIcon
from gnomemusic.utils import ArtSize
@@ -49,9 +50,16 @@ class ArtistTile(Gtk.ListBoxRow):
self.props.coreartist = coreartist
self._art_stack.props.size = ArtSize.XSMALL
+ self._art_stack.props.art_type = DefaultIcon.Type.ARTIST
+
self._art_stack.props.coreobject = self.props.coreartist
self.bind_property('text', self._label, 'label')
self.bind_property('text', self._label, 'tooltip-text')
self.show()
+
+ def retrieve(self):
+ """Start retrieving artist art
+ """
+ self._art_stack.props.coreobject = self.props.coreartist
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]