[gnome-music/wip/jfelder/new-album-design-v3: 8/11] albumwidget: Update album infos
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/new-album-design-v3: 8/11] albumwidget: Update album infos
- Date: Wed, 4 Aug 2021 18:26:50 +0000 (UTC)
commit 57e4d044c6a70d55d9011ce3ea4d702b8bca4b76
Author: Jean Felder <jfelder src gnome org>
Date: Thu Jul 29 18:22:52 2021 +0200
albumwidget: Update album infos
data/org.gnome.Music.css | 11 ++-
data/ui/AlbumWidget.ui | 166 +++++++++-----------------------------
gnomemusic/widgets/albumwidget.py | 38 +++++----
po/POTFILES.in | 1 -
4 files changed, 69 insertions(+), 147 deletions(-)
---
diff --git a/data/org.gnome.Music.css b/data/org.gnome.Music.css
index 4659aec06..fc56c0441 100644
--- a/data/org.gnome.Music.css
+++ b/data/org.gnome.Music.css
@@ -18,9 +18,16 @@
}
/* AlbumWidget */
+/* title-1 from libadwaita */
+.title-album {
+ font-weight: 800;
+ font-size: 20pt;
+}
+
+/* title-3 from libadwaita */
.title-artist {
- font-size: larger;
- font-weight: bold;
+ font-weight: 700;
+ font-size: 15pt;
}
.disc-label {
diff --git a/data/ui/AlbumWidget.ui b/data/ui/AlbumWidget.ui
index dc174a160..ba44ee743 100644
--- a/data/ui/AlbumWidget.ui
+++ b/data/ui/AlbumWidget.ui
@@ -49,141 +49,53 @@
<property name="halign">center</property>
<property name="valign">start</property>
<property name="orientation">vertical</property>
- <property name="spacing">18</property>
+ <property name="margin-top">18</property>
<child>
- <object class="GtkBox" id="artistBox">
+ <object class="GtkLabel" id="_title_label">
<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="spacing">3</property>
- <child>
- <object class="GtkLabel" id="_title_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="justify">center</property>
- <property name="ellipsize">middle</property>
- <style>
- <class name="title-artist"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="_artist_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="justify">center</property>
- <property name="ellipsize">middle</property>
- <style>
- <class name="title-artist"/>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
+ <property name="halign">start</property>
+ <property name="ellipsize">middle</property>
+ <property name="margin-bottom">18</property>
+ <style>
+ <class name="title-album"/>
+ </style>
</object>
</child>
<child>
- <object class="GtkGrid" id="grid">
+ <object class="GtkLabel" id="_artist_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin-top">21</property>
- <property name="column_spacing">32</property>
- <property name="column_homogeneous">True</property>
- <child>
- <object class="GtkLabel" id="released_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="margin-bottom">2</property>
- <property name="margin-top">2</property>
- <property name="label" translatable="yes">Released</property>
- <property name="use_markup">True</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="running_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="label" translatable="yes">Running Length</property>
- <property name="use_markup">True</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="_released_info_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="margin-bottom">2</property>
- <property name="margin-top">2</property>
- <property name="label">----</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="_running_info_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label">--:--</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="_composer_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="margin-bottom">2</property>
- <property name="margin-top">2</property>
- <property name="label" translatable="yes">Composer</property>
- <property name="use_markup">True</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="_composer_info_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="margin-bottom">2</property>
- <property name="margin-top">2</property>
- <property name="ellipsize">end</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
+ <property name="halign">start</property>
+ <property name="ellipsize">middle</property>
+ <property name="margin-bottom">12</property>
+ <style>
+ <class name="title-artist"/>
+ </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>
</object>
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index 3d417bd89..11d4cbb69 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -51,11 +51,9 @@ class AlbumWidget(Gtk.ScrolledWindow):
_artist_label = Gtk.Template.Child()
_composer_label = Gtk.Template.Child()
- _composer_info_label = Gtk.Template.Child()
_art_stack = Gtk.Template.Child()
_disc_list_box = Gtk.Template.Child()
- _released_info_label = Gtk.Template.Child()
- _running_info_label = Gtk.Template.Child()
+ _released_label = Gtk.Template.Child()
_title_label = Gtk.Template.Child()
selection_mode = GObject.Property(type=bool, default=False)
@@ -71,6 +69,7 @@ class AlbumWidget(Gtk.ScrolledWindow):
self._corealbum: Optional[CoreAlbum] = None
self._coremodel = self._application.props.coremodel
self._duration_signal_id = 0
+ self._year_signal_id = 0
self._model_signal_id = 0
self._art_stack.props.size = ArtSize.LARGE
@@ -101,6 +100,7 @@ class AlbumWidget(Gtk.ScrolledWindow):
"""
if self._corealbum:
self._corealbum.disconnect(self._duration_signal_id)
+ self._corealbum.disconnect(self._year_signal_id)
self._corealbum.props.model.disconnect(self._model_signal_id)
self._corealbum = corealbum
@@ -116,8 +116,10 @@ class AlbumWidget(Gtk.ScrolledWindow):
self._artist_label.props.label = artist
self._artist_label.props.tooltip_text = artist
- self._released_info_label.props.label = self._corealbum.props.year
-
+ self._duration_signal_id = self._corealbum.connect(
+ "notify::duration", self._on_release_info_changed)
+ self._year_signal_id = self._corealbum.connect(
+ "notify::year", self._on_release_info_changed)
self._set_composer_label(corealbum)
self._album_model = self._corealbum.props.model
@@ -125,10 +127,6 @@ class AlbumWidget(Gtk.ScrolledWindow):
"items-changed", self._on_model_items_changed)
self._disc_list_box.bind_model(self._album_model, self._create_widget)
- self._on_duration_changed(self._corealbum, 0)
- self._duration_signal_id = self._corealbum.connect(
- "notify::duration", self._on_duration_changed)
-
self._album_model.items_changed(0, 0, 0)
def _create_widget(self, disc: CoreDisc) -> DiscBox:
@@ -159,18 +157,24 @@ class AlbumWidget(Gtk.ScrolledWindow):
show = False
if composer:
- self._composer_info_label.props.label = composer
- self._composer_info_label.props.max_width_chars = 10
- self._composer_info_label.props.tooltip_text = composer
+ self._composer_label.props.label = composer
+ self._composer_label.props.tooltip_text = composer
show = True
self._composer_label.props.visible = show
- self._composer_info_label.props.visible = show
+ self._composer_label.props.visible = show
+
+ def _on_release_info_changed(
+ self, klass: CoreAlbum,
+ value: Optional[GObject.ParamSpecString]) -> None:
+ if not self._corealbum:
+ return
- def _on_duration_changed(self, coredisc: CoreDisc, duration: int) -> None:
- mins = (coredisc.props.duration // 60) + 1
- self._running_info_label.props.label = ngettext(
- "{} minute", "{} minutes", mins).format(mins)
+ mins = (self._corealbum.props.duration // 60) + 1
+ year = self._corealbum.props.year
+ release_info_label = ngettext(
+ "{}, {} minute", "{}, {} minutes", mins).format(year, mins)
+ self._released_label.props.label = release_info_label
def _song_activated(
self, widget: Gtk.Widget, song_widget: SongWidget) -> None:
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c88c5b2cc..084766770 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,7 +4,6 @@ data/org.gnome.Music.appdata.xml.in.in
data/org.gnome.Music.desktop.in.in
data/org.gnome.Music.gschema.xml
data/ui/AboutDialog.ui.in
-data/ui/AlbumWidget.ui
data/ui/AppMenu.ui
data/ui/HeaderBar.ui
data/ui/help-overlay.ui
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]