Skip to content

Commit

Permalink
Merge pull request #983 from slaclab/node_count
Browse files Browse the repository at this point in the history
Fix nodeList method in Node and add global node count tracking
  • Loading branch information
bengineerd authored Jan 11, 2024
2 parents 36f9ab1 + e88b7e4 commit 2b5e1b8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/pyrogue/_Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class Node(object):
-------
"""
_nodeCount = 0

def __init__(self, *, name, description="", expand=True, hidden=False, groups=None, guiGroup=None):
"""
Expand Down Expand Up @@ -183,6 +184,7 @@ def __init__(self, *, name, description="", expand=True, hidden=False, groups=No
-------
"""
pr.Node._nodeCount += 1

# Public attributes
self._name = name
Expand Down Expand Up @@ -213,6 +215,10 @@ def __init__(self, *, name, description="", expand=True, hidden=False, groups=No
def __repr__(self):
return f'{self.__class__} - {self.path}'

@property
def nodeCount(self):
return pr.Node._nodeCount

@property
def name(self):
"""
Expand Down Expand Up @@ -559,7 +565,7 @@ def addNodes(self, nodeClass, number, stride, **kwargs):
def nodeList(self):
"""Get a recursive list of nodes."""
lst = []
for key,value in self.nodes.items():
for key,value in self._nodes.items():
lst.append(value)
lst.extend(value.nodeList)
return lst
Expand Down

0 comments on commit 2b5e1b8

Please sign in to comment.