Init progress bar on Library panel (close #49)

Introduce two new callbacks for this: one when initializing the loading
of albums and another one on handling the loading of each album. Use the
first one to initialize and the second one to pulse the progress bar on
the Library panel.

Additionally use the text of the progress as status label instead of a
separate label widget.
This commit is contained in:
coderkun 2020-03-22 00:19:45 +01:00
commit 477f89cc0b
7 changed files with 137 additions and 111 deletions

View file

@ -110,6 +110,10 @@ class Client(Base):
SIGNAL_STATUS = 'status'
# Signal: stats
SIGNAL_STATS = 'stats'
# Signal: init loading of albums
SIGNAL_INIT_ALBUMS = 'init-albums'
# Signal: pulse loading of albums
SIGNAL_PULSE_ALBUMS = 'pulse-albums'
# Signal: load albums
SIGNAL_LOAD_ALBUMS = 'load-albums'
# Signal: load playlist
@ -498,9 +502,12 @@ class Client(Base):
def _load_albums(self):
"""Action: Perform the real update."""
self._callback(Client.SIGNAL_INIT_ALBUMS)
self._albums = {}
# Albums
for album in self._parse_list(self._call('list album'), ['album']):
self._callback(Client.SIGNAL_PULSE_ALBUMS)
# Album
album = self._extract_album(album)
self._logger.debug("album: %r", album)