[gnome-music/wip/jfelder/playlists-core-rewrite-prep-work: 4/19] playlists: Turn python-specific fields into GObject properties
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/playlists-core-rewrite-prep-work: 4/19] playlists: Turn python-specific fields into GObject properties
- Date: Tue, 2 Jul 2019 13:28:18 +0000 (UTC)
commit 62c472f8e52daa5e6284d603d89002c1689eb365
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Nov 28 18:12:45 2016 +0100
playlists: Turn python-specific fields into GObject properties
Now that Playlist is a GObject, we can have the old Python-specific
fields turned into properties, which will allow us to e.g. notify
when something changes, bind them with other widgets, among others.
gnomemusic/playlists.py | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index f9d9e890..a87c4329 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -41,16 +41,23 @@ logger = logging.getLogger(__name__)
class Playlist(GObject.Object):
""" Base class of all playlists """
- ID = None
- QUERY = None
- TAG_TEXT = ""
- TITLE = ""
+
+ pl_id = GObject.Property(type=str, default=None)
+ query = GObject.Property(type=str, default=None)
+ tag_text = GObject.Property(type=str, default=None)
+ title = GObject.Property(type=str, default=None)
def __repr__(self):
return "<Playlist>"
- def __init__(self):
- super().__init()
+ def __init__(self, pl_id=None, query=None, tag_text=None, title=None):
+ super().__init__()
+
+ self.props.pl_id = pl_id
+ self.props.query = query
+ self.props.tag_text = tag_text
+ self.props.title = title
+
class SmartPlaylists:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]