[gnome-music/wip/jfelder/new-album-design-v3: 1/4] albumwidget: Update album infos




commit a5258e064e35cf6f47685088cbe74271b965e85c
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          |   9 ++-
 data/ui/AlbumWidget.ui            | 166 +++++++++-----------------------------
 gnomemusic/widgets/albumwidget.py |  29 ++-----
 po/POTFILES.in                    |   1 -
 4 files changed, 53 insertions(+), 152 deletions(-)
---
diff --git a/data/org.gnome.Music.css b/data/org.gnome.Music.css
index 4659aec06..4642d1c99 100644
--- a/data/org.gnome.Music.css
+++ b/data/org.gnome.Music.css
@@ -18,9 +18,14 @@
 }
 
 /* AlbumWidget */
+.title-album {
+    font-weight: 800;
+    font-size: 20pt;
+}
+
 .title-artist {
-    font-size: larger;
-    font-weight: bold;
+    font-weight: 400;
+    font-size: 15pt;
 }
 
 .disc-label {
diff --git a/data/ui/AlbumWidget.ui b/data/ui/AlbumWidget.ui
index a75a172b0..2e92fe94e 100644
--- a/data/ui/AlbumWidget.ui
+++ b/data/ui/AlbumWidget.ui
@@ -51,141 +51,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 be22dad67..05ca51df0 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -23,7 +23,6 @@
 # delete this exception statement from your version.
 
 from __future__ import annotations
-from gettext import ngettext
 from typing import Any, Optional
 import typing
 
@@ -51,17 +50,13 @@ 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)
 
-    _duration = 0
-
     def __init__(self, application: Application) -> None:
         """Initialize the AlbumWidget.
 
@@ -72,7 +67,6 @@ class AlbumWidget(Gtk.ScrolledWindow):
         self._application = application
         self._corealbum: Any = None
         self._coremodel = self._application.props.coremodel
-        self._duration_signal_id = 0
         self._model_signal_id = 0
 
         self._art_stack.props.size = ArtSize.LARGE
@@ -91,7 +85,6 @@ class AlbumWidget(Gtk.ScrolledWindow):
         :param CoreAlbum album: The CoreAlbum object
         """
         if self._corealbum:
-            self._corealbum.disconnect(self._duration_signal_id)
             self._corealbum.props.model.disconnect(self._model_signal_id)
 
         self._corealbum = corealbum
@@ -107,8 +100,6 @@ 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._set_composer_label(corealbum)
 
         self._album_model = self._corealbum.props.model
@@ -116,9 +107,9 @@ 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, None)
-        self._duration_signal_id = self._corealbum.connect(
-            "notify::duration", self._on_duration_changed)
+        self._corealbum.bind_property(
+            "release-info", self._released_label, "label",
+            GObject.BindingFlags.SYNC_CREATE)
 
         self._album_model.items_changed(0, 0, 0)
 
@@ -150,18 +141,12 @@ 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
-
-    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)
+        self._composer_label.props.visible = show
 
     def _song_activated(
             self, widget: Gtk.Widget, song_widget: SongWidget) -> int:
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 50b80c21a..ae853c878 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]