svghmi/hmi_tree.py
branchsvghmi
changeset 3224 507dd7bc8cb5
parent 3223 061796d9855e
child 3381 3a0908b0319d
equal deleted inserted replaced
3223:061796d9855e 3224:507dd7bc8cb5
   123         path = attributes["path"].split('.') if "path" in attributes else None 
   123         path = attributes["path"].split('.') if "path" in attributes else None 
   124         hmiclass = attributes.get("class", None)
   124         hmiclass = attributes.get("class", None)
   125         # hash is computed on demand
   125         # hash is computed on demand
   126         node = cls(path, name, nodetype, hmiclass=hmiclass)
   126         node = cls(path, name, nodetype, hmiclass=hmiclass)
   127         for child in enode.iterchildren():
   127         for child in enode.iterchildren():
   128             node.children.append(cls.from_etree(child))
   128             newnode = cls.from_etree(child)
       
   129             newnode.parent = weakref.ref(node)
       
   130             node.children.append(newnode)
   129         return node
   131         return node
   130 
   132 
   131     def traverse(self):
   133     def traverse(self):
   132         yield self
   134         yield self
   133         if hasattr(self, "children"):
   135         if hasattr(self, "children"):