mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 07:20:44 -04:00
Enhancement #7931: add tweak to change display in tags pane from author to author_sort.
This commit is contained in:
parent
53219dc2b0
commit
545cdfd00d
@ -41,6 +41,20 @@ series_index_auto_increment = 'next'
|
|||||||
# selecting 'manage authors', and pressing 'Recalculate all author sort values'.
|
# selecting 'manage authors', and pressing 'Recalculate all author sort values'.
|
||||||
author_sort_copy_method = 'invert'
|
author_sort_copy_method = 'invert'
|
||||||
|
|
||||||
|
# Set which author field to display in the tags pane (the list of authors,
|
||||||
|
# series, publishers etc on the left hand side). The choices are author and
|
||||||
|
# author_sort. This tweak affects only the tags pane, and only what is displayed
|
||||||
|
# under the authors category. Please note that if you set this to author_sort,
|
||||||
|
# it is very possible to see duplicate names in the list becasue although it is
|
||||||
|
# guaranteed that author names are unique, there is no such guarantee for
|
||||||
|
# author_sort values. Showing duplicates won't break anything, but it could
|
||||||
|
# lead to some confusion. When using 'author_sort', the tooltip will show the
|
||||||
|
# author's name.
|
||||||
|
# Examples:
|
||||||
|
# tags_pane_use_field_for_author_name = 'author'
|
||||||
|
# tags_pane_use_field_for_author_name = 'author_sort'
|
||||||
|
tags_pane_use_field_for_author_name = 'author'
|
||||||
|
|
||||||
|
|
||||||
# Set whether boolean custom columns are two- or three-valued.
|
# Set whether boolean custom columns are two- or three-valued.
|
||||||
# Two-values for true booleans
|
# Two-values for true booleans
|
||||||
|
@ -18,6 +18,7 @@ from PyQt4.Qt import Qt, QTreeView, QApplication, pyqtSignal, \
|
|||||||
from calibre.ebooks.metadata import title_sort
|
from calibre.ebooks.metadata import title_sort
|
||||||
from calibre.gui2 import config, NONE
|
from calibre.gui2 import config, NONE
|
||||||
from calibre.library.field_metadata import TagsIcons, category_icon_map
|
from calibre.library.field_metadata import TagsIcons, category_icon_map
|
||||||
|
from calibre.utils.config import tweaks
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
from calibre.utils.search_query_parser import saved_searches
|
from calibre.utils.search_query_parser import saved_searches
|
||||||
from calibre.gui2 import error_dialog
|
from calibre.gui2 import error_dialog
|
||||||
@ -409,17 +410,31 @@ class TagTreeItem(object): # {{{
|
|||||||
return NONE
|
return NONE
|
||||||
|
|
||||||
def tag_data(self, role):
|
def tag_data(self, role):
|
||||||
if role == Qt.DisplayRole:
|
tag = self.tag
|
||||||
if self.tag.count == 0:
|
if tag.category == 'authors' and \
|
||||||
return QVariant('%s'%(self.tag.name))
|
tweaks['tags_pane_use_field_for_author_name'] == 'author_sort':
|
||||||
|
name = tag.sort
|
||||||
|
tt_author = True
|
||||||
else:
|
else:
|
||||||
return QVariant('[%d] %s'%(self.tag.count, self.tag.name))
|
name = tag.name
|
||||||
|
tt_author = False
|
||||||
|
if role == Qt.DisplayRole:
|
||||||
|
if tag.count == 0:
|
||||||
|
return QVariant('%s'%(name))
|
||||||
|
else:
|
||||||
|
return QVariant('[%d] %s'%(tag.count, name))
|
||||||
if role == Qt.EditRole:
|
if role == Qt.EditRole:
|
||||||
return QVariant(self.tag.name)
|
return QVariant(tag.name)
|
||||||
if role == Qt.DecorationRole:
|
if role == Qt.DecorationRole:
|
||||||
return self.icon_state_map[self.tag.state]
|
return self.icon_state_map[tag.state]
|
||||||
if role == Qt.ToolTipRole and self.tag.tooltip is not None:
|
if role == Qt.ToolTipRole:
|
||||||
return QVariant(self.tag.tooltip)
|
if tt_author:
|
||||||
|
if tag.tooltip is not None:
|
||||||
|
return QVariant('(%s) %s'%(tag.name, tag.tooltip))
|
||||||
|
else:
|
||||||
|
return QVariant(tag.name)
|
||||||
|
if tag.tooltip is not None:
|
||||||
|
return QVariant(tag.tooltip)
|
||||||
return NONE
|
return NONE
|
||||||
|
|
||||||
def toggle(self):
|
def toggle(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user