mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Enhancement: in the tag browser don't show counts for searches because the number is always zero.
This commit is contained in:
parent
9b3c57062b
commit
6218e5a48d
@ -215,7 +215,7 @@ class TagTreeItem(object): # {{{
|
|||||||
tt.append(_('Books in this category are unrated'))
|
tt.append(_('Books in this category are unrated'))
|
||||||
if self.type == self.TAG and self.tag.category == 'search':
|
if self.type == self.TAG and self.tag.category == 'search':
|
||||||
tt.append(_('Search expression:') + ' ' + self.tag.search_expression)
|
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)
|
tt.append(_('Number of books: %s') % self.item_count)
|
||||||
return '\n'.join(tt)
|
return '\n'.join(tt)
|
||||||
return None
|
return None
|
||||||
|
@ -76,7 +76,9 @@ class TagDelegate(QStyledItemDelegate): # {{{
|
|||||||
tr = style.subElementRect(style.SE_ItemViewItemText, option, widget)
|
tr = style.subElementRect(style.SE_ItemViewItemText, option, widget)
|
||||||
text = index.data(Qt.DisplayRole)
|
text = index.data(Qt.DisplayRole)
|
||||||
hover = option.state & style.State_MouseOver
|
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))
|
count = unicode_type(index.data(COUNT_ROLE))
|
||||||
width = painter.fontMetrics().boundingRect(count).width()
|
width = painter.fontMetrics().boundingRect(count).width()
|
||||||
r = QRect(tr)
|
r = QRect(tr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user