Update musicmuster to use self.selection
This commit is contained in:
parent
e55fab71cf
commit
4bff1a8b59
@ -836,7 +836,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
# Save the selected PlaylistRows items ready for a later
|
# Save the selected PlaylistRows items ready for a later
|
||||||
# paste
|
# paste
|
||||||
self.move_source_rows = self.active_tab().get_selected_rows()
|
self.move_source_rows = self.selection.rows
|
||||||
self.move_source_model = self.active_base_model()
|
self.move_source_model = self.active_base_model()
|
||||||
|
|
||||||
log.debug(
|
log.debug(
|
||||||
@ -850,8 +850,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
# Identify destination playlist
|
# Identify destination playlist
|
||||||
playlists = []
|
playlists = []
|
||||||
visible_tab = self.active_tab()
|
source_playlist_id = self.selection.playlist_id
|
||||||
source_playlist_id = visible_tab.playlist_id
|
|
||||||
|
|
||||||
with db.Session() as session:
|
with db.Session() as session:
|
||||||
for playlist in Playlists.get_all(session):
|
for playlist in Playlists.get_all(session):
|
||||||
@ -893,7 +892,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
Move selected rows to another playlist
|
Move selected rows to another playlist
|
||||||
"""
|
"""
|
||||||
|
|
||||||
selected_rows = self.active_tab().get_selected_rows()
|
selected_rows = self.selection.rows
|
||||||
if not selected_rows:
|
if not selected_rows:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -988,7 +987,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
to_playlist_model = self.active_base_model()
|
to_playlist_model = self.active_base_model()
|
||||||
selected_rows = self.active_tab().get_selected_rows()
|
selected_rows = self.selection.rows
|
||||||
if selected_rows:
|
if selected_rows:
|
||||||
destination_row = selected_rows[0]
|
destination_row = selected_rows[0]
|
||||||
else:
|
else:
|
||||||
@ -1207,7 +1206,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
with db.Session() as session:
|
with db.Session() as session:
|
||||||
playlist_id = self.active_tab().playlist_id
|
playlist_id = self.selection.playlist_id
|
||||||
playlist = session.get(Playlists, playlist_id)
|
playlist = session.get(Playlists, playlist_id)
|
||||||
if playlist:
|
if playlist:
|
||||||
new_name = self.solicit_playlist_name(session, playlist.name)
|
new_name = self.solicit_playlist_name(session, playlist.name)
|
||||||
@ -1321,7 +1320,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self, "Duplicate template", "Template name already in use"
|
self, "Duplicate template", "Template name already in use"
|
||||||
)
|
)
|
||||||
Playlists.save_as_template(
|
Playlists.save_as_template(
|
||||||
session, self.active_tab().playlist_id, template_name
|
session, self.selection.playlist_id, template_name
|
||||||
)
|
)
|
||||||
session.commit()
|
session.commit()
|
||||||
helpers.show_OK(self, "Template", "Template saved")
|
helpers.show_OK(self, "Template", "Template saved")
|
||||||
@ -1359,7 +1358,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
next track. If no next track, return None.
|
next track. If no next track, return None.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
row_number = self.active_tab().source_model_selected_row_number()
|
row_number = self.selection.rows[0]
|
||||||
if row_number is None:
|
if row_number is None:
|
||||||
if track_sequence.next:
|
if track_sequence.next:
|
||||||
if track_sequence.next.track_id:
|
if track_sequence.next.track_id:
|
||||||
@ -1450,7 +1449,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Switch to correct tab
|
# Switch to correct tab
|
||||||
if playlist_id != self.active_tab().playlist_id:
|
if playlist_id != self.selection.playlist_id:
|
||||||
for idx in range(self.tabPlaylist.count()):
|
for idx in range(self.tabPlaylist.count()):
|
||||||
if self.tabPlaylist.widget(idx).playlist_id == playlist_id:
|
if self.tabPlaylist.widget(idx).playlist_id == playlist_id:
|
||||||
self.tabPlaylist.setCurrentIndex(idx)
|
self.tabPlaylist.setCurrentIndex(idx)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user