mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make series sorting on library and tag views honor the the title_series_sorting flag (and rename the flag
This commit is contained in:
parent
30c209fd7e
commit
cbe0b78aef
@ -61,13 +61,13 @@ sort_columns_at_startup = None
|
|||||||
# default if not set: MMM yyyy
|
# default if not set: MMM yyyy
|
||||||
gui_pubdate_display_format = 'MMM yyyy'
|
gui_pubdate_display_format = 'MMM yyyy'
|
||||||
|
|
||||||
# Control title sorting.
|
# Control title and series sorting in the library view.
|
||||||
# If set to 'library_order', Leading articles such as The and A will be ignored.
|
# If set to 'library_order', Leading articles such as The and A will be ignored.
|
||||||
# If set to 'strictly_alphabetic', the titles will be sorted without processing
|
# If set to 'strictly_alphabetic', the titles will be sorted without processing
|
||||||
# For example, with library_order, The Client will sort under 'C'. With
|
# For example, with library_order, The Client will sort under 'C'. With
|
||||||
# strictly_alphabetic, the book will sort under 'T'.
|
# strictly_alphabetic, the book will sort under 'T'.
|
||||||
# This flag affects Calibre's library display. It has no effect on devices. In
|
# This flag affects Calibre's library display. It has no effect on devices. In
|
||||||
# addition, books added before changing the flag will retain their order until
|
# addition, titles for books added before changing the flag will retain their
|
||||||
# the title is edited. Double-clicking on a title and hitting return without
|
# order until the title is edited. Double-clicking on a title and hitting return
|
||||||
# changing anything is sufficient to change the sort.
|
# without changing anything is sufficient to change the sort.
|
||||||
title_sorting = 'library_order'
|
title_series_sorting = 'library_order'
|
||||||
|
@ -619,9 +619,12 @@ class ResultCache(SearchQueryParser):
|
|||||||
if self.first_sort:
|
if self.first_sort:
|
||||||
subsort = True
|
subsort = True
|
||||||
self.first_sort = False
|
self.first_sort = False
|
||||||
fcmp = self.seriescmp if field == 'series' else \
|
fcmp = self.seriescmp \
|
||||||
functools.partial(self.cmp, self.FIELD_MAP[field], subsort=subsort,
|
if field == 'series' and \
|
||||||
asstr=as_string)
|
tweaks['title_sorting'] == 'library_order' \
|
||||||
|
else \
|
||||||
|
functools.partial(self.cmp, self.FIELD_MAP[field],
|
||||||
|
subsort=subsort, asstr=as_string)
|
||||||
self._map.sort(cmp=fcmp, reverse=not ascending)
|
self._map.sort(cmp=fcmp, reverse=not ascending)
|
||||||
self._map_filtered = [id for id in self._map if id in self._map_filtered]
|
self._map_filtered = [id for id in self._map if id in self._map_filtered]
|
||||||
|
|
||||||
|
@ -736,7 +736,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
icon=icon, tooltip = tooltip)
|
icon=icon, tooltip = tooltip)
|
||||||
for r in data if item_not_zero_func(r)]
|
for r in data if item_not_zero_func(r)]
|
||||||
if category == 'series' and not sort_on_count:
|
if category == 'series' and not sort_on_count:
|
||||||
if tweaks['title_sorting'] == 'library_order':
|
if tweaks['title_series_sorting'] == 'library_order':
|
||||||
ts = lambda x: title_sort(x)
|
ts = lambda x: title_sort(x)
|
||||||
else:
|
else:
|
||||||
ts = lambda x:x
|
ts = lambda x:x
|
||||||
@ -954,7 +954,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
title = title.decode(preferred_encoding, 'replace')
|
title = title.decode(preferred_encoding, 'replace')
|
||||||
self.conn.execute('UPDATE books SET title=? WHERE id=?', (title, id))
|
self.conn.execute('UPDATE books SET title=? WHERE id=?', (title, id))
|
||||||
self.data.set(id, self.FIELD_MAP['title'], title, row_is_id=True)
|
self.data.set(id, self.FIELD_MAP['title'], title, row_is_id=True)
|
||||||
if tweaks['title_sorting'] == 'library_order':
|
if tweaks['title_series_sorting'] == 'library_order':
|
||||||
self.data.set(id, self.FIELD_MAP['sort'], title_sort(title), row_is_id=True)
|
self.data.set(id, self.FIELD_MAP['sort'], title_sort(title), row_is_id=True)
|
||||||
else:
|
else:
|
||||||
self.data.set(id, self.FIELD_MAP['sort'], title, row_is_id=True)
|
self.data.set(id, self.FIELD_MAP['sort'], title, row_is_id=True)
|
||||||
|
@ -116,7 +116,7 @@ class DBThread(Thread):
|
|||||||
self.conn.create_aggregate('concat', 1, Concatenate)
|
self.conn.create_aggregate('concat', 1, Concatenate)
|
||||||
self.conn.create_aggregate('sortconcat', 2, SortedConcatenate)
|
self.conn.create_aggregate('sortconcat', 2, SortedConcatenate)
|
||||||
self.conn.create_aggregate('sort_concat', 2, SafeSortedConcatenate)
|
self.conn.create_aggregate('sort_concat', 2, SafeSortedConcatenate)
|
||||||
if tweaks['title_sorting'] == 'library_order':
|
if tweaks['title_series_sorting'] == 'library_order':
|
||||||
self.conn.create_function('title_sort', 1, title_sort)
|
self.conn.create_function('title_sort', 1, title_sort)
|
||||||
else:
|
else:
|
||||||
self.conn.create_function('title_sort', 1, lambda x:x)
|
self.conn.create_function('title_sort', 1, lambda x:x)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user