removed unneeded stop_flag check in AlbumWindow._refresh()

This commit is contained in:
Martin Wagner 2020-12-13 11:53:16 +01:00
parent ebe73cc4ea
commit e6c292f658

View File

@ -2089,35 +2089,32 @@ class AlbumWindow(FocusFrame):
def display_albums(): def display_albums():
for i, album in enumerate(albums): for i, album in enumerate(albums):
if self.stop_flag: # tooltip
break length_human_readable=ClientHelper.calc_display_length(album["songs"])
discs=album["songs"][-1].get("disc", 1)
if type(discs) == list:
discs=int(discs[0])
else: else:
# tooltip discs=int(discs)
length_human_readable=ClientHelper.calc_display_length(album["songs"]) if discs > 1:
discs=album["songs"][-1].get("disc", 1) tooltip=_("{titles} titles on {discs} discs ({length})").format(
if type(discs) == list: titles=len(album["songs"]), discs=discs, length=length_human_readable)
discs=int(discs[0]) else:
else: tooltip=_("{titles} titles ({length})").format(
discs=int(discs) titles=len(album["songs"]), length=length_human_readable)
if discs > 1: # album label
tooltip=_("{titles} titles on {discs} discs ({length})").format( if album["year"] == "":
titles=len(album["songs"]), discs=discs, length=length_human_readable) display_label="<b>{}</b>".format(album["album"])
else: else:
tooltip=_("{titles} titles ({length})").format( display_label="<b>{}</b> ({})".format(album["album"], album["year"])
titles=len(album["songs"]), length=length_human_readable) display_label_artist=display_label+"\n"+album["artist"]
# album label display_label=display_label.replace("&", "&amp;")
if album["year"] == "": display_label_artist=display_label_artist.replace("&", "&amp;")
display_label="<b>{}</b>".format(album["album"]) # add album
else: self._store.append(
display_label="<b>{}</b> ({})".format(album["album"], album["year"]) [album["cover"], display_label, display_label_artist,
display_label_artist=display_label+"\n"+album["artist"] tooltip, album["album"], album["year"], album["artist"]]
display_label=display_label.replace("&", "&amp;") )
display_label_artist=display_label_artist.replace("&", "&amp;")
# add album
self._store.append(
[album["cover"], display_label, display_label_artist,
tooltip, album["album"], album["year"], album["artist"]]
)
self._iconview.set_model(self._store) self._iconview.set_model(self._store)
GLib.idle_add(self._done_callback) GLib.idle_add(self._done_callback)
return False return False