removing empty structural expressions from tree view

This commit is contained in:
Michael Hunhoff
2020-06-26 14:38:14 -06:00
parent 68736a07f6
commit 009368f278

View File

@@ -324,14 +324,9 @@ class CapaExplorerDataModel(QtCore.QAbstractItemModel):
parent2 = CapaExplorerDefaultItem(parent, '%d or more' % result.statement.count)
elif not isinstance(result.statement, (capa.features.Feature, capa.engine.Range, capa.engine.Regex)):
# when rending a structural node (and/or/not) then we only care about the node name.
'''
succs = list(filter(lambda c: bool(c), result.children))
if len(succs) == 1:
# skip structural node with single succeeding child
parent2 = parent
else:
parent2 = CapaExplorerDefaultItem(parent, result.statement.name.lower())
'''
if not len(list(filter(lambda c: bool(c), result.children))):
# ignore empty structural expressions (e.g. not)
return
parent2 = CapaExplorerDefaultItem(parent, result.statement.name.lower())
else:
# but when rendering a Feature, want to see any arguments to it