From 76e608441990c76ebab3f11ba07c4dd3f099cfc9 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Thu, 27 Feb 2025 18:21:55 +0000 Subject: [PATCH] Try to speed up tab switching --- app/playlists.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/playlists.py b/app/playlists.py index f87d974..064dde6 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -34,6 +34,7 @@ from PyQt6.QtWidgets import ( ) # Third party imports +import line_profiler # App imports from audacity_controller import AudacityController @@ -830,14 +831,12 @@ class PlaylistTab(QTableView): # Use a set to deduplicate result (a selected row will have all # items in that row selected) - result = sorted( - list( - set([self.model().mapToSource(a).row() for a in self.selectedIndexes()]) - ) - ) + selected_indexes = self.selectedIndexes() - log.debug(f"get_selected_rows() returned: {result=}") - return result + if not selected_indexes: + return [] + + return sorted(list(set([self.model().mapToSource(a).row() for a in selected_indexes]))) def get_top_visible_row(self) -> int: """ @@ -1119,6 +1118,7 @@ class PlaylistTab(QTableView): self.setSpan(row, column, rowSpan, columnSpan) + @line_profiler.profile def tab_live(self) -> None: """ Called when tab gets focus