From 8b7b831d8081ef06692d46e1349557079584d36f Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Wed, 23 Feb 2011 22:05:04 +0000 Subject: [PATCH 1/2] Fix regression in user category search. --- src/calibre/library/caches.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index 318183eb10..4f5a034222 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -426,6 +426,8 @@ class ResultCache(SearchQueryParser): # {{{ if l > 0: alt_loc = location[0:l] alt_item = location[l+1:] + else: + alt_loc = None for key in user_cats: if key == location or key.startswith(location + '.'): for (item, category, ign) in user_cats[key]: From b223290b14bd3065b1b8690d7adad702e28dba7e Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Wed, 23 Feb 2011 22:14:09 +0000 Subject: [PATCH 2/2] Make manage categories focus on the category when sub-categories are right-clicked. --- src/calibre/gui2/tag_view.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tag_view.py b/src/calibre/gui2/tag_view.py index fb2cbf81f7..d5b62f8efc 100644 --- a/src/calibre/gui2/tag_view.py +++ b/src/calibre/gui2/tag_view.py @@ -356,10 +356,11 @@ class TagsView(QTreeView): # {{{ # Always show the user categories editor self.context_menu.addSeparator() - if category in self.db.prefs.get('user_categories', {}).keys(): + if key.startswith('@') and \ + key[1:] in self.db.prefs.get('user_categories', {}).keys(): self.context_menu.addAction(_('Manage User Categories'), partial(self.context_menu_handler, action='manage_categories', - category=category)) + category=key[1:])) else: self.context_menu.addAction(_('Manage User Categories'), partial(self.context_menu_handler, action='manage_categories',