From 6218e5a48dda12fcea0163e06dc5a2246752a037 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Thu, 25 Jun 2020 09:23:33 +0100 Subject: [PATCH] Enhancement: in the tag browser don't show counts for searches because the number is always zero. --- src/calibre/gui2/tag_browser/model.py | 2 +- src/calibre/gui2/tag_browser/view.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tag_browser/model.py b/src/calibre/gui2/tag_browser/model.py index d1f810aac3..5db4eb7bb3 100644 --- a/src/calibre/gui2/tag_browser/model.py +++ b/src/calibre/gui2/tag_browser/model.py @@ -215,7 +215,7 @@ class TagTreeItem(object): # {{{ tt.append(_('Books in this category are unrated')) if self.type == self.TAG and self.tag.category == 'search': tt.append(_('Search expression:') + ' ' + self.tag.search_expression) - if self.type == self.TAG: + if self.type == self.TAG and self.tag.category != 'search': tt.append(_('Number of books: %s') % self.item_count) return '\n'.join(tt) return None diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 0cebb73126..4babbb5417 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -76,7 +76,9 @@ class TagDelegate(QStyledItemDelegate): # {{{ tr = style.subElementRect(style.SE_ItemViewItemText, option, widget) text = index.data(Qt.DisplayRole) hover = option.state & style.State_MouseOver - if hover or gprefs['tag_browser_show_counts']: + is_search = (True if item.type == TagTreeItem.TAG and + item.tag.category == 'search' else False) + if not is_search and (hover or gprefs['tag_browser_show_counts']): count = unicode_type(index.data(COUNT_ROLE)) width = painter.fontMetrics().boundingRect(count).width() r = QRect(tr)