[gnome-music/wip/carlosg/tracker3: 45/68] songeditordialog: Display the current suggestion number
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/carlosg/tracker3: 45/68] songeditordialog: Display the current suggestion number
- Date: Wed, 17 Jun 2020 18:39:07 +0000 (UTC)
commit 846761a2bfad1afe39d8aa555a2dd808542ef8c8
Author: Jean Felder <jfelder src gnome org>
Date: Mon May 18 19:32:25 2020 +0200
songeditordialog: Display the current suggestion number
data/ui/SongEditorDialog.ui | 12 ++++++++++--
gnomemusic/widgets/songeditordialog.py | 15 +++++++++++----
2 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/data/ui/SongEditorDialog.ui b/data/ui/SongEditorDialog.ui
index 3312671e..dca59219 100644
--- a/data/ui/SongEditorDialog.ui
+++ b/data/ui/SongEditorDialog.ui
@@ -603,10 +603,18 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="_spinner_label">
+ <object class="GtkLabel" id="_state_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Fetching metadata...</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="_suggestion_label">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
<style>
<class name="dim-label"/>
</style>
diff --git a/gnomemusic/widgets/songeditordialog.py b/gnomemusic/widgets/songeditordialog.py
index 55cebefe..154f5fab 100644
--- a/gnomemusic/widgets/songeditordialog.py
+++ b/gnomemusic/widgets/songeditordialog.py
@@ -46,8 +46,9 @@ class SongEditorDialog(Gtk.Dialog):
_notifications_popup = Gtk.Template.Child()
_prev_button = Gtk.Template.Child()
_spinner = Gtk.Template.Child()
- _spinner_label = Gtk.Template.Child()
+ _state_label = Gtk.Template.Child()
_submit_button = Gtk.Template.Child()
+ _suggestion_label = Gtk.Template.Child()
_url_label = Gtk.Template.Child()
_use_suggestion_button = Gtk.Template.Child()
@@ -132,7 +133,7 @@ class SongEditorDialog(Gtk.Dialog):
def _start_spinner(self):
self._spinner.start()
- self._spinner_label.props.label = _("Fetching metadata…")
+ self._state_label.props.label = _("Fetching metadata…")
def _stop_spinner(self):
self._spinner.stop()
@@ -142,7 +143,7 @@ class SongEditorDialog(Gtk.Dialog):
"{} suggestion found", "{} suggestions found",
len(self._suggestions)).format(len(self._suggestions))
- self._spinner_label.props.label = label
+ self._state_label.props.label = label
def _search_tags(self):
self._start_spinner()
@@ -182,10 +183,16 @@ class SongEditorDialog(Gtk.Dialog):
suggestion.props.has_tooltip = True
suggestion.props.tooltip_text = value
+ nr_results = len(self._suggestions)
self._next_button.props.sensitive = (
- self._suggestion_index < len(self._suggestions) - 1)
+ self._suggestion_index < nr_results - 1)
self._prev_button.props.sensitive = (self._suggestion_index > 0)
+ if nr_results > 1:
+ label = "({}/{})".format(self._suggestion_index + 1, nr_results)
+ self._suggestion_label.props.label = label
+ self._suggestion_label.props.visible = True
+
def _on_entries_changed(self, widget=None, param=None):
if self._suggestion_index >= 0:
media = self._suggestions[self._suggestion_index]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]