Close playlist from menubar
This commit is contained in:
parent
f1796451ae
commit
066b20a571
@ -309,12 +309,10 @@ class Playlists(Base):
|
|||||||
#
|
#
|
||||||
# xPlaylistTracks(session, self.id, track_id, row)
|
# xPlaylistTracks(session, self.id, track_id, row)
|
||||||
#
|
#
|
||||||
# def close(self, session: Session) -> None:
|
def close(self, session: Session) -> None:
|
||||||
# """Record playlist as no longer loaded"""
|
"""Mark playlist as unloaded"""
|
||||||
#
|
|
||||||
# self.loaded = False
|
self.loaded = False
|
||||||
# session.add(self)
|
|
||||||
# session.flush()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_all(cls, session: Session) -> List["Playlists"]:
|
def get_all(cls, session: Session) -> List["Playlists"]:
|
||||||
|
|||||||
@ -170,7 +170,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
def connect_signals_slots(self) -> None:
|
def connect_signals_slots(self) -> None:
|
||||||
# self.actionAdd_note.triggered.connect(self.create_note)
|
# self.actionAdd_note.triggered.connect(self.create_note)
|
||||||
self.action_Clear_selection.triggered.connect(self.clear_selection)
|
self.action_Clear_selection.triggered.connect(self.clear_selection)
|
||||||
# self.actionClosePlaylist.triggered.connect(self.close_playlist_tab)
|
self.actionClosePlaylist.triggered.connect(self.close_playlist_tab)
|
||||||
# self.actionDownload_CSV_of_played_tracks.triggered.connect(
|
# self.actionDownload_CSV_of_played_tracks.triggered.connect(
|
||||||
# self.download_played_tracks)
|
# self.download_played_tracks)
|
||||||
self.actionEnable_controls.triggered.connect(
|
self.actionEnable_controls.triggered.connect(
|
||||||
@ -216,32 +216,30 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
# with Session() as session:
|
# with Session() as session:
|
||||||
# playlist = Playlists(session, dlg.textValue())
|
# playlist = Playlists(session, dlg.textValue())
|
||||||
# self.create_playlist_tab(session, playlist)
|
# self.create_playlist_tab(session, playlist)
|
||||||
#
|
|
||||||
# def close_playlist_tab(self) -> None:
|
def close_playlist_tab(self) -> None:
|
||||||
# """Close active playlist tab"""
|
"""
|
||||||
#
|
Close active playlist tab unless it holds the curren or next track.
|
||||||
# self.close_tab(self.tabPlaylist.currentIndex())
|
"""
|
||||||
#
|
|
||||||
# def close_tab(self, index: int) -> None:
|
tab_index = self.tabPlaylist.currentIndex()
|
||||||
# """
|
|
||||||
# Close tab unless it holds the curren or next track
|
# Don't close current track playlist
|
||||||
# """
|
if self.tabPlaylist.widget(tab_index) == (
|
||||||
#
|
self.current_track_playlist_tab):
|
||||||
# if hasattr(self.tabPlaylist.widget(index), 'playlist_id'):
|
self.statusbar.showMessage(
|
||||||
# if self.tabPlaylist.widget(index) == (
|
"Can't close current track playlist", 5000)
|
||||||
# self.current_track_playlist_tab):
|
return
|
||||||
# self.statusbar.showMessage(
|
|
||||||
# "Can't close current track playlist", 5000)
|
# Don't close next track playlist
|
||||||
# return
|
if self.tabPlaylist.widget(tab_index) == self.next_track_playlist_tab:
|
||||||
# if self.tabPlaylist.widget(index) == self.next_track_playlist_tab:
|
self.statusbar.showMessage(
|
||||||
# self.statusbar.showMessage(
|
"Can't close next track playlist", 5000)
|
||||||
# "Can't close next track playlist", 5000)
|
return
|
||||||
# return
|
|
||||||
# # It's OK to close this playlist so remove from open playlist list
|
# Close playlist and remove tab
|
||||||
# self.tabPlaylist.widget(index).close()
|
self.tabPlaylist.widget(tab_index).close()
|
||||||
#
|
self.tabPlaylist.removeTab(tab_index)
|
||||||
# # Close regardless of tab type
|
|
||||||
# self.tabPlaylist.removeTab(index)
|
|
||||||
#
|
#
|
||||||
# def create_note(self) -> None:
|
# def create_note(self) -> None:
|
||||||
# """Call playlist to create note"""
|
# """Call playlist to create note"""
|
||||||
|
|||||||
@ -349,23 +349,15 @@ class PlaylistTab(QTableWidget):
|
|||||||
|
|
||||||
return [self._get_playlistrow_id(a) for a in self._selected_rows()]
|
return [self._get_playlistrow_id(a) for a in self._selected_rows()]
|
||||||
|
|
||||||
# def closeEvent(self, event) -> None:
|
def closeEvent(self, event) -> None:
|
||||||
# """Save column widths"""
|
"""Handle closing playist tab"""
|
||||||
#
|
|
||||||
# log.debug(f"playlists.closeEvent()")
|
with Session() as session:
|
||||||
# with Session() as session:
|
# Record playlist as closed
|
||||||
# for column in range(self.columnCount()):
|
playlist = session.get(Playlists, self.playlist_id)
|
||||||
# width = self.columnWidth(column)
|
playlist.close(session)
|
||||||
# name = f"playlist_col_{str(column)}_width"
|
|
||||||
# record = Settings.get_int_settings(session, name)
|
event.accept()
|
||||||
# if record.f_int != self.columnWidth(column):
|
|
||||||
# record.update(session, {'f_int': width})
|
|
||||||
#
|
|
||||||
# # Record playlist as closed
|
|
||||||
# playlist = Playlists.get_by_id(session, self.playlist_id)
|
|
||||||
# playlist.close(session)
|
|
||||||
#
|
|
||||||
# event.accept()
|
|
||||||
|
|
||||||
def clear_next(self, session) -> None:
|
def clear_next(self, session) -> None:
|
||||||
"""Clear next track marker"""
|
"""Clear next track marker"""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user