[gnome-music/wip/jfelder/tracker3-rebased: 35/39] songeditordialog: Add an album artist entry




commit e9ce502ca21a87058bcc2eaf22043a33f6c6062e
Author: Jean Felder <jfelder src gnome org>
Date:   Mon May 18 18:26:43 2020 +0200

    songeditordialog: Add an album artist entry
    
    This allows to edit the album artist tag.

 data/ui/SongEditorDialog.ui            | 65 +++++++++++++++++++++++++++++++++-
 gnomemusic/widgets/songeditordialog.py |  8 +++--
 2 files changed, 69 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/SongEditorDialog.ui b/data/ui/SongEditorDialog.ui
index ef2dca0a..9dc26095 100644
--- a/data/ui/SongEditorDialog.ui
+++ b/data/ui/SongEditorDialog.ui
@@ -262,7 +262,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="margin_right">36</property>
-                                <property name="label" translatable="yes">Artist</property>
+                                <property name="label" translatable="yes">Song Artist</property>
                                 <property name="xalign">1</property>
                                 <attributes>
                                   <attribute name="weight" value="bold"/>
@@ -310,6 +310,69 @@
                         </child>
                       </object>
                     </child>
+                    <child>
+                      <object class="GtkBox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkBox">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <object class="GtkLabel" id="album_artist">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="margin_right">36</property>
+                                <property name="label" translatable="yes">Album Artist</property>
+                                <property name="xalign">1</property>
+                                <attributes>
+                                  <attribute name="weight" value="bold"/>
+                                </attributes>
+                                <style>
+                                  <class name="dim-label"/>
+                                </style>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="_album_artist_suggestion">
+                                <property name="can_focus">False</property>
+                                <property name="halign">start</property>
+                                <property name="ellipsize">end</property>
+                                <property name="max_width_chars">30</property>
+                                <style>
+                                  <class name="suggestion-label"/>
+                                </style>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="pack_type">end</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="_album_artist_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="width_chars">45</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
                     <child>
                       <object class="GtkBox">
                         <property name="visible">True</property>
diff --git a/gnomemusic/widgets/songeditordialog.py b/gnomemusic/widgets/songeditordialog.py
index e617cd98..6c81679a 100644
--- a/gnomemusic/widgets/songeditordialog.py
+++ b/gnomemusic/widgets/songeditordialog.py
@@ -53,6 +53,8 @@ class SongEditorDialog(Gtk.Dialog):
     _use_suggestion_button = Gtk.Template.Child()
 
     # tags entries and labels
+    _album_artist_entry = Gtk.Template.Child()
+    _album_artist_suggestion = Gtk.Template.Child()
     _album_entry = Gtk.Template.Child()
     _album_suggestion = Gtk.Template.Child()
     _artist_entry = Gtk.Template.Child()
@@ -72,6 +74,7 @@ class SongEditorDialog(Gtk.Dialog):
 
     _fields_getter = {
         "album": utils.get_album_title,
+        "album_artist": utils.get_album_artist,
         "artist": utils.get_song_artist,
         "disc": utils.get_album_disc_nr,
         "title": utils.get_media_title,
@@ -270,7 +273,6 @@ class SongEditorDialog(Gtk.Dialog):
         self._delete_notification()
 
         tags = {
-            "album-artist": None,
             "mb-recording-id": None,
             "mb-track-id": None,
             "mb-artist-id": None,
@@ -280,11 +282,11 @@ class SongEditorDialog(Gtk.Dialog):
 
         for field in self._fields_getter:
             entry = getattr(self, "_" + field + "_entry")
-            tags[field] = entry.props.text
+            tag_key = field.replace("_", "-")
+            tags[tag_key] = entry.props.text
 
         if self._chosen_suggestion_index > -1:
             media = self._suggestions[self._chosen_suggestion_index]
-            tags["album-artist"] = media.get_album_artist()
             tags["mb-recording-id"] = media.get_mb_recording_id()
             tags["mb-track-id"] = media.get_mb_track_id()
             tags["mb-artist-id"] = media.get_mb_artist_id()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]