mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -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_size'] = 32
|
||||||
defs['emblem_position'] = 'left'
|
defs['emblem_position'] = 'left'
|
||||||
defs['metadata_diff_mark_rejected'] = False
|
defs['metadata_diff_mark_rejected'] = False
|
||||||
|
defs['tag_browser_show_counts'] = True
|
||||||
del defs
|
del defs
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
@ -288,6 +288,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
r('cover_grid_disk_cache_size', gprefs)
|
r('cover_grid_disk_cache_size', gprefs)
|
||||||
r('cover_grid_spacing', gprefs)
|
r('cover_grid_spacing', gprefs)
|
||||||
r('cover_grid_show_title', gprefs)
|
r('cover_grid_show_title', gprefs)
|
||||||
|
r('tag_browser_show_counts', gprefs)
|
||||||
|
|
||||||
r('cover_flow_queue_length', config, restart_required=True)
|
r('cover_flow_queue_length', config, restart_required=True)
|
||||||
r('cover_browser_reflections', gprefs)
|
r('cover_browser_reflections', gprefs)
|
||||||
|
@ -898,14 +898,14 @@ then the tags will be displayed each on their own line.</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="8" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="opt_tag_browser_old_look">
|
<widget class="QCheckBox" name="opt_tag_browser_old_look">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use &alternating row colors in the Tag Browser</string>
|
<string>Use &alternating row colors in the Tag Browser</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<widget class="QCheckBox" name="opt_tag_browser_hide_empty_categories">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>When checked, calibre will automatically hide any category
|
<string>When checked, calibre will automatically hide any category
|
||||||
@ -932,7 +932,7 @@ if you never want subcategories</string>
|
|||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_9">
|
<widget class="QLabel" name="label_9">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Tags browser category &partitioning method:</string>
|
<string>&Tags browser category partitioning method:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>opt_tags_browser_partition_method</cstring>
|
<cstring>opt_tags_browser_partition_method</cstring>
|
||||||
@ -949,6 +949,18 @@ if you never want subcategories</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_3">
|
<widget class="QWidget" name="tab_3">
|
||||||
|
@ -59,13 +59,17 @@ class TagDelegate(QStyledItemDelegate): # {{{
|
|||||||
|
|
||||||
def draw_text(self, style, painter, option, widget, index, item):
|
def draw_text(self, style, painter, option, widget, index, item):
|
||||||
tr = style.subElementRect(style.SE_ItemViewItemText, option, widget)
|
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)
|
text = index.data(Qt.DisplayRole)
|
||||||
r = QRect(tr)
|
hover = option.state & style.State_MouseOver
|
||||||
r.setRight(r.right() - 1), r.setLeft(r.right() - width - 4)
|
if hover or gprefs['tag_browser_show_counts']:
|
||||||
painter.drawText(r, Qt.AlignCenter | Qt.TextSingleLine, count)
|
count = unicode(index.data(COUNT_ROLE))
|
||||||
tr.setRight(r.left() - 1)
|
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)
|
is_rating = item.type == TagTreeItem.TAG and not self.rating_pat.sub('', text)
|
||||||
if is_rating:
|
if is_rating:
|
||||||
painter.setFont(self.rating_font)
|
painter.setFont(self.rating_font)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user