Clean up direct references to playlist tab from musicmuster
This commit is contained in:
parent
7ce07c1cc7
commit
e55fab71cf
@ -567,7 +567,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
def debug(self):
|
||||
"""Invoke debugger"""
|
||||
|
||||
visible_playlist_id = self.active_tab().playlist_id
|
||||
visible_playlist_id = self.selection.playlist_id
|
||||
print(f"Active playlist id={visible_playlist_id}")
|
||||
import ipdb # type: ignore
|
||||
|
||||
@ -579,7 +579,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
"""
|
||||
|
||||
with db.Session() as session:
|
||||
playlist_id = self.active_tab().playlist_id
|
||||
playlist_id = self.selection.playlist_id
|
||||
playlist = session.get(Playlists, playlist_id)
|
||||
if playlist:
|
||||
if helpers.ask_yes_no(
|
||||
@ -655,7 +655,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
track_sequence.current = None
|
||||
|
||||
# Tell playlist previous track has finished
|
||||
self.active_tab().previous_track_ended()
|
||||
self.active_base_model().previous_track_ended()
|
||||
|
||||
# Reset clocks
|
||||
self.frame_fade.setStyleSheet("")
|
||||
@ -677,10 +677,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
def export_playlist_tab(self) -> None:
|
||||
"""Export the current playlist to an m3u file"""
|
||||
|
||||
if not self.active_tab():
|
||||
return
|
||||
|
||||
playlist_id = self.active_tab().playlist_id
|
||||
playlist_id = self.selection.playlist_id
|
||||
|
||||
with db.Session() as session:
|
||||
# Get output filename
|
||||
@ -747,11 +744,11 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
Pass import files call to file_importer module
|
||||
"""
|
||||
|
||||
# We need to keep a referent to the FileImporter else it will be
|
||||
# We need to keep a reference to the FileImporter else it will be
|
||||
# garbage collected while import threads are still running
|
||||
self.importer = FileImporter(
|
||||
self.active_base_model(),
|
||||
self.active_tab().source_model_selected_row_number(),
|
||||
self.selection.rows[0],
|
||||
)
|
||||
self.importer.do_import()
|
||||
|
||||
@ -766,17 +763,17 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
ok = dlg.exec()
|
||||
if ok:
|
||||
self.active_base_model().insert_row(
|
||||
proposed_row_number=self.active_tab().source_model_selected_row_number(),
|
||||
proposed_row_number=self.selection.rows[0],
|
||||
note=dlg.textValue(),
|
||||
)
|
||||
|
||||
def insert_track(self) -> None:
|
||||
"""Show dialog box to select and add track from database"""
|
||||
|
||||
new_row_number = (
|
||||
self.active_tab().source_model_selected_row_number()
|
||||
or self.active_base_model().rowCount()
|
||||
)
|
||||
if self.selection.rows:
|
||||
new_row_number = self.selection.rows[0]
|
||||
else:
|
||||
new_row_number = self.active_base_model().rowCount()
|
||||
with db.Session() as session:
|
||||
dlg = TrackSelectDialog(
|
||||
parent=self,
|
||||
|
||||
@ -930,14 +930,6 @@ class PlaylistTab(QTableView):
|
||||
except ApplicationError as e:
|
||||
show_warning(self.musicmuster, "Audacity error", str(e))
|
||||
|
||||
def previous_track_ended(self) -> None:
|
||||
"""
|
||||
Called when track ends
|
||||
"""
|
||||
|
||||
# Let the model know
|
||||
self.get_base_model().previous_track_ended()
|
||||
|
||||
def _remove_comments(self) -> None:
|
||||
"""
|
||||
Remove comments from selected rows
|
||||
@ -1049,7 +1041,7 @@ class PlaylistTab(QTableView):
|
||||
|
||||
def _selected_row_indexes(self) -> List[QModelIndex]:
|
||||
"""
|
||||
Return a list of indexes of column 1 of selected rows
|
||||
Return a list of indexes of column 0 of selected rows
|
||||
"""
|
||||
|
||||
sm = self.selectionModel()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user