mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix display of names in partition mode
This commit is contained in:
parent
81900219a2
commit
fb76838874
@ -77,9 +77,9 @@ categories_use_field_for_author_name = 'author'
|
|||||||
# sort: the sort value. For authors, this is the author_sort for that author
|
# sort: the sort value. For authors, this is the author_sort for that author
|
||||||
# category: the category (e.g., authors, series) that the item is in.
|
# category: the category (e.g., authors, series) that the item is in.
|
||||||
categories_collapse_more_than = 50
|
categories_collapse_more_than = 50
|
||||||
categories_collapsed_name_template = '{first.name:shorten(4,'',0)}{last.name::shorten(4,'',0)| - |}'
|
categories_collapsed_name_template = '{first.name:shorten(4,'',0)} - {last.name::shorten(4,'',0)}'
|
||||||
categories_collapsed_rating_template = '{first.avg_rating:4.2f}{last.avg_rating:4.2f| - |}'
|
categories_collapsed_rating_template = '{first.avg_rating:4.2f:ifempty(0)} - {last.avg_rating:4.2f:ifempty(0)}'
|
||||||
categories_collapsed_popularity_template = '{first.count:d}{last.count:d| - |}'
|
categories_collapsed_popularity_template = '{first.count:d} - {last.count:d}'
|
||||||
categories_collapse_model = 'first letter'
|
categories_collapse_model = 'first letter'
|
||||||
|
|
||||||
# Set whether boolean custom columns are two- or three-valued.
|
# Set whether boolean custom columns are two- or three-valued.
|
||||||
|
@ -674,7 +674,6 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
if data is None:
|
if data is None:
|
||||||
return False
|
return False
|
||||||
row_index = -1
|
row_index = -1
|
||||||
empty_tag = Tag('')
|
|
||||||
collapse = tweaks['categories_collapse_more_than']
|
collapse = tweaks['categories_collapse_more_than']
|
||||||
collapse_model = tweaks['categories_collapse_model']
|
collapse_model = tweaks['categories_collapse_model']
|
||||||
if sort_by == 'name':
|
if sort_by == 'name':
|
||||||
@ -726,7 +725,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
if cat_len > idx + collapse:
|
if cat_len > idx + collapse:
|
||||||
d['last'] = data[r][idx+collapse-1]
|
d['last'] = data[r][idx+collapse-1]
|
||||||
else:
|
else:
|
||||||
d['last'] = empty_tag
|
d['last'] = data[r][cat_len-1]
|
||||||
name = eval_formatter.safe_format(collapse_template,
|
name = eval_formatter.safe_format(collapse_template,
|
||||||
d, 'TAG_VIEW', None)
|
d, 'TAG_VIEW', None)
|
||||||
sub_cat = TagTreeItem(parent=category,
|
sub_cat = TagTreeItem(parent=category,
|
||||||
|
@ -371,6 +371,12 @@ class TemplateFormatter(string.Formatter):
|
|||||||
raise Exception('get_value must be implemented in the subclass')
|
raise Exception('get_value must be implemented in the subclass')
|
||||||
|
|
||||||
def format_field(self, val, fmt):
|
def format_field(self, val, fmt):
|
||||||
|
# ensure we are dealing with a string.
|
||||||
|
if isinstance(val, (int, float)):
|
||||||
|
if val:
|
||||||
|
val = unicode(val)
|
||||||
|
else:
|
||||||
|
val = ''
|
||||||
# Handle conditional text
|
# Handle conditional text
|
||||||
fmt, prefix, suffix = self._explode_format_string(fmt)
|
fmt, prefix, suffix = self._explode_format_string(fmt)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user