From a1d64657307f20a14a38146d1c57db4d8cf59acb Mon Sep 17 00:00:00 2001 From: Maksim Totmin Date: Mon, 1 Jun 2026 15:13:00 +0700 Subject: [PATCH] fix: sort by # now uses track_num from UserRole instead of cell text, so EQ animation doesn't break sorting --- src/ui/library_tab.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ui/library_tab.py b/src/ui/library_tab.py index 6714674..13301bf 100644 --- a/src/ui/library_tab.py +++ b/src/ui/library_tab.py @@ -43,10 +43,11 @@ EQ_FRAMES = [ class NumericTableItem(QTableWidgetItem): def __lt__(self, other): - try: - return int(self.text()) < int(other.text()) - except ValueError: - return super().__lt__(other) + _, self_data = self.data(Qt.ItemDataRole.UserRole) or (False, {}) + _, other_data = other.data(Qt.ItemDataRole.UserRole) or (False, {}) + self_num = (self_data or {}).get("track_num", 0) or 0 + other_num = (other_data or {}).get("track_num", 0) or 0 + return self_num < other_num class LibraryTab(QWidget):