Fix setting albumart on UI widgets

This commit is contained in:
coderkun 2020-10-24 14:58:28 +02:00
parent 8714d7a309
commit 0a631877df
4 changed files with 25 additions and 13 deletions

View file

@ -191,11 +191,9 @@ class CoverPanel(Gtk.Overlay):
# Reset image
self._cover_pixbuf = self._get_default_image()
self._current_size = None
# Show image
self._resize_image()
self.cover_stack.set_visible_child(self.cover_scroll)
self.cover_spinner.stop()
self._current_cover_album = album
# Show image
GObject.idle_add(self._show_image)
def _set_tracks(self, album):
@ -237,6 +235,12 @@ class CoverPanel(Gtk.Overlay):
return True
def _show_image(self):
self._resize_image()
self.cover_stack.set_visible_child(self.cover_scroll)
self.cover_spinner.stop()
def _resize_image(self):
"""Diese Methode skaliert das geladene Bild aus dem Pixelpuffer
auf die Größe des Fensters unter Beibehalt der Seitenverhältnisse

View file

@ -441,9 +441,7 @@ class LibraryPanel(Gtk.Stack):
else:
self._standalone_pixbuf = self._get_default_image()
# Show image
self._resize_standalone_image()
self.standalone_stack.set_visible_child(self.standalone_scroll)
self.standalone_spinner.stop()
GObject.idle_add(self._show_image)
def compare_albums(self, model, row1, row2, criterion):
@ -585,6 +583,12 @@ class LibraryPanel(Gtk.Stack):
self._library_lock.release()
def _show_image(self):
self._resize_standalone_image()
self.standalone_stack.set_visible_child(self.standalone_scroll)
self.standalone_spinner.stop()
def _redraw(self):
if self._albums is not None:
self.set_albums(self._host, self._albums)

View file

@ -227,9 +227,7 @@ class PlaylistPanel(Gtk.Stack):
else:
self._cover_pixbuf = self._get_default_image()
# Show image
self._resize_standalone_image()
self.standalone_stack.set_visible_child(self.standalone_scroll)
self.standalone_spinner.stop()
GObject.idle_add(self._show_image)
def stop_threads(self):
@ -295,6 +293,12 @@ class PlaylistPanel(Gtk.Stack):
self._playlist_lock.release()
def _show_image(self):
self._resize_standalone_image()
self.standalone_stack.set_visible_child(self.standalone_scroll)
self.standalone_spinner.stop()
def _redraw(self):
if self._playlist is not None:
self.set_playlist(self._host, self._playlist)

View file

@ -480,9 +480,9 @@ class Window(Gtk.ApplicationWindow):
def on_mcg_load_albumart(self, album, data):
GObject.idle_add(self._cover_panel.set_albumart, album, data)
GObject.idle_add(self._playlist_panel.set_albumart, album, data)
GObject.idle_add(self._library_panel.set_albumart, album, data)
self._cover_panel.set_albumart(album, data)
self._playlist_panel.set_albumart(album, data)
self._library_panel.set_albumart(album, data)
def on_mcg_custom(self, name):