Tag Browser: Show the category key in the tooltip for all categories

This commit is contained in:
Kovid Goyal 2010-12-31 15:57:25 -07:00
commit 6ac59c747b
2 changed files with 14 additions and 6 deletions

View File

@ -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

View File

@ -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