Exemple #1
0
 def _parse_board(self, node, attributes):
     container_attributes = node_attributes(node)
     container = Container.constructor(
         int(container_attributes.get('col', 4)),
         container_attributes.get('homogeneous', False))
     self.view.widget = container.container
     self.parse_child(node, container)
     assert not self._containers
Exemple #2
0
    def parse(self, node, container=None):
        if not container:
            node_attrs = node_attributes(node)
            container = Container(int(node_attrs.get('col', 4)))
        for node in node.childNodes:
            if node.nodeType != node.ELEMENT_NODE:
                continue
            node_attrs = node_attributes(node)
            for i_field in ('yexpand', 'yfill', 'xexpand', 'xfill', 'colspan',
                    'position'):
                if i_field in node_attrs:
                    node_attrs[i_field] = int(node_attrs[i_field])

            parser = getattr(self, '_parse_%s' % node.tagName)
            parser(node, container, node_attrs)
        return container