mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Tag Browser: Add an option in Preferences->Look & Feel->Tag Browser to turn off the display of counts in the Tag Browser
This commit is contained in:
parent
88eabfc7d0
commit
e3a77bf17f
@ -145,6 +145,7 @@ defs['show_emblems'] = False
|
||||
defs['emblem_size'] = 32
|
||||
defs['emblem_position'] = 'left'
|
||||
defs['metadata_diff_mark_rejected'] = False
|
||||
defs['tag_browser_show_counts'] = True
|
||||
del defs
|
||||
# }}}
|
||||
|
||||
|
@ -288,6 +288,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
r('cover_grid_disk_cache_size', gprefs)
|
||||
r('cover_grid_spacing', gprefs)
|
||||
r('cover_grid_show_title', gprefs)
|
||||
r('tag_browser_show_counts', gprefs)
|
||||
|
||||
r('cover_flow_queue_length', config, restart_required=True)
|
||||
r('cover_browser_reflections', gprefs)
|
||||
|
@ -898,14 +898,14 @@ then the tags will be displayed each on their own line.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_tag_browser_old_look">
|
||||
<property name="text">
|
||||
<string>Use &alternating row colors in the Tag Browser</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_tag_browser_hide_empty_categories">
|
||||
<property name="toolTip">
|
||||
<string>When checked, calibre will automatically hide any category
|
||||
@ -932,7 +932,7 @@ if you never want subcategories</string>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Tags browser category &partitioning method:</string>
|
||||
<string>&Tags browser category partitioning method:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>opt_tags_browser_partition_method</cstring>
|
||||
@ -949,6 +949,18 @@ if you never want subcategories</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_tag_browser_show_counts">
|
||||
<property name="toolTip">
|
||||
<string>Show counts for items in the Tag Browser. Such as the number of books
|
||||
by each author, the number of authors, etc. If you turn it off, you can still
|
||||
see the counts by hovering your mouse over any item.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show &counts in the Tag Browser</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
|
@ -59,13 +59,17 @@ class TagDelegate(QStyledItemDelegate): # {{{
|
||||
|
||||
def draw_text(self, style, painter, option, widget, index, item):
|
||||
tr = style.subElementRect(style.SE_ItemViewItemText, option, widget)
|
||||
count = unicode(index.data(COUNT_ROLE))
|
||||
width = painter.fontMetrics().boundingRect(count).width()
|
||||
text = index.data(Qt.DisplayRole)
|
||||
r = QRect(tr)
|
||||
r.setRight(r.right() - 1), r.setLeft(r.right() - width - 4)
|
||||
painter.drawText(r, Qt.AlignCenter | Qt.TextSingleLine, count)
|
||||
tr.setRight(r.left() - 1)
|
||||
hover = option.state & style.State_MouseOver
|
||||
if hover or gprefs['tag_browser_show_counts']:
|
||||
count = unicode(index.data(COUNT_ROLE))
|
||||
width = painter.fontMetrics().boundingRect(count).width()
|
||||
r = QRect(tr)
|
||||
r.setRight(r.right() - 1), r.setLeft(r.right() - width - 4)
|
||||
painter.drawText(r, Qt.AlignCenter | Qt.TextSingleLine, count)
|
||||
tr.setRight(r.left() - 1)
|
||||
else:
|
||||
tr.setRight(tr.right() - 1)
|
||||
is_rating = item.type == TagTreeItem.TAG and not self.rating_pat.sub('', text)
|
||||
if is_rating:
|
||||
painter.setFont(self.rating_font)
|
||||
|
Loading…
x
Reference in New Issue
Block a user