Update download state when downloading from Play Queue

This commit is contained in:
Sumner Evans
2019-12-19 18:19:23 -07:00
parent 006ccbac48
commit 196fff786b
2 changed files with 12 additions and 2 deletions

View File

@@ -47,6 +47,10 @@ class MainWindow(Gtk.ApplicationWindow):
'song-clicked', lambda _, *a: self.emit('song-clicked', *a)) 'song-clicked', lambda _, *a: self.emit('song-clicked', *a))
self.player_controls.connect( self.player_controls.connect(
'songs-removed', lambda _, *a: self.emit('songs-removed', *a)) 'songs-removed', lambda _, *a: self.emit('songs-removed', *a))
self.player_controls.connect(
'refresh-window',
lambda _, *args: self.emit('refresh-window', *args),
)
flowbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) flowbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
flowbox.pack_start(self.stack, True, True, 0) flowbox.pack_start(self.stack, True, True, 0)

View File

@@ -44,6 +44,11 @@ class PlayerControls(Gtk.ActionBar):
GObject.TYPE_NONE, GObject.TYPE_NONE,
(object, ), (object, ),
), ),
'refresh-window': (
GObject.SignalFlags.RUN_FIRST,
GObject.TYPE_NONE,
(object, bool),
),
} }
editing: bool = False editing: bool = False
current_song = None current_song = None
@@ -272,8 +277,9 @@ class PlayerControls(Gtk.ActionBar):
selected_indexes = [clicked_row_index] selected_indexes = [clicked_row_index]
def on_download_state_change(song_id=None): def on_download_state_change(song_id=None):
# TODO should probably refresh the entire window here. # Refresh the entire window (no force) because the song could
pass # be in a list anywhere in the window.
self.emit('refresh-window', {}, False)
song_ids = [ song_ids = [
self.play_queue_store[idx].song_id for idx in selected_indexes self.play_queue_store[idx].song_id for idx in selected_indexes