Tag browser: Dont show counts for searches as they are always zero

Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
Kovid Goyal 2020-06-25 13:59:49 +05:30
commit 36288d8343
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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)