fixed error on disconnect

This commit is contained in:
Martin Wagner 2020-03-30 12:28:30 +02:00
parent 8e4ba7ef10
commit 9285d18a5c

View File

@ -1132,6 +1132,7 @@ class AlbumIconView(Gtk.IconView): #TODO function/var names
genre=self.genre_select.get_value() genre=self.genre_select.get_value()
artist_type=self.settings.get_artist_type() artist_type=self.settings.get_artist_type()
for artist in artists: for artist in artists:
try: #client cloud meanwhile disconnect
if not self.stop_flag: if not self.stop_flag:
if genre == None: if genre == None:
album_candidates=self.client.list("album", artist_type, artist) album_candidates=self.client.list("album", artist_type, artist)
@ -1147,6 +1148,9 @@ class AlbumIconView(Gtk.IconView): #TODO function/var names
else: else:
GLib.idle_add(self.emit, "done") GLib.idle_add(self.emit, "done")
return return
except:
GLib.idle_add(self.emit, "done")
return
#display albums #display albums
self.store.set_sort_column_id(Gtk.TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, Gtk.SortType.ASCENDING) self.store.set_sort_column_id(Gtk.TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, Gtk.SortType.ASCENDING)
music_lib=self.settings.get_value("paths")[self.settings.get_int("active-profile")] music_lib=self.settings.get_value("paths")[self.settings.get_int("active-profile")]
@ -1256,8 +1260,12 @@ class AlbumView(Gtk.ScrolledWindow):
self.add(self.iconview) self.add(self.iconview)
def clear(self, *args): def clear(self, *args):
if self.done:
self.artists=[] self.artists=[]
self.iconview.store.clear() self.iconview.store.clear()
elif not self.clear in self.pending:
self.iconview.stop_flag=True
self.pending.append(self.clear)
def refresh(self, artists): def refresh(self, artists):
self.artists=artists self.artists=artists
@ -1684,6 +1692,7 @@ class Browser(Gtk.Box):
self.paned2.set_position(self.settings.get_int("paned2")) self.paned2.set_position(self.settings.get_int("paned2"))
def clear(self, *args): def clear(self, *args):
self.genre_select.clear()
self.artist_view.clear() self.artist_view.clear()
self.album_view.clear() self.album_view.clear()
self.playlist_view.clear() self.playlist_view.clear()
@ -1727,10 +1736,10 @@ class Browser(Gtk.Box):
self.genre_select.set_sensitive(True) self.genre_select.set_sensitive(True)
def on_disconnected(self, *args): def on_disconnected(self, *args):
self.clear()
self.back_to_album_button.set_sensitive(False) self.back_to_album_button.set_sensitive(False)
self.search_button.set_active(False) self.search_button.set_active(False)
self.search_button.set_sensitive(False) self.search_button.set_sensitive(False)
self.genre_select.clear()
self.genre_select.set_sensitive(False) self.genre_select.set_sensitive(False)
def on_artists_changed(self, *args): def on_artists_changed(self, *args):
@ -2958,7 +2967,6 @@ class MainWindow(Gtk.ApplicationWindow):
self.lyrics_button.set_active(False) self.lyrics_button.set_active(False)
self.set_title("mpdevil (not connected)") self.set_title("mpdevil (not connected)")
self.songid_playing=None self.songid_playing=None
self.browser.clear()
self.progress.set_sensitive(False) self.progress.set_sensitive(False)
self.control.set_sensitive(False) self.control.set_sensitive(False)
self.play_opts.set_sensitive(False) self.play_opts.set_sensitive(False)