Remove the many libraries preference, instead automatically sort the menus alphabetically if there are more than 10 entries

This commit is contained in:
Kovid Goyal 2013-02-27 17:40:22 +05:30
parent 579142ee45
commit b2850f9ed5
4 changed files with 4 additions and 19 deletions

View File

@ -110,7 +110,6 @@ defs['bd_overlay_cover_size'] = False
defs['tags_browser_category_icons'] = {}
defs['cover_browser_reflections'] = True
defs['extra_row_spacing'] = 0
defs['many_libraries'] = False
del defs
# }}}

View File

@ -47,7 +47,7 @@ class LibraryUsageStats(object): # {{{
locs = list(self.stats.keys())
locs.sort(cmp=lambda x, y: cmp(self.stats[x], self.stats[y]),
reverse=True)
for key in locs[(10000 if gprefs['many_libraries'] else 25):]:
for key in locs[500:]:
self.stats.pop(key)
gprefs.set('library_usage_stats', self.stats)
@ -73,10 +73,9 @@ class LibraryUsageStats(object): # {{{
locs = list(self.stats.keys())
if lpath in locs:
locs.remove(lpath)
if gprefs['many_libraries']:
locs.sort(key=sort_key)
else:
locs.sort(key=lambda x: self.stats[x], reverse=True)
limit = 10
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:
yield self.pretty(loc), loc

View File

@ -60,7 +60,6 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
signal.connect(self.internally_viewed_formats_changed)
r('bools_are_tristate', db.prefs, restart_required=True)
r('many_libraries', gprefs, restart_required=True)
r = self.register
choices = [(_('Default'), 'default'), (_('Compact Metadata'), 'alt1'),
(_('All on 1 tab'), 'alt2')]

View File

@ -284,18 +284,6 @@ If not checked, the values can be Yes or No.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="opt_many_libraries">
<property name="toolTip">
<string>Optimizes the interface for use with a large number of libraries. calibre will
now remeber unlimited numbers of libraries in its Quick Switch and Copy to Library
menus, and the libraries will be sorted alphabetically.</string>
</property>
<property name="text">
<string>Optimize for use with many &amp;libraries (Requires restart)</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources>