[gnome-music/wip/mschraal/core: 75/92] albumwidget2: Make it work with ListBox as well
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/core: 75/92] albumwidget2: Make it work with ListBox as well
- Date: Mon, 17 Jun 2019 22:53:15 +0000 (UTC)
commit 02246245c269b37460289e12ca4e76d1632b4c90
Author: Marinus Schraal <mschraal gnome org>
Date: Sun Jun 2 10:37:16 2019 +0200
albumwidget2: Make it work with ListBox as well
data/ui/AlbumWidget2.ui | 1 +
gnomemusic/widgets/albumwidget2.py | 50 ++++++++++++++++++++++++--------------
2 files changed, 33 insertions(+), 18 deletions(-)
---
diff --git a/data/ui/AlbumWidget2.ui b/data/ui/AlbumWidget2.ui
index 743a1d44..557ef09f 100644
--- a/data/ui/AlbumWidget2.ui
+++ b/data/ui/AlbumWidget2.ui
@@ -229,6 +229,7 @@
<property name="margin_top">48</property>
<property name="margin_bottom">64</property>
<property name="margin_end">32</property>
+ <property name="selection_mode">0</property>
<property name="visible">True</property>
</object>
</child>
diff --git a/gnomemusic/widgets/albumwidget2.py b/gnomemusic/widgets/albumwidget2.py
index 24a4c8fe..c5ee05e9 100644
--- a/gnomemusic/widgets/albumwidget2.py
+++ b/gnomemusic/widgets/albumwidget2.py
@@ -84,30 +84,44 @@ class AlbumWidget2(Gtk.EventBox):
self._set_composer_label(album)
self._album = album
- self._model = self._parent_view._window._app._coremodel.get_album_model(album)
- self._listbox.bind_model(self._model[0], self._create_widget)
+ self._album_model = self._parent_view._window._app._coremodel.get_album_model(album)
+ self._listbox.bind_model(self._album_model, self._create_widget)
- @log
- def _create_widget(self, song):
- song_widget = SongWidget(song.props.media)
+ def _create_widget(self, disc):
+ disc_box = self._create_disc_box(
+ disc.media.get_album_disc_number(), disc.model)
+
+ return disc_box
+
+ def _create_disc_box(self, disc_nr, album_model):
+ disc_box = DiscBox(None, album_model)
+ # disc_box.set_songs(disc_songs)
+ disc_box.set_disc_number(disc_nr)
+ disc_box.props.columns = 2
+ disc_box.props.show_durations = False
+ disc_box.props.show_favorites = False
+ disc_box.props.show_song_numbers = True
+ disc_box.connect('song-activated', self._song_activated)
+
+ return disc_box
- song.bind_property(
- "favorite", song_widget, "favorite",
- GObject.BindingFlags.BIDIRECTIONAL
- | GObject.BindingFlags.SYNC_CREATE)
- song.bind_property(
- "selected", song_widget, "selected",
- GObject.BindingFlags.BIDIRECTIONAL
- | GObject.BindingFlags.SYNC_CREATE)
+ # song.bind_property(
+ # "favorite", song_widget, "favorite",
+ # GObject.BindingFlags.BIDIRECTIONAL
+ # | GObject.BindingFlags.SYNC_CREATE)
+ # song.bind_property(
+ # "selected", song_widget, "selected",
+ # GObject.BindingFlags.BIDIRECTIONAL
+ # | GObject.BindingFlags.SYNC_CREATE)
- self.bind_property(
- "selection-mode", song_widget, "selection-mode")
+ # self.bind_property(
+ # "selection-mode", song_widget, "selection-mode")
- song.connect("notify::selected", self._on_selection_changed)
+ # song.connect("notify::selected", self._on_selection_changed)
- self._set_duration_label()
+ # self._set_duration_label()
- return song_widget
+ # return song_widget
@log
def _set_composer_label(self, album):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]