From aa256bb189e28cd1fd6fcbcf7d4ff9a82436b55c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2013 23:27:58 +0530 Subject: [PATCH] port the new tb tooltip to the new backend --- src/calibre/db/categories.py | 6 +++--- src/calibre/library/database2.py | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/calibre/db/categories.py b/src/calibre/db/categories.py index b934aec0c1..900f245b36 100644 --- a/src/calibre/db/categories.py +++ b/src/calibre/db/categories.py @@ -35,6 +35,8 @@ class Tag(object): self.avg_rating = avg/2.0 if avg is not None else 0 self.sort = sort self.use_sort_as_name = use_sort_as_name + if tooltip is None: + tooltip = '(%s:%s)'%(category, name) if self.avg_rating > 0: if tooltip: tooltip = tooltip + ': ' @@ -65,7 +67,6 @@ def find_categories(field_metadata): def create_tag_class(category, fm, icon_map): cat = fm[category] icon = None - tooltip = None if category in {'formats', 'identifiers'} else ('(' + category + ')') label = fm.key_to_label(category) if icon_map: if not fm.is_custom_field(category): @@ -87,8 +88,7 @@ def create_tag_class(category, fm, icon_map): use_sort_as_name = False return partial(Tag, use_sort_as_name=use_sort_as_name, icon=icon, - tooltip=tooltip, is_editable=is_editable, - category=category) + is_editable=is_editable, category=category) def clean_user_categories(dbcache): user_cats = dbcache.pref('user_categories', {}) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 2c58658bef..a1202db44d 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1934,8 +1934,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): is_editable = category not in ['news', 'rating', 'languages'] categories[category] = [tag_class(formatter(r.n), count=r.c, id=r.id, avg=avgr(r), sort=r.s, icon=icon, - tooltip=u'({0}:{1})'.format(category, - formatter(r.n)), category=category, id_set=r.id_set, is_editable=is_editable, use_sort_as_name=use_sort_as_name)