[gnome-music/wip/jfelder/new-artist-design: 21/26] albumwidget: Do not include a ScrolledWindow
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/new-artist-design: 21/26] albumwidget: Do not include a ScrolledWindow
- Date: Thu, 5 Aug 2021 19:32:36 +0000 (UTC)
commit 56f260d8404983fba29f16227739713ef3486558
Author: Jean Felder <jfelder src gnome org>
Date: Fri Jul 30 18:08:11 2021 +0200
albumwidget: Do not include a ScrolledWindow
With the latest mockups, the AlbumWidget and the ArtistAlbumWidget
become very similar. Therefore, it becomes possible to use AlbumWidget
inside the ArtistsView. However, in the artists case, the AlbumWidget
cannot include a ScrolledWindow because the scrollbar from the
ArtistsView is already used.
This issue is fixed by removed the ScrolledWindow from the
AlbumWidget. A ScrolledWindow is inserted into the AlbumsView to
handle the album case.
data/ui/AlbumWidget.ui | 236 +++++++++++++++++---------------------
data/ui/AlbumsView.ui | 12 ++
gnomemusic/views/albumsview.py | 5 +-
gnomemusic/widgets/albumwidget.py | 2 +-
4 files changed, 124 insertions(+), 131 deletions(-)
---
diff --git a/data/ui/AlbumWidget.ui b/data/ui/AlbumWidget.ui
index af6daca1b..3d3d4cc4c 100644
--- a/data/ui/AlbumWidget.ui
+++ b/data/ui/AlbumWidget.ui
@@ -2,159 +2,139 @@
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
- <template class="AlbumWidget" parent="GtkScrolledWindow">
+ <template class="AlbumWidget" parent="GtkBox">
+ <property name="orientation">vertical</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="hscrollbar_policy">never</property>
- <style>
- <class name="view"/>
- </style>
+ <property name="margin-bottom">48</property>
+ <property name="margin-end">160</property>
+ <property name="margin-start">160</property>
+ <property name="margin-top">48</property>
<child>
- <object class="GtkViewport" id="_viewport">
+ <object class="GtkBox" id="albumInfo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">fill</property>
<property name="hexpand">True</property>
+ <property name="spacing">32</property>
<child>
- <object class="GtkBox">
- <property name="orientation">vertical</property>
+ <object class="ArtStack" id="_art_stack">
<property name="visible">True</property>
- <property name="margin-bottom">48</property>
- <property name="margin-end">160</property>
- <property name="margin-start">160</property>
- <property name="margin-top">48</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">start</property>
+ <property name="hhomogeneous">False</property>
+ <property name="vhomogeneous">False</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox" id="albumDetails">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">start</property>
+ <property name="orientation">vertical</property>
+ <property name="margin-top">18</property>
+ <child>
+ <object class="GtkLabel" id="_title_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="ellipsize">middle</property>
+ <property name="margin-bottom">18</property>
+ <style>
+ <class name="title-1"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="_artist_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="ellipsize">middle</property>
+ <property name="margin-bottom">12</property>
+ <style>
+ <class name="title-3"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="_released_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="use_markup">True</property>
+ <property name="margin-bottom">12</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
<child>
- <object class="GtkBox" id="albumInfo">
+ <object class="GtkLabel" id="_composer_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">fill</property>
- <property name="hexpand">True</property>
- <property name="spacing">32</property>
+ <property name="halign">start</property>
+ <property name="ellipsize">end</property>
+ <property name="margin-bottom">12</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <property name="margin-top">6</property>
<child>
- <object class="ArtStack" id="_art_stack">
+ <object class="GtkButton" id="_play_button">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="valign">start</property>
- <property name="hhomogeneous">False</property>
- <property name="vhomogeneous">False</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="image">_play_image</property>
+ <property name="always_show_image">True</property>
+ <property name="tooltip-text" translatable="yes">Play</property>
+ <property name="valign">center</property>
+ <signal name="clicked" handler="_on_play_button_clicked" swapped="no"/>
+ <style>
+ <class name="circular"/>
+ </style>
</object>
</child>
<child>
- <object class="GtkBox" id="albumDetails">
+ <object class="GtkMenuButton" id="_menu_button">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="valign">start</property>
- <property name="orientation">vertical</property>
- <property name="margin-top">18</property>
- <child>
- <object class="GtkLabel" id="_title_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="ellipsize">middle</property>
- <property name="margin-bottom">18</property>
- <style>
- <class name="title-1"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="_artist_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="ellipsize">middle</property>
- <property name="margin-bottom">12</property>
- <style>
- <class name="title-3"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="_released_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="use_markup">True</property>
- <property name="margin-bottom">12</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="_composer_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="ellipsize">end</property>
- <property name="margin-bottom">12</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkBox">
- <property name="orientation">horizontal</property>
- <property name="visible">True</property>
- <property name="spacing">12</property>
- <property name="margin-top">6</property>
- <child>
- <object class="GtkButton" id="_play_button">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="image">_play_image</property>
- <property name="always_show_image">True</property>
- <property name="tooltip-text" translatable="yes">Play</property>
- <property name="valign">center</property>
- <signal name="clicked" handler="_on_play_button_clicked" swapped="no"/>
- <style>
- <class name="circular"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkMenuButton" id="_menu_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="halign">start</property>
- <property name="valign">center</property>
- <property name="focus_on_click">False</property>
- <property name="menu-model">album_menu</property>
- <property name="direction">none</property>
- <property name="use_popover">True</property>
- <property name="image">_view_more_image</property>
- <style>
- <class name="image-button"/>
- <class name="circular"/>
- </style>
- </object>
- </child>
- </object>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="focus_on_click">False</property>
+ <property name="menu-model">album_menu</property>
+ <property name="direction">none</property>
+ <property name="use_popover">True</property>
+ <property name="image">_view_more_image</property>
+ <style>
+ <class name="image-button"/>
+ <class name="circular"/>
+ </style>
</object>
</child>
</object>
</child>
- <child>
- <object class="DiscListBox" id="_disc_list_box">
- <property name="can_focus">False</property>
- <property name="margin-top">48</property>
- <property name="selection_mode">0</property>
- <property name="visible">True</property>
- </object>
- </child>
</object>
</child>
</object>
</child>
+ <child>
+ <object class="DiscListBox" id="_disc_list_box">
+ <property name="can_focus">False</property>
+ <property name="margin-top">48</property>
+ <property name="selection_mode">0</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
</template>
<object class="GtkImage" id="_view_more_image">
<property name="visible">True</property>
diff --git a/data/ui/AlbumsView.ui b/data/ui/AlbumsView.ui
index 78ad992e6..abd686fa7 100644
--- a/data/ui/AlbumsView.ui
+++ b/data/ui/AlbumsView.ui
@@ -30,6 +30,18 @@
</child>
</object>
</child>
+ <child>
+ <object class="GtkScrolledWindow" id="_album_scrolled_window">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <style>
+ <class name="view"/>
+ </style>
+ </object>
+ </child>
</template>
<object class="GtkGestureLongPress" id="_flowbox_long_press">
<property name="propagation-phase">capture</property>
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index 36ec7f8b5..38806f57f 100644
--- a/gnomemusic/views/albumsview.py
+++ b/gnomemusic/views/albumsview.py
@@ -49,6 +49,7 @@ class AlbumsView(Gtk.Stack):
title = GObject.Property(
type=str, default=_("Albums"), flags=GObject.ParamFlags.READABLE)
+ _album_scrolled_window = Gtk.Template.Child()
_scrolled_window = Gtk.Template.Child()
_flowbox = Gtk.Template.Child()
_flowbox_long_press = Gtk.Template.Child()
@@ -88,7 +89,7 @@ class AlbumsView(Gtk.Stack):
"selection-mode", self, "selection-mode",
GObject.BindingFlags.BIDIRECTIONAL)
- self.add(self._album_widget)
+ self._album_scrolled_window.add(self._album_widget)
self.connect(
"notify::search-mode-active", self._on_search_mode_changed)
@@ -200,7 +201,7 @@ class AlbumsView(Gtk.Stack):
self._album_widget.props.corealbum = corealbum
self._set_album_headerbar(corealbum)
- self.set_visible_child(self._album_widget)
+ self.set_visible_child(self._album_scrolled_window)
def _set_album_headerbar(self, corealbum):
self._headerbar.props.state = HeaderBar.State.CHILD
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index 41a1b8dec..49d78e862 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -42,7 +42,7 @@ if typing.TYPE_CHECKING:
@Gtk.Template(resource_path='/org/gnome/Music/ui/AlbumWidget.ui')
-class AlbumWidget(Gtk.ScrolledWindow):
+class AlbumWidget(Gtk.Box):
"""Album widget.
The album widget consists of an image with the album art
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]