comparison src/tools/xml_tools.py @ 2365:318f0434d830

core (xmlui): container now keep a list of children
author Goffi <goffi@goffi.org>
date Sun, 01 Oct 2017 12:21:23 +0200
parents 918e38622a48
children 59636c4db2d0
comparison
equal deleted inserted replaced
2364:918e38622a48 2365:318f0434d830
410 410
411 @param xmlui: XMLUI instance 411 @param xmlui: XMLUI instance
412 @parent: parent element 412 @parent: parent element
413 """ 413 """
414 assert self.type is not None 414 assert self.type is not None
415 self.children = []
415 if not hasattr(self, 'elem'): 416 if not hasattr(self, 'elem'):
416 self.elem = parent.xmlui.doc.createElement(self.type) 417 self.elem = parent.xmlui.doc.createElement(self.type)
417 self.xmlui = xmlui 418 self.xmlui = xmlui
418 if parent is not None: 419 if parent is not None:
419 parent.append(self) 420 parent.append(self)
425 @param child (Element): child element 426 @param child (Element): child element
426 @return: the added child Element 427 @return: the added child Element
427 """ 428 """
428 self.elem.appendChild(child.elem) 429 self.elem.appendChild(child.elem)
429 child.parent = self 430 child.parent = self
431 self.children.append(child)
430 return child 432 return child
431 433
432 434
433 class TopElement(Element): 435 class TopElement(Element):
434 """ Main XML Element """ 436 """ Main XML Element """