fixed delete latency

This commit is contained in:
Martin Wagner 2020-02-25 12:07:37 +01:00
parent 7391686d90
commit a716bbcab3

View File

@ -594,7 +594,6 @@ class TrackView(Gtk.Box):
self.client=client self.client=client
self.emitter=emitter self.emitter=emitter
self.window=window self.window=window
self.playlist=[]
self.hovered_songpos=None self.hovered_songpos=None
self.song_file=None self.song_file=None
self.playlist_version=None self.playlist_version=None
@ -730,8 +729,8 @@ class TrackView(Gtk.Box):
if not self.hovered_songpos == None: if not self.hovered_songpos == None:
try: try:
self.client.delete(self.hovered_songpos) #bad song index possible self.client.delete(self.hovered_songpos) #bad song index possible
self.playlist=self.client.playlist() self.store.remove(self.store.get_iter(self.hovered_songpos))
self.refresh_playlist_info() self.playlist_version=self.client.status()["playlist"]
except: except:
self.hovered_songpos == None self.hovered_songpos == None
self.treeview.handler_unblock(self.key_press_event) self.treeview.handler_unblock(self.key_press_event)
@ -818,9 +817,9 @@ class TrackView(Gtk.Box):
duration=str(datetime.timedelta(seconds=int(dura ))) duration=str(datetime.timedelta(seconds=int(dura )))
try: try:
treeiter=self.store.get_iter(song["pos"]) treeiter=self.store.get_iter(song["pos"])
self.store.set(treeiter, 0, track, 1, title, 2, artist, 3, album, 4, duration, 5, song["file"].replace("&", "")) self.store.set(treeiter, 0, track, 1, title, 2, artist, 3, album, 4, duration, 5, song["file"])
except: except:
self.store.append([track, title, artist, album, duration, song["file"].replace("&", "")]) self.store.append([track, title, artist, album, duration, song["file"]])
for i in reversed(range(int(self.client.status()["playlistlength"]), len(self.store))): for i in reversed(range(int(self.client.status()["playlistlength"]), len(self.store))):
treeiter=self.store.get_iter(i) treeiter=self.store.get_iter(i)
self.store.remove(treeiter) self.store.remove(treeiter)