From f6f49c6a9c8b7215c07d06e6e2b7dbc4b493d6da Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Fri, 31 Dec 2010 22:40:19 +0000 Subject: [PATCH] Show the category key in the tooltip for all categories --- src/calibre/gui2/tag_view.py | 19 ++++++++++++++----- src/calibre/library/database2.py | 1 - 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/calibre/gui2/tag_view.py b/src/calibre/gui2/tag_view.py index bdaa9bba9b..ab9ffbd313 100644 --- a/src/calibre/gui2/tag_view.py +++ b/src/calibre/gui2/tag_view.py @@ -374,7 +374,13 @@ class TagTreeItem(object): # {{{ elif self.type == self.TAG: icon_map[0] = data.icon self.tag, self.icon_state_map = data, list(map(QVariant, icon_map)) - self.tooltip = tooltip + if tooltip: + if tooltip.endswith(':'): + self.tooltip = tooltip + ' ' + else: + self.tooltip = tooltip + ': ' + else: + self.tooltip = '' def __str__(self): if self.type == self.ROOT: @@ -436,8 +442,10 @@ class TagTreeItem(object): # {{{ return QVariant('(%s) %s'%(tag.name, tag.tooltip)) else: return QVariant(tag.name) - if tag.tooltip is not None: - return QVariant(tag.tooltip) + if tag.tooltip: + return QVariant(self.tooltip + tag.tooltip) + else: + return QVariant(self.tooltip) return NONE def toggle(self): @@ -736,10 +744,11 @@ class TagsModel(QAbstractItemModel): # {{{ category_icon = category_node.icon, tooltip = None, category_key=category_node.category_key) - t = TagTreeItem(parent=sub_cat, data=tag, + t = TagTreeItem(parent=sub_cat, data=tag, tooltip=r, icon_map=self.icon_state_map) else: - t = TagTreeItem(parent=category, data=tag, icon_map=self.icon_state_map) + t = TagTreeItem(parent=category, data=tag, tooltip=r, + icon_map=self.icon_state_map) self.endInsertRows() return True diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 0a0d322ab5..cbda615677 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1243,7 +1243,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): else: icon = icon_map[':custom'] icon_map[category] = icon - tooltip = self.custom_column_label_map[label]['name'] datatype = cat['datatype'] avgr = lambda x: 0.0 if x.rc == 0 else x.rt/x.rc