mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Remove the many libraries preference, instead automatically sort the menus alphabetically if there are more than 10 entries
This commit is contained in:
parent
579142ee45
commit
b2850f9ed5
@ -110,7 +110,6 @@ defs['bd_overlay_cover_size'] = False
|
|||||||
defs['tags_browser_category_icons'] = {}
|
defs['tags_browser_category_icons'] = {}
|
||||||
defs['cover_browser_reflections'] = True
|
defs['cover_browser_reflections'] = True
|
||||||
defs['extra_row_spacing'] = 0
|
defs['extra_row_spacing'] = 0
|
||||||
defs['many_libraries'] = False
|
|
||||||
del defs
|
del defs
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class LibraryUsageStats(object): # {{{
|
|||||||
locs = list(self.stats.keys())
|
locs = list(self.stats.keys())
|
||||||
locs.sort(cmp=lambda x, y: cmp(self.stats[x], self.stats[y]),
|
locs.sort(cmp=lambda x, y: cmp(self.stats[x], self.stats[y]),
|
||||||
reverse=True)
|
reverse=True)
|
||||||
for key in locs[(10000 if gprefs['many_libraries'] else 25):]:
|
for key in locs[500:]:
|
||||||
self.stats.pop(key)
|
self.stats.pop(key)
|
||||||
gprefs.set('library_usage_stats', self.stats)
|
gprefs.set('library_usage_stats', self.stats)
|
||||||
|
|
||||||
@ -73,10 +73,9 @@ class LibraryUsageStats(object): # {{{
|
|||||||
locs = list(self.stats.keys())
|
locs = list(self.stats.keys())
|
||||||
if lpath in locs:
|
if lpath in locs:
|
||||||
locs.remove(lpath)
|
locs.remove(lpath)
|
||||||
if gprefs['many_libraries']:
|
limit = 10
|
||||||
locs.sort(key=sort_key)
|
key = sort_key if len(locs) > limit else lambda x:self.stats[x]
|
||||||
else:
|
locs.sort(key=key, reverse=len(locs)<=limit)
|
||||||
locs.sort(key=lambda x: self.stats[x], reverse=True)
|
|
||||||
for loc in locs:
|
for loc in locs:
|
||||||
yield self.pretty(loc), loc
|
yield self.pretty(loc), loc
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
signal.connect(self.internally_viewed_formats_changed)
|
signal.connect(self.internally_viewed_formats_changed)
|
||||||
|
|
||||||
r('bools_are_tristate', db.prefs, restart_required=True)
|
r('bools_are_tristate', db.prefs, restart_required=True)
|
||||||
r('many_libraries', gprefs, restart_required=True)
|
|
||||||
r = self.register
|
r = self.register
|
||||||
choices = [(_('Default'), 'default'), (_('Compact Metadata'), 'alt1'),
|
choices = [(_('Default'), 'default'), (_('Compact Metadata'), 'alt1'),
|
||||||
(_('All on 1 tab'), 'alt2')]
|
(_('All on 1 tab'), 'alt2')]
|
||||||
|
@ -284,18 +284,6 @@ If not checked, the values can be Yes or No.</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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 &libraries (Requires restart)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user