Fix bug storing open tabs
This commit is contained in:
parent
71e76e02d1
commit
36e28ca4f4
@ -201,10 +201,11 @@ class Playlists(dbtables.PlaylistsTable):
|
|||||||
update(Playlists).where((Playlists.id.in_(playlist_ids))).values(tab=None)
|
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"""
|
"""Mark playlist as unloaded"""
|
||||||
|
|
||||||
self.open = False
|
self.open = False
|
||||||
|
session.commit()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_playlist_from_template(
|
def create_playlist_from_template(
|
||||||
|
|||||||
@ -496,7 +496,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if playlist:
|
if playlist:
|
||||||
log.debug(f"Set {playlist=} tab to {idx=}")
|
log.debug(f"Set {playlist=} tab to {idx=}")
|
||||||
playlist.tab = idx
|
playlist.tab = idx
|
||||||
session.flush()
|
|
||||||
|
|
||||||
# Save current tab
|
# Save current tab
|
||||||
record = settings["active_tab"]
|
record = settings["active_tab"]
|
||||||
@ -533,7 +532,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
with db.Session() as session:
|
with db.Session() as session:
|
||||||
playlist = session.get(Playlists, closing_tab_playlist_id)
|
playlist = session.get(Playlists, closing_tab_playlist_id)
|
||||||
if playlist:
|
if playlist:
|
||||||
playlist.close()
|
playlist.close(session)
|
||||||
|
|
||||||
# Close playlist and remove tab
|
# Close playlist and remove tab
|
||||||
self.tabPlaylist.widget(tab_index).close()
|
self.tabPlaylist.widget(tab_index).close()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user