diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index a7f14d66d4..b022fdac64 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -37,7 +37,6 @@ series_index_auto_increment = 'next' # Can be either True or False authors_completer_append_separator = False - #: Author sort name algorithm # The algorithm used to copy author to author_sort # Possible values are: @@ -71,6 +70,15 @@ author_name_suffixes = ('Jr', 'Sr', 'Inc', 'Ph.D', 'Phd', # categories_use_field_for_author_name = 'author_sort' categories_use_field_for_author_name = 'author' +#: Completion sort order: choose when to change from lexicographic to ASCII-like +# Calibre normally uses locale-dependent lexicographic ordering when showing +# completion values. This means that the sort order is correct for the user's +# language. However, this can be slow. Performance is improved by switching to +# ascii ordering. This tweak controls when that switch happens. Set it to zero +# to always use ascii ordering. Set it to something larger than zero to switch +# to ascii ordering for performance reasons. +completion_change_to_ascii_sorting = 2500 + #: Control partitioning of Tag Browser # When partitioning the tags browser, the format of the subcategory label is # controlled by a template: categories_collapsed_name_template if sorting by @@ -93,7 +101,6 @@ categories_collapsed_name_template = r'{first.sort:shorten(4,,0)} - {last.sort:s categories_collapsed_rating_template = r'{first.avg_rating:4.2f:ifempty(0)} - {last.avg_rating:4.2f:ifempty(0)}' categories_collapsed_popularity_template = r'{first.count:d} - {last.count:d}' - #: Specify columns to sort the booklist by on startup # Provide a set of columns to be sorted on when calibre starts # The argument is None if saved sort history is to be used @@ -244,17 +251,14 @@ sony_collection_name_template='{value}{category:| (|)}' # Default: empty (no rules), so no collection attributes are named. sony_collection_sorting_rules = [] - #: Control how tags are applied when copying books to another library # Set this to True to ensure that tags in 'Tags to add when adding # a book' are added when copying books to another library add_new_book_tags_when_importing_books = False - #: Set the maximum number of tags to show per book in the content server max_content_server_tags_shown=5 - #: Set custom metadata fields that the content server will or will not display. # content_server_will_display is a list of custom fields to be displayed. # content_server_wont_display is a list of custom fields not to be displayed. @@ -296,7 +300,6 @@ generate_cover_foot_font = None # Example: doubleclick_on_library_view = 'do_nothing' doubleclick_on_library_view = 'open_viewer' - #: Language to use when sorting. # Setting this tweak will force sorting to use the # collating order for the specified language. This might be useful if you run diff --git a/src/calibre/gui2/complete.py b/src/calibre/gui2/complete.py index 60700c65cc..bb9e0cb4c9 100644 --- a/src/calibre/gui2/complete.py +++ b/src/calibre/gui2/complete.py @@ -12,11 +12,10 @@ from PyQt4.Qt import QLineEdit, QAbstractListModel, Qt, \ from calibre.utils.icu import sort_key, lower from calibre.gui2 import NONE from calibre.gui2.widgets import EnComboBox, LineEditECM +from calibre.utils.config_base import tweaks class CompleteModel(QAbstractListModel): - MAX_LEX_SORT_ITEMS = 5000 - def __init__(self, parent=None): QAbstractListModel.__init__(self, parent) self.items = [] @@ -24,7 +23,7 @@ class CompleteModel(QAbstractListModel): def set_items(self, items): items = [unicode(x.strip()) for x in items] - if len(items) < self.MAX_LEX_SORT_ITEMS: + if len(items) < tweaks['completion_change_to_ascii_sorting']: self.items = sorted(items, key=lambda x: sort_key(x)) self.sorting = QCompleter.UnsortedModel else: