def scanLayers(self, dom_layer, matrix): """ there can be layers in svg... and each layer can have its own transformation """ curLayer = Layer(dom_layer.attrib, matrix) dom_paths = self.getChildren(dom_layer, 'path', 'svg') for dom_path in dom_paths: curLayer.addPath(dom_path.attrib) dom_rects = self.getChildren(dom_layer, 'rect', 'svg') for dom_rect in dom_rects: curLayer.addRect(dom_rect.attrib) dom_layerChildren = self.getChildren(dom_layer, 'g', 'svg') for dom_layerChild in dom_layerChildren: if dom_layerChild.get(addNS('xmoto_label', 'xmoto')) is None: curLayer.addChild( self.scanLayers(dom_layerChild, curLayer.matrix)) else: dom_layerChild = convertToXmNode(dom_layerChild) if dom_layerChild.isSubLayer(type=XmNode.BLOCK) == True: # add one of the two children #curLayer.add(list(dom_layerChild)[0]) pass else: # add the circle try: circle = dom_layerChild.getCircleChild() except Exception, e: logging.warning( "The node %s.%s is a sublayer but \ is neither a colored block nor a bitmap." % (dom_layerChild.tag, dom_layerChild.get('id', ''))) continue # copy the transform attr from the sublayer to the circle transform = dom_layerChild.get('transform', default='') if transform != '': circle.set('transform', transform) curLayer.add(circle)