diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 6040649b50..63abde25dd 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -107,6 +107,7 @@ gprefs.defaults['auto_add_check_for_duplicates'] = False gprefs.defaults['blocked_auto_formats'] = [] gprefs.defaults['auto_add_auto_convert'] = True gprefs.defaults['ui_style'] = 'calibre' if iswindows or isosx else 'system' +gprefs.defaults['tag_browser_old_look'] = False # }}} NONE = QVariant() #: Null value to return from the data function of item models diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index 7fcdebe32f..84b75dd663 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -104,6 +104,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): r('ui_style', gprefs, restart_required=True, choices= [(_('System default'), 'system'), (_('Calibre style'), 'calibre')]) + r('tag_browser_old_look', gprefs, restart_required=True) r('cover_flow_queue_length', config, restart_required=True) diff --git a/src/calibre/gui2/preferences/look_feel.ui b/src/calibre/gui2/preferences/look_feel.ui index 6bcb964e2a..9621b20871 100644 --- a/src/calibre/gui2/preferences/look_feel.ui +++ b/src/calibre/gui2/preferences/look_feel.ui @@ -312,6 +312,18 @@ Manage Authors. You can use the values {author} and Tag Browser + + + + A comma-separated list of categories in which items containing +periods are displayed in the tag browser trees. For example, if +this box contains 'tags' then tags of the form 'Mystery.English' +and 'Mystery.Thriller' will be displayed with English and Thriller +both under 'Mystery'. If 'tags' is not in this box, +then the tags will be displayed each on their own line. + + + @@ -354,6 +366,19 @@ up into subcategories. If the partition method is set to disable, this value is + + + + Qt::Vertical + + + + 690 + 252 + + + + @@ -396,27 +421,9 @@ a few top-level elements. - - - Qt::Vertical - - - - 690 - 252 - - - - - - - - A comma-separated list of categories in which items containing -periods are displayed in the tag browser trees. For example, if -this box contains 'tags' then tags of the form 'Mystery.English' -and 'Mystery.Thriller' will be displayed with English and Thriller -both under 'Mystery'. If 'tags' is not in this box, -then the tags will be displayed each on their own line. + + + Use &alternating row colors in the Tag Browser diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 9331194328..d405294b01 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -22,6 +22,10 @@ from calibre.utils.icu import sort_key class TagDelegate(QStyledItemDelegate): # {{{ + def __init__(self, *args, **kwargs): + QStyledItemDelegate.__init__(self, *args, **kwargs) + self.old_look = gprefs['tag_browser_old_look'] + def paint(self, painter, option, index): item = index.data(Qt.UserRole).toPyObject() QStyledItemDelegate.paint(self, painter, option, index) @@ -46,7 +50,12 @@ class TagDelegate(QStyledItemDelegate): # {{{ nr = r.adjusted(0, 0, 0, 0) nr.setBottom(r.bottom()-int(r.height()*(rating/5.0))) painter.setClipRect(nr) - painter.fillRect(r, widget.palette().window()) + bg = option.palette.window() + if self.old_look: + bg = (option.palette.alternateBase() if + option.features&option.Alternate else + option.palette.base()) + painter.fillRect(r, bg) style.proxy().drawPrimitive(style.PE_PanelItemViewItem, option, painter, widget) painter.setOpacity(0.3) @@ -108,13 +117,14 @@ 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.setStyleSheet(''' + stylish_tb = ''' QTreeView { background-color: palette(window); color: palette(window-text); border: none; } - + ''' + self.setStyleSheet(''' QTreeView::item { border: 1px solid transparent; padding-top:0.9ex; @@ -126,7 +136,9 @@ 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) @property def hidden_categories(self):