Only put a node into intermediate_nodes if it is involved in a hierarchy

This commit is contained in:
Charles Haley 2015-11-23 16:20:53 +01:00
parent 4aa32c8e4d
commit b4efa96292

View File

@ -594,7 +594,6 @@ class TagsModel(QAbstractItemModel): # {{{
n = self.create_node(parent=node_parent, data=tag, tooltip=tt, n = self.create_node(parent=node_parent, data=tag, tooltip=tt,
icon_map=self.icon_state_map) icon_map=self.icon_state_map)
category_child_map[tag.name, tag.category] = n category_child_map[tag.name, tag.category] = n
intermediate_nodes[tag.original_name, tag.category] = tag
else: else:
for i,comp in enumerate(components): for i,comp in enumerate(components):
if i == 0: if i == 0:
@ -606,10 +605,11 @@ 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 = \ t = node_parent.tag
'5state' if tag.category != 'search' else '3state' t.is_hierarchical = '5state' if tag.category != 'search' else '3state'
if tag.id_set is not None and node_parent.tag.id_set is not None: if tag.id_set is not None and t.id_set is not None:
node_parent.tag.id_set |= tag.id_set t.id_set |= tag.id_set
intermediate_nodes[t.original_name, t.category] = t
else: else:
if i < len(components)-1: if i < len(components)-1:
original_name = '.'.join(components[:i+1]) original_name = '.'.join(components[:i+1])