Try to speed up tab switching

This commit is contained in:
Keith Edmunds 2025-02-27 18:21:55 +00:00
parent 589a664971
commit 76e6084419

View File

@ -34,6 +34,7 @@ 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
@ -830,14 +831,12 @@ 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)
result = sorted( selected_indexes = self.selectedIndexes()
list(
set([self.model().mapToSource(a).row() for a in self.selectedIndexes()])
)
)
log.debug(f"get_selected_rows() returned: {result=}") if not selected_indexes:
return result return []
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:
""" """
@ -1119,6 +1118,7 @@ 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