diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index 9f6297ac79..ff1a53de96 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -524,3 +524,10 @@ preselect_first_completion = False # that starts with numbers and is a little slower. numeric_collation = False +#: Sort the list of libraries alphabetically +# The list of libraries in the Copy to Library and Quick Switch menus are +# normally sorted by most used. However, if there are more than a certain +# number of such libraries, the sorting becomes alphabetic. You can set that +# number here. The default is ten libraries. +many_libraries = 10 + diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index e291c71d96..d38c16ddf3 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -15,7 +15,7 @@ from PyQt4.Qt import (QMenu, Qt, QInputDialog, QToolButton, QDialog, from calibre import isbytestring, sanitize_file_name_unicode from calibre.constants import (filesystem_encoding, iswindows, get_portable_base) -from calibre.utils.config import prefs +from calibre.utils.config import prefs, tweaks from calibre.utils.icu import sort_key from calibre.gui2 import (gprefs, warning_dialog, Dispatcher, error_dialog, question_dialog, info_dialog, open_local_file, choose_dir) @@ -73,7 +73,7 @@ class LibraryUsageStats(object): # {{{ locs = list(self.stats.keys()) if lpath in locs: locs.remove(lpath) - limit = 10 + limit = tweaks['many_libraries'] key = sort_key if len(locs) > limit else lambda x:self.stats[x] locs.sort(key=key, reverse=len(locs)<=limit) for loc in locs: