Compare commits
No commits in common. "fc02a4aa7ea8f315f654698ebc244284571002b8" and "589a664971e40ab96428eb7c439eb10c3a405bd6" have entirely different histories.
fc02a4aa7e
...
589a664971
@ -34,7 +34,6 @@ from PyQt6.QtWidgets import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Third party imports
|
# Third party imports
|
||||||
import line_profiler
|
|
||||||
|
|
||||||
# App imports
|
# App imports
|
||||||
from audacity_controller import AudacityController
|
from audacity_controller import AudacityController
|
||||||
@ -775,29 +774,14 @@ class PlaylistTab(QTableView):
|
|||||||
if row_count < 1:
|
if row_count < 1:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Don't delete current or next tracks
|
|
||||||
selected_row_numbers = self.selected_model_row_numbers()
|
|
||||||
for ts in [
|
|
||||||
track_sequence.next,
|
|
||||||
track_sequence.current,
|
|
||||||
]:
|
|
||||||
if ts:
|
|
||||||
if (
|
|
||||||
ts.playlist_id == self.playlist_id
|
|
||||||
and ts.row_number in selected_row_numbers
|
|
||||||
):
|
|
||||||
self.musicmuster.show_warning(
|
|
||||||
"Delete not allowed", "Can't delete current or next track"
|
|
||||||
)
|
|
||||||
return
|
|
||||||
|
|
||||||
# Get confirmation
|
# Get confirmation
|
||||||
plural = "s" if row_count > 1 else ""
|
plural = "s" if row_count > 1 else ""
|
||||||
if not ask_yes_no("Delete rows", f"Really delete {row_count} row{plural}?"):
|
if not ask_yes_no("Delete rows", f"Really delete {row_count} row{plural}?"):
|
||||||
return
|
return
|
||||||
|
|
||||||
base_model = self.get_base_model()
|
base_model = self.get_base_model()
|
||||||
base_model.delete_rows(selected_row_numbers)
|
|
||||||
|
base_model.delete_rows(self.selected_model_row_numbers())
|
||||||
self.clear_selection()
|
self.clear_selection()
|
||||||
|
|
||||||
def get_base_model(self) -> PlaylistModel:
|
def get_base_model(self) -> PlaylistModel:
|
||||||
@ -846,12 +830,14 @@ class PlaylistTab(QTableView):
|
|||||||
|
|
||||||
# Use a set to deduplicate result (a selected row will have all
|
# Use a set to deduplicate result (a selected row will have all
|
||||||
# items in that row selected)
|
# items in that row selected)
|
||||||
selected_indexes = self.selectedIndexes()
|
result = sorted(
|
||||||
|
list(
|
||||||
|
set([self.model().mapToSource(a).row() for a in self.selectedIndexes()])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if not selected_indexes:
|
log.debug(f"get_selected_rows() returned: {result=}")
|
||||||
return []
|
return result
|
||||||
|
|
||||||
return sorted(list(set([self.model().mapToSource(a).row() for a in selected_indexes])))
|
|
||||||
|
|
||||||
def get_top_visible_row(self) -> int:
|
def get_top_visible_row(self) -> int:
|
||||||
"""
|
"""
|
||||||
@ -1133,7 +1119,6 @@ class PlaylistTab(QTableView):
|
|||||||
|
|
||||||
self.setSpan(row, column, rowSpan, columnSpan)
|
self.setSpan(row, column, rowSpan, columnSpan)
|
||||||
|
|
||||||
@line_profiler.profile
|
|
||||||
def tab_live(self) -> None:
|
def tab_live(self) -> None:
|
||||||
"""
|
"""
|
||||||
Called when tab gets focus
|
Called when tab gets focus
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user