Make search hierarchies show simple names instead of compound ones.

This commit is contained in:
Charles Haley 2011-03-19 15:29:05 +00:00
parent 4b1f86ebf6
commit e7958afbd9
2 changed files with 9 additions and 6 deletions

View File

@ -707,8 +707,8 @@ class TagTreeItem(object): # {{{
break break
elif self.tag.state == TAG_SEARCH_STATES['mark_plusplus'] or\ elif self.tag.state == TAG_SEARCH_STATES['mark_plusplus'] or\
self.tag.state == TAG_SEARCH_STATES['mark_minusminus']: self.tag.state == TAG_SEARCH_STATES['mark_minusminus']:
if self.tag.is_searchable and self.tag.is_hierarchical \ if self.tag.is_searchable and len(self.children) and \
and len(self.children): self.tag.is_hierarchical == '5state':
break break
else: else:
break break
@ -803,7 +803,8 @@ class TagsModel(QAbstractItemModel): # {{{
self.category_nodes.append(node) self.category_nodes.append(node)
node.can_be_edited = (not is_gst) and (i == (len(path_parts)-1)) node.can_be_edited = (not is_gst) and (i == (len(path_parts)-1))
node.is_gst = is_gst node.is_gst = is_gst
node.tag.is_hierarchical = not is_gst if not is_gst:
node.tag.is_hierarchical = '5state'
if not is_gst: if not is_gst:
tree_root[p] = {} tree_root[p] = {}
tree_root = tree_root[p] tree_root = tree_root[p]
@ -1294,7 +1295,8 @@ class TagsModel(QAbstractItemModel): # {{{
if t.type != TagTreeItem.CATEGORY]) if t.type != TagTreeItem.CATEGORY])
if (comp,tag.category) in child_map: if (comp,tag.category) in child_map:
node_parent = child_map[(comp,tag.category)] node_parent = child_map[(comp,tag.category)]
node_parent.tag.is_hierarchical = key != 'search' node_parent.tag.is_hierarchical = \
'5state' if tag.category != 'search' else '3state'
else: else:
if i < len(components)-1: if i < len(components)-1:
t = copy.copy(tag) t = copy.copy(tag)
@ -1309,7 +1311,8 @@ class TagsModel(QAbstractItemModel): # {{{
t = tag t = tag
if not in_uc: if not in_uc:
t.original_name = t.name t.original_name = t.name
t.is_hierarchical = key != 'search' t.is_hierarchical = \
'5state' if t.category != 'search' else '3state'
t.name = comp t.name = comp
self.beginInsertRows(category_index, 999999, 1) self.beginInsertRows(category_index, 999999, 1)
node_parent = TagTreeItem(parent=node_parent, data=t, node_parent = TagTreeItem(parent=node_parent, data=t,

View File

@ -53,7 +53,7 @@ class Tag(object):
self.id = id self.id = id
self.count = count self.count = count
self.state = state self.state = state
self.is_hierarchical = False self.is_hierarchical = ''
self.is_editable = is_editable self.is_editable = is_editable
self.is_searchable = is_searchable self.is_searchable = is_searchable
self.id_set = id_set if id_set is not None else set([]) self.id_set = id_set if id_set is not None else set([])