[gnome-music/wip/mschraal/rework-art-widget: 4/12] Remove DefaultIcon class
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/rework-art-widget: 4/12] Remove DefaultIcon class
- Date: Mon, 4 Apr 2022 21:45:52 +0000 (UTC)
commit a72ae6ed8f5d43a554d7e7cb6348d9ba3af9d771
Author: Marinus Schraal <mschraal gnome org>
Date: Fri Apr 1 16:32:47 2022 +0200
Remove DefaultIcon class
Use CoverPaintable directly, this removes the caching.
gnomemusic/defaulticon.py | 77 ------------------------------------------
gnomemusic/widgets/artstack.py | 17 ++++++----
2 files changed, 10 insertions(+), 84 deletions(-)
---
diff --git a/gnomemusic/widgets/artstack.py b/gnomemusic/widgets/artstack.py
index 840006791..ac78baf3a 100644
--- a/gnomemusic/widgets/artstack.py
+++ b/gnomemusic/widgets/artstack.py
@@ -30,7 +30,6 @@ from gi.repository import Adw, GObject, Gtk
from gnomemusic.asyncqueue import AsyncQueue
from gnomemusic.coverpaintable import CoverPaintable
-from gnomemusic.defaulticon import DefaultIcon
from gnomemusic.mediaartloader import MediaArtLoader
from gnomemusic.utils import ArtSize, DefaultIconType
if typing.TYPE_CHECKING:
@@ -122,8 +121,9 @@ class ArtStack(Gtk.Stack):
"""
self._art_type = value
- default_icon = DefaultIcon(self).get(self._art_type, self._size)
-
+ dark = Adw.StyleManager.get_default().props.dark
+ default_icon = CoverPaintable(
+ self._size, self, icon_type=self._art_type, dark=dark)
self._cover.props.paintable = default_icon
@GObject.Property(type=object, default=None)
@@ -135,7 +135,9 @@ class ArtStack(Gtk.Stack):
if coreobject is self._coreobject:
return
- default_icon = DefaultIcon(self).get(self._art_type, self._size)
+ dark = Adw.StyleManager.get_default().props.dark
+ default_icon = CoverPaintable(
+ self._size, self, icon_type=self._art_type, dark=dark)
self._cover.props.paintable = default_icon
if self._thumbnail_id != 0:
@@ -158,8 +160,8 @@ class ArtStack(Gtk.Stack):
if self._coreobject.props.thumbnail != "generic":
return
- default_icon = DefaultIcon(self).get(self._art_type, self._size)
-
+ dark = Adw.StyleManager.get_default().props.dark
+ default_icon = CoverPaintable(self._size, self, dark=dark)
self._cover.props.paintable = default_icon
def _on_thumbnail_changed(
@@ -172,7 +174,8 @@ class ArtStack(Gtk.Stack):
if thumbnail_uri == "generic":
dark = Adw.StyleManager.get_default().props.dark
- default_icon = CoverPaintable(self._size, self, dark=dark)
+ default_icon = CoverPaintable(
+ self._size, self, icon_type=self._art_type, dark=dark)
self._cover.props.paintable = default_icon
return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]