mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Tag browser: Add an option to control the spacing between items
Also tighten the default spacing a little bit
This commit is contained in:
parent
1e12b6d64e
commit
bcb3f1c555
@ -150,6 +150,7 @@ def create_defs():
|
||||
defs['tag_browser_show_counts'] = True
|
||||
defs['row_numbers_in_book_list'] = True
|
||||
defs['hidpi'] = 'auto'
|
||||
defs['tag_browser_item_padding'] = 0.5
|
||||
|
||||
|
||||
create_defs()
|
||||
|
@ -350,7 +350,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
r('book_list_tooltips', gprefs)
|
||||
r('show_layout_buttons', gprefs, restart_required=True)
|
||||
r('row_numbers_in_book_list', gprefs)
|
||||
r('tag_browser_old_look', gprefs, restart_required=True)
|
||||
r('tag_browser_old_look', gprefs)
|
||||
r('tag_browser_hide_empty_categories', gprefs)
|
||||
r('bd_show_cover', gprefs)
|
||||
r('bd_overlay_cover_size', gprefs)
|
||||
@ -361,6 +361,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
r('cover_grid_spacing', gprefs)
|
||||
r('cover_grid_show_title', gprefs)
|
||||
r('tag_browser_show_counts', gprefs)
|
||||
r('tag_browser_item_padding', gprefs)
|
||||
|
||||
r('cover_flow_queue_length', config, restart_required=True)
|
||||
r('cover_browser_reflections', gprefs)
|
||||
@ -707,6 +708,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
m = gui.library_view.model()
|
||||
m.beginResetModel(), m.endResetModel()
|
||||
self.update_font_display()
|
||||
gui.tags_view.set_look_and_feel()
|
||||
gui.tags_view.reread_collapse_parameters()
|
||||
gui.library_view.refresh_book_details()
|
||||
gui.library_view.set_row_header_visibility()
|
||||
|
@ -839,7 +839,7 @@ A value of zero means calculate automatically.</string>
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Co&llapse when more items than:</string>
|
||||
@ -849,7 +849,7 @@ A value of zero means calculate automatically.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="opt_tags_browser_collapse_at">
|
||||
<property name="toolTip">
|
||||
<string>If a Tag browser category has more than this number of items, it is divided
|
||||
@ -860,7 +860,7 @@ up into subcategories. If the partition method is set to disable, this value is
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_8111">
|
||||
<property name="text">
|
||||
<string>Categories &not to partition:</string>
|
||||
@ -870,7 +870,7 @@ up into subcategories. If the partition method is set to disable, this value is
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="EditWithComplete" name="opt_tag_browser_dont_collapse">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
@ -887,7 +887,7 @@ a few top-level elements.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_81">
|
||||
<property name="text">
|
||||
<string>Categories with &hierarchical items:</string>
|
||||
@ -897,7 +897,7 @@ a few top-level elements.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="EditWithComplete" name="opt_categories_using_hierarchy">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
@ -915,14 +915,14 @@ then the tags will be displayed each on their own line.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<item row="10" 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="9" column="0" colspan="2">
|
||||
<item row="11" 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
|
||||
@ -956,7 +956,7 @@ if you never want subcategories</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="opt_show_avg_rating">
|
||||
<property name="text">
|
||||
<string>Show &average ratings in the Tag browser</string>
|
||||
@ -966,7 +966,7 @@ if you never want subcategories</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="9" 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
|
||||
@ -978,6 +978,38 @@ see the counts by hovering your mouse over any item.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>&Padding between items:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>opt_tag_browser_item_padding</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="opt_tag_browser_item_padding">
|
||||
<property name="toolTip">
|
||||
<string>The spacing between consecutive items in the Tag browser. In units of (ex) which is the approximate height of the letter 'x' in the currently used font. </string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> ex</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="cover_browser_tab">
|
||||
|
@ -30,7 +30,7 @@ class TagDelegate(QStyledItemDelegate): # {{{
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
QStyledItemDelegate.__init__(self, *args, **kwargs)
|
||||
self.old_look = gprefs['tag_browser_old_look']
|
||||
self.old_look = False
|
||||
self.rating_pat = re.compile(r'[%s]' % rating_to_stars(3, True))
|
||||
self.rating_font = QFont(rating_font())
|
||||
|
||||
@ -162,6 +162,12 @@ class TagsView(QTreeView): # {{{
|
||||
self._model.user_categories_edited.connect(self.user_categories_edited,
|
||||
type=Qt.QueuedConnection)
|
||||
self._model.drag_drop_finished.connect(self.drag_drop_finished)
|
||||
self.set_look_and_feel()
|
||||
# Allowing keyboard focus looks bad in the Qt Fusion style and is useless
|
||||
# anyway since the enter/spacebar keys do nothing
|
||||
self.setFocusPolicy(Qt.NoFocus)
|
||||
|
||||
def set_look_and_feel(self):
|
||||
stylish_tb = '''
|
||||
QTreeView {
|
||||
background-color: palette(window);
|
||||
@ -172,8 +178,8 @@ class TagsView(QTreeView): # {{{
|
||||
self.setStyleSheet('''
|
||||
QTreeView::item {
|
||||
border: 1px solid transparent;
|
||||
padding-top:0.8ex;
|
||||
padding-bottom:0.8ex;
|
||||
padding-top:PADex;
|
||||
padding-bottom:PADex;
|
||||
}
|
||||
|
||||
QTreeView::item:hover {
|
||||
@ -181,12 +187,10 @@ class TagsView(QTreeView): # {{{
|
||||
border: 1px solid #bfcde4;
|
||||
border-radius: 6px;
|
||||
}
|
||||
''' + ('' if gprefs['tag_browser_old_look'] else stylish_tb))
|
||||
if gprefs['tag_browser_old_look']:
|
||||
self.setAlternatingRowColors(True)
|
||||
# Allowing keyboard focus looks bad in the Qt Fusion style and is useless
|
||||
# anyway since the enter/spacebar keys do nothing
|
||||
self.setFocusPolicy(Qt.NoFocus)
|
||||
'''.replace('PAD', str(gprefs['tag_browser_item_padding'])) + (
|
||||
'' if gprefs['tag_browser_old_look'] else stylish_tb))
|
||||
self.setAlternatingRowColors(gprefs['tag_browser_old_look'])
|
||||
self.itemDelegate().old_look = gprefs['tag_browser_old_look']
|
||||
|
||||
@property
|
||||
def hidden_categories(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user