Added "Open Playlist" option to the menubar.
This commit is contained in:
parent
9ee4184c84
commit
0101cf174c
4 changed files with 13 additions and 8 deletions
|
@ -95,9 +95,6 @@ class Library:
|
|||
if self.temporary_playlist is not None:
|
||||
self.temporary_playlist.delete()
|
||||
|
||||
if self.temporary_playlist in self.playlists:
|
||||
self.playlists.remove(self.temporary_playlist)
|
||||
|
||||
if not replace in self.playlists:
|
||||
self.playlists.append(replace)
|
||||
|
||||
|
@ -112,7 +109,7 @@ class Library:
|
|||
|
||||
playlist.load()
|
||||
|
||||
def import_playlist(self, playlist_path: str):
|
||||
def open_playlist(self, playlist_path: str):
|
||||
playlist = Playlist(self.app, "Temporary Playlist", playlist_path)
|
||||
|
||||
self.replace_temporary_playlist(playlist)
|
||||
|
@ -121,3 +118,6 @@ class Library:
|
|||
|
||||
playlist.load()
|
||||
|
||||
def import_playlist(self, playlist_path: str):
|
||||
self.open_playlist(playlist_path)
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ class Playlist:
|
|||
track.delete_items(self)
|
||||
|
||||
# make sure the playlist is not referenced as the temporary playlist
|
||||
if self == self.app.library.temporary_playlist:
|
||||
if self is self.app.library.temporary_playlist:
|
||||
self.app.library.temporary_playlist = None
|
||||
|
||||
self.app.utils.unique_names.remove(self.title)
|
||||
|
|
|
@ -32,7 +32,8 @@ class MainWindow(QMainWindow):
|
|||
self.playlist_menu = QMenu("&Playlist", self.menu_bar)
|
||||
self.menu_bar.addMenu(self.playlist_menu)
|
||||
|
||||
self.import_playlist_action = self.playlist_menu.addAction("&Import Playlists")
|
||||
self.open_playlist_action = self.playlist_menu.addAction("&Open Playlist")
|
||||
self.import_playlist_action = self.playlist_menu.addAction("&Import Playlist")
|
||||
|
||||
self.edit_menu = QMenu("&Edit", self.menu_bar)
|
||||
self.menu_bar.addMenu(self.edit_menu)
|
||||
|
|
|
@ -22,6 +22,7 @@ class Popups:
|
|||
|
||||
self.window.open_track_action.triggered.connect(self.open_tracks)
|
||||
self.window.import_track_action.triggered.connect(self.import_tracks)
|
||||
self.window.open_playlist_action.triggered.connect(self.open_playlist)
|
||||
self.window.import_playlist_action.triggered.connect(self.import_playlist)
|
||||
|
||||
def select_audio_files(self):
|
||||
|
@ -41,8 +42,11 @@ class Popups:
|
|||
def import_tracks(self):
|
||||
self.open_tracks() # placeholder
|
||||
|
||||
def import_playlist(self):
|
||||
def open_playlist(self):
|
||||
playlist_path = self.select_playlist_file()
|
||||
|
||||
if playlist_path is not None and not playlist_path == "":
|
||||
self.app.library.import_playlist(playlist_path)
|
||||
self.app.library.open_playlist(playlist_path)
|
||||
|
||||
def import_playlist(self):
|
||||
self.open_playlist() # placeholder
|
||||
|
|
Loading…
Add table
Reference in a new issue