[gnome-music/wip/gbsneto/artist-albums-widget] artistalbumwidget: avoid changing width on playing
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/gbsneto/artist-albums-widget] artistalbumwidget: avoid changing width on playing
- Date: Wed, 5 Oct 2016 13:48:53 +0000 (UTC)
commit 4c9b04c36ea82766a8823de14b9b212b3396a237
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Oct 5 09:45:32 2016 -0300
artistalbumwidget: avoid changing width on playing
When we start/stop playing a song, the ArtistAlbumWidget change the
songs' grid width because the play icon is hidden and shown. GtkBox
doesn not allocate sizes on hidden widget and, when the play icon
is shown, we change the layout.
Fix that by using the child_visible() variant instead of show() and
hide(), so we always keep the play icon size allocated and avoid
changing the layout.
data/TrackWidget.ui | 1 +
gnomemusic/widgets.py | 12 ++++++------
2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/data/TrackWidget.ui b/data/TrackWidget.ui
index 8b69b17..4e326f8 100644
--- a/data/TrackWidget.ui
+++ b/data/TrackWidget.ui
@@ -21,6 +21,7 @@
<property name="can_focus">False</property>
<child>
<object class="GtkImage" id="image1">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_size">1</property>
</object>
diff --git a/gnomemusic/widgets.py b/gnomemusic/widgets.py
index e2a9c28..dc879bf 100644
--- a/gnomemusic/widgets.py
+++ b/gnomemusic/widgets.py
@@ -538,14 +538,14 @@ class ArtistAlbums(Gtk.Box):
escaped_title = GLib.markup_escape_text(utils.get_media_title(song))
if (song == currentSong):
- song_widget.now_playing_sign.show()
+ song_widget.now_playing_sign.set_child_visible(True)
song_widget.title.set_markup('<b>%s</b>' % escaped_title)
song_passed = True
elif (song_passed):
- song_widget.now_playing_sign.hide()
+ song_widget.now_playing_sign.set_child_visible(False)
song_widget.title.set_markup('<span>%s</span>' % escaped_title)
else:
- song_widget.now_playing_sign.hide()
+ song_widget.now_playing_sign.set_child_visible(False)
song_widget.title.set_markup(
'<span color=\'grey\'>%s</span>' % escaped_title
)
@@ -560,7 +560,7 @@ class ArtistAlbums(Gtk.Box):
song_widget = song.song_widget
escaped_title = GLib.markup_escape_text(utils.get_media_title(song))
if song_widget.can_be_played:
- song_widget.now_playing_sign.hide()
+ song_widget.now_playing_sign.set_child_visible(False)
song_widget.title.set_markup('<span>%s</span>' % escaped_title)
itr = self.model.iter_next(itr)
return False
@@ -720,7 +720,7 @@ class ArtistAlbumWidget(Gtk.Box):
NOW_PLAYING_ICON_NAME,
Gtk.IconSize.SMALL_TOOLBAR)
song_widget.now_playing_sign.set_no_show_all('True')
- song_widget.now_playing_sign.set_alignment(1, 0.6)
+ song_widget.now_playing_sign.set_child_visible(False)
song_widget.can_be_played = True
song_widget.connect('button-release-event',
self.track_selected)
@@ -786,7 +786,7 @@ class ArtistAlbumWidget(Gtk.Box):
songWidget.now_playing_sign.set_from_icon_name(
ERROR_ICON_NAME,
Gtk.IconSize.SMALL_TOOLBAR)
- songWidget.now_playing_sign.show()
+ songWidget.now_playing_sign.set_child_visible(True)
songWidget.can_be_played = False
if selected != songWidget.checkButton.get_active():
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]