[gnome-music/wip/jfelder/songwidget-coreson-bind-properties: 1/2] songwidget: Define song_number property
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/songwidget-coreson-bind-properties: 1/2] songwidget: Define song_number property
- Date: Sat, 29 Feb 2020 22:00:32 +0000 (UTC)
commit 695bbf20e0bfe70ffcda486e8d3847df1a6114fe
Author: Jean Felder <jfelder src gnome org>
Date: Sat Feb 29 21:54:42 2020 +0100
songwidget: Define song_number property
This will be used in the next commit to create a binding with the
CoreSong track number property.
gnomemusic/widgets/songwidget.py | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/gnomemusic/widgets/songwidget.py b/gnomemusic/widgets/songwidget.py
index cd0fbe97..e6eccd77 100644
--- a/gnomemusic/widgets/songwidget.py
+++ b/gnomemusic/widgets/songwidget.py
@@ -306,3 +306,23 @@ class SongWidget(Gtk.EventBox):
self._play_icon.set_visible(True)
else:
self._play_icon.props.icon_name = SongStateIcon.PLAYING.value
+
+ @GObject.Property(type=str, default="")
+ def song_number(self):
+ """Get song number label
+
+ :returns: the song number
+ :rtype: str
+ """
+ return self._number_label.props.label
+
+ @song_number.setter
+ def song_number(self, new_nr):
+ """Set song number label from an integer
+
+ :param int new_nr: new song number
+ """
+ if new_nr == 0:
+ new_nr = ""
+
+ self._number_label.props.label = str(new_nr)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]