parent
06ef175b46
commit
7ed54f2bab
@ -239,6 +239,20 @@ class Playlists(Base):
|
|||||||
session.add(self)
|
session.add(self)
|
||||||
session.flush()
|
session.flush()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def clear_tabs(session: scoped_session, playlist_ids: List[int]) -> None:
|
||||||
|
"""
|
||||||
|
Make all tab records NULL
|
||||||
|
"""
|
||||||
|
|
||||||
|
session.execute(
|
||||||
|
update(Playlists)
|
||||||
|
.where(
|
||||||
|
(Playlists.id.in_(playlist_ids))
|
||||||
|
)
|
||||||
|
.values(tab=None)
|
||||||
|
)
|
||||||
|
|
||||||
def close(self) -> None:
|
def close(self) -> None:
|
||||||
"""Mark playlist as unloaded"""
|
"""Mark playlist as unloaded"""
|
||||||
|
|
||||||
|
|||||||
@ -875,15 +875,23 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
def load_last_playlists(self) -> None:
|
def load_last_playlists(self) -> None:
|
||||||
"""Load the playlists that were open when the last session closed"""
|
"""Load the playlists that were open when the last session closed"""
|
||||||
|
|
||||||
|
playlist_ids = []
|
||||||
with Session() as session:
|
with Session() as session:
|
||||||
for playlist in Playlists.get_open(session):
|
for playlist in Playlists.get_open(session):
|
||||||
if playlist:
|
if playlist:
|
||||||
_ = self.create_playlist_tab(playlist)
|
_ = self.create_playlist_tab(playlist)
|
||||||
|
playlist_ids.append(playlist.id)
|
||||||
# Set active tab
|
# Set active tab
|
||||||
record = Settings.get_int_settings(session, "active_tab")
|
record = Settings.get_int_settings(session, "active_tab")
|
||||||
if record.f_int and record.f_int >= 0:
|
if record.f_int is not None and record.f_int >= 0:
|
||||||
self.tabPlaylist.setCurrentIndex(record.f_int)
|
self.tabPlaylist.setCurrentIndex(record.f_int)
|
||||||
|
|
||||||
|
# Tabs may move during use. Rather than track where tabs
|
||||||
|
# are, we record the tab index when we close the main
|
||||||
|
# window. To avoid possible duplicate tab entries, we null
|
||||||
|
# them all out now.
|
||||||
|
Playlists.clear_tabs(session, playlist_ids)
|
||||||
|
|
||||||
def lookup_row_in_songfacts(self) -> None:
|
def lookup_row_in_songfacts(self) -> None:
|
||||||
"""
|
"""
|
||||||
Display songfacts page for title in highlighted row
|
Display songfacts page for title in highlighted row
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user