From bcefa6b18efde3f8344a1ac1c4fecc29ec3ddc58 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Tue, 1 Apr 2025 17:10:18 +0100 Subject: [PATCH] Fix misuse of isSectionIndex() in visible_columns. isSectionIndex() takes a logical index but a visual index was being given. The misuse led to the problem reported in https://www.mobileread.com/forums/showthread.php?t=367195 --- src/calibre/gui2/library/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 9117ee2319..1c04e6158d 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -1237,9 +1237,7 @@ class BooksView(TableView): # {{{ @property def visible_columns(self): h = self.horizontalHeader() - logical_indices = (x for x in range(h.count()) if not h.isSectionHidden(x)) - rmap = dict(enumerate(self.column_map)) - return (rmap[h.visualIndex(x)] for x in logical_indices if h.visualIndex(x) > -1) + return (key for lidx,key in enumerate(self.column_map) if not h.isSectionHidden(lidx)) def refresh_book_details(self, force=False): idx = self.currentIndex()