WIP: playlists.py refactor
Hide/show played tracks
This commit is contained in:
parent
19377a8e1c
commit
6de95573ff
@ -859,7 +859,8 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
# Update all displayed playlists
|
# Update all displayed playlists
|
||||||
with Session() as session:
|
with Session() as session:
|
||||||
for i in range(self.tabPlaylist.count()):
|
for i in range(self.tabPlaylist.count()):
|
||||||
self.tabPlaylist.widget(i).update_display(session)
|
self.tabPlaylist.widget(i).hide_played_tracks(
|
||||||
|
self.hide_played_tracks)
|
||||||
|
|
||||||
def import_track(self) -> None:
|
def import_track(self) -> None:
|
||||||
"""Import track file"""
|
"""Import track file"""
|
||||||
|
|||||||
@ -599,6 +599,21 @@ class PlaylistTab(QTableWidget):
|
|||||||
|
|
||||||
return [plr for plr in plrs if plr is not None]
|
return [plr for plr in plrs if plr is not None]
|
||||||
|
|
||||||
|
def hide_played_tracks(self, hide: bool) -> None:
|
||||||
|
"""Hide played tracks if hide is True else show them"""
|
||||||
|
|
||||||
|
with Session() as session:
|
||||||
|
played = [
|
||||||
|
p.row_number for p in PlaylistRows.get_played_rows(
|
||||||
|
session, self.playlist_id)
|
||||||
|
]
|
||||||
|
for row in range(self.rowCount()):
|
||||||
|
if row in played:
|
||||||
|
if hide:
|
||||||
|
self.hideRow(row)
|
||||||
|
else:
|
||||||
|
self.showRow(row)
|
||||||
|
|
||||||
def insert_header(self, session: scoped_session, note: str) -> None:
|
def insert_header(self, session: scoped_session, note: str) -> None:
|
||||||
"""
|
"""
|
||||||
Insert section header into playlist tab.
|
Insert section header into playlist tab.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user