[gnome-music/wip/mschraal/gtk4-v3: 243/248] artisttile: Make CoreArtist trigger the art retrieval
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/gtk4-v3: 243/248] artisttile: Make CoreArtist trigger the art retrieval
- Date: Mon, 14 Feb 2022 02:24:03 +0000 (UTC)
commit 3d7947488108782748378ce5024a4d35cc2305da
Author: Marinus Schraal <mschraal gnome org>
Date: Mon Feb 14 01:54:34 2022 +0100
artisttile: Make CoreArtist trigger the art retrieval
gnomemusic/widgets/artisttile.py | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/gnomemusic/widgets/artisttile.py b/gnomemusic/widgets/artisttile.py
index 17ea1b6ef..6233b17ac 100644
--- a/gnomemusic/widgets/artisttile.py
+++ b/gnomemusic/widgets/artisttile.py
@@ -22,6 +22,9 @@
# code, but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version.
+from __future__ import annotations
+from typing import Optional
+
from gi.repository import GObject, Gtk
from gnomemusic.coreartist import CoreArtist
@@ -40,13 +43,13 @@ class ArtistTile(Gtk.ListBoxRow):
_art_stack = Gtk.Template.Child()
_label = Gtk.Template.Child()
- coreartist = GObject.Property(type=CoreArtist, default=None)
text = GObject.Property(type=str, default='')
- def __init__(self, coreartist=None):
+ def __init__(self) -> None:
+ """Initialise ArtistTile"""
super().__init__()
- self.props.coreartist = coreartist
+ self._coreartist: Optional[CoreArtist] = None
self._art_stack.props.size = ArtSize.XSMALL
self._art_stack.props.art_type = DefaultIconType.ARTIST
@@ -54,9 +57,22 @@ class ArtistTile(Gtk.ListBoxRow):
self.bind_property('text', self._label, 'label')
self.bind_property('text', self._label, 'tooltip-text')
- self.show()
+ @GObject.Property(
+ type=CoreArtist, flags=GObject.ParamFlags.READWRITE, default=None)
+ def coreartist(self) -> CoreArtist:
+ """CoreArtist to use for ArtistTile
- def retrieve(self):
- """Start retrieving artist art
+ :returns: The artist object
+ :rtype: CoreArtist
"""
- self._art_stack.props.coreobject = self.props.coreartist
+ return self._coreartist
+
+ @coreartist.setter # type: ignore
+ def coreartist(self, coreartist: CoreArtist) -> None:
+ """CoreArtist setter
+
+ :param CoreArtist coreartist: The coreartist to use
+ """
+ self._coreartist = coreartist
+
+ self._art_stack.props.coreobject = coreartist
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]