[gnome-music/wip/mschraal/core-thumb-property: 7/18] artstack: Renamed from ArtistArtStack



commit dad4209d192aa07974250da75a5d015f1f007654
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Apr 5 22:35:27 2020 +0200

    artstack: Renamed from ArtistArtStack
    
    Rename ArtistArtStack to ArtStack. Change naming so it becomes less
    artist specific.

 data/ui/ArtistSearchTile.ui                        |  2 +-
 gnomemusic/widgets/artistsearchtile.py             |  8 +++---
 .../widgets/{artistartstack.py => artstack.py}     | 30 +++++++++++-----------
 3 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/data/ui/ArtistSearchTile.ui b/data/ui/ArtistSearchTile.ui
index 50ab0a38..c62feaf4 100644
--- a/data/ui/ArtistSearchTile.ui
+++ b/data/ui/ArtistSearchTile.ui
@@ -21,7 +21,7 @@
                 <property name="can_focus">False</property>
                 <signal name="button-release-event" handler="_on_artist_event" swapped="no"/>
                 <child>
-                  <object class="ArtistArtStack" id="_artistart_stack">
+                  <object class="ArtStack" id="_art_stack">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="vexpand">True</property>
diff --git a/gnomemusic/widgets/artistsearchtile.py b/gnomemusic/widgets/artistsearchtile.py
index cd2e74ac..c4236ceb 100644
--- a/gnomemusic/widgets/artistsearchtile.py
+++ b/gnomemusic/widgets/artistsearchtile.py
@@ -26,7 +26,7 @@ from gi.repository import Gdk, GObject, Gtk
 
 from gnomemusic.albumartcache import Art
 from gnomemusic.coreartist import CoreArtist
-from gnomemusic.widgets.artistartstack import ArtistArtStack  # noqa: F401
+from gnomemusic.widgets.artstack import ArtStack  # noqa: F401
 from gnomemusic.widgets.twolinetip import TwoLineTip
 
 
@@ -40,7 +40,7 @@ class ArtistSearchTile(Gtk.FlowBoxChild):
     __gtype_name__ = "ArtistSearchTile"
 
     _artist_label = Gtk.Template.Child()
-    _artistart_stack = Gtk.Template.Child()
+    _art_stack = Gtk.Template.Child()
     _check = Gtk.Template.Child()
     _events = Gtk.Template.Child()
 
@@ -60,8 +60,8 @@ class ArtistSearchTile(Gtk.FlowBoxChild):
 
         self.props.coreartist = coreartist
 
-        self._artistart_stack.props.size = Art.Size.MEDIUM
-        self._artistart_stack.props.coreartist = self.props.coreartist
+        self._art_stack.props.size = Art.Size.MEDIUM
+        self._art_stack.props.coreobject = self.props.coreartist
 
         self._tooltip = TwoLineTip()
         self._tooltip.props.subtitle_visible = False
diff --git a/gnomemusic/widgets/artistartstack.py b/gnomemusic/widgets/artstack.py
similarity index 85%
rename from gnomemusic/widgets/artistartstack.py
rename to gnomemusic/widgets/artstack.py
index 8e072b35..6a4f352d 100644
--- a/gnomemusic/widgets/artistartstack.py
+++ b/gnomemusic/widgets/artstack.py
@@ -29,15 +29,15 @@ from gnomemusic.artcache import ArtCache
 from gnomemusic.coreartist import CoreArtist
 
 
-class ArtistArtStack(Gtk.Stack):
+class ArtStack(Gtk.Stack):
     """Provides a smooth transition between image states
 
     Uses a Gtk.Stack to provide an in-situ transition between an image
-    state. Either between the "loading" state versus the "loaded" state
-    or in between songs.
+    state. Between the 'loading' and 'default' art state and in between
+    songs.
     """
 
-    __gtype_name__ = "ArtistArtStack"
+    __gtype_name__ = "ArtStack"
 
     def __init__(self, size=Art.Size.MEDIUM):
         """Initialize the ArtStack
@@ -81,27 +81,27 @@ class ArtistArtStack(Gtk.Stack):
         """
         self._size = value
 
-    @GObject.Property(type=CoreArtist, default=None)
-    def coreartist(self):
-        return self._coreartist
+    @GObject.Property(type=object, default=None)
+    def coreobject(self):
+        return self._coreobject
 
-    @coreartist.setter
-    def coreartist(self, coreartist):
-        self._coreartist = coreartist
+    @coreobject.setter
+    def coreobject(self, coreobject):
+        self._coreobject = coreobject
 
-        self._coreartist.connect(
+        self._coreobject.connect(
             "notify::thumbnail", self._on_thumbnail_changed)
 
-        if self._coreartist.props.thumbnail is not None:
-            self._on_thumbnail_changed(self._coreartist, None)
+        if self._coreobject.props.thumbnail is not None:
+            self._on_thumbnail_changed(self._coreobject, None)
 
-    def _on_thumbnail_changed(self, coreartist, uri):
+    def _on_thumbnail_changed(self, coreobject, uri):
         self._disconnect_cache()
 
         self._cache = ArtCache(self.props.size, self.props.scale_factor)
         self._handler_id = self._cache.connect("result", self._on_cache_result)
 
-        self._cache.query(coreartist)
+        self._cache.query(coreobject)
 
     def _on_cache_result(self, cache, surface):
         if self.props.visible_child_name == "B":


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]