Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setupModelData(self, features, parent_item):
for feature in features:
interface_type = feature.node.principal_interface_type
item = TreeItem([feature, feature], parent_item)
parent_item.appendChild(item)
if interface_type == EInterfaceType.intfICategory:
self.setupModelData(feature.features, item)
def __init__(self, parent=None, node_map: NodeMap=None, thread=None):
"""
REMARKS: QAbstractItemModel might impact the performance and could
slow Harvester. As far as we've confirmed, QAbstractItemModel calls
its index() method for every item already shown. Especially, such
a call happens every time when (1) its view got/lost focus or (2)
its view was scrolled. If such slow performance makes people
irritating we should investigate how can we optimize it.
"""
#
super().__init__()
#
self._root_item = TreeItem(('Feature Name', 'Value'))
self._node_map = node_map
if node_map:
self.setupModelData(node_map.Root.features, self._root_item)