Fix inability to close playlists
This commit is contained in:
parent
a8f709d2da
commit
92eb3fc953
@ -284,16 +284,23 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
Return True if tab closed else False.
|
||||
"""
|
||||
|
||||
# Don't close current track playlist
|
||||
if track_sequence.current is None:
|
||||
return True
|
||||
|
||||
current_track_playlist_id = track_sequence.current.playlist_id
|
||||
closing_tab_playlist_id = self.tabPlaylist.widget(tab_index).playlist_id
|
||||
if current_track_playlist_id:
|
||||
if closing_tab_playlist_id == current_track_playlist_id:
|
||||
self.show_status_message("Can't close current track playlist", 5000)
|
||||
return False
|
||||
|
||||
# Don't close current track playlist
|
||||
if track_sequence.current is not None:
|
||||
current_track_playlist_id = track_sequence.current.playlist_id
|
||||
if current_track_playlist_id:
|
||||
if closing_tab_playlist_id == current_track_playlist_id:
|
||||
helpers.show_OK(self, "Current track", "Can't close current track playlist")
|
||||
return False
|
||||
|
||||
# Don't close next track playlist
|
||||
if track_sequence.next is not None:
|
||||
next_track_playlist_id = track_sequence.next.playlist_id
|
||||
if next_track_playlist_id:
|
||||
if closing_tab_playlist_id == next_track_playlist_id:
|
||||
helpers.show_OK(self, "Next track", "Can't close next track playlist")
|
||||
return False
|
||||
|
||||
# Record playlist as closed and update remaining playlist tabs
|
||||
with db.Session() as session:
|
||||
@ -896,7 +903,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
playlist.mark_open()
|
||||
session.commit()
|
||||
|
||||
self.tabPlaylist.setCurrentIndex(idx)
|
||||
self.tabPlaylist.setCurrentIndex(idx)
|
||||
|
||||
def paste_rows(self) -> None:
|
||||
"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user