#2 Iterate over the device tree

Declined
nobody
None
2020-02-08
2020-02-07
Ingo
No
def printtree_rec(treeobj, depth=0):
   name = treeobj.get_name(False)    
   if treeobj.is_device:
      deviceid = treeobj.get_device_identification()
      print("{0} - {1} {2}".format("--"*depth, name, deviceid))
   for child in treeobj.get_children(False):
      printtree_rec(child, depth+1)

def printTree(proj):
   for obj in proj.get_children():
      printtree_rec(obj)

Discussion

  • Ingo

    Ingo - 2020-02-08
    • private: No --> Yes
     
  • Ingo

    Ingo - 2020-02-08
    • status: Unassessed --> Declined
    • private: Yes --> No
     

Log in to post a comment.