Fix bug storing open tabs

This commit is contained in:
Keith Edmunds 2024-05-22 16:52:35 +01:00
parent 71e76e02d1
commit 36e28ca4f4
2 changed files with 3 additions and 3 deletions

View File

@ -201,10 +201,11 @@ class Playlists(dbtables.PlaylistsTable):
update(Playlists).where((Playlists.id.in_(playlist_ids))).values(tab=None)
)
def close(self) -> None:
def close(self, session: Session) -> None:
"""Mark playlist as unloaded"""
self.open = False
session.commit()
@classmethod
def create_playlist_from_template(

View File

@ -496,7 +496,6 @@ class Window(QMainWindow, Ui_MainWindow):
if playlist:
log.debug(f"Set {playlist=} tab to {idx=}")
playlist.tab = idx
session.flush()
# Save current tab
record = settings["active_tab"]
@ -533,7 +532,7 @@ class Window(QMainWindow, Ui_MainWindow):
with db.Session() as session:
playlist = session.get(Playlists, closing_tab_playlist_id)
if playlist:
playlist.close()
playlist.close(session)
# Close playlist and remove tab
self.tabPlaylist.widget(tab_index).close()