[gnome-music/wip/jfelder/playlists-core-rewrite-prep-work: 6/21] 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: 6/21] playlists: Turn python-specific fields into GObject properties
- Date: Tue, 2 Jul 2019 08:54:56 +0000 (UTC)
commit bc964adf343875696f26209cb3f611ad1f5d0938
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 6ef5faf0..d8f89e48 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 = ""
+
+ 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, id_=None, query=None, tag_text=None, title=None):
+ super().__init__()
+
+ self.props.id_ = 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]