def newFromSvg(cls, e): parsedAttribs = svgparsing.ParseSvgAttribs(e) kwargs = {} pti = cls(**kwargs) if 'fill' in parsedAttribs: pti.setColor(QtGui.QColor(*parsedAttribs['fill'])) if 'transform' in parsedAttribs: pti.setTransform(parsedAttribs['transform']) return pti
def newFromSvg(cls, e): d = svgparsing.ParseSvgAttribs(e) if all(a in d for a in 'cx cy rx ry'.split()): rect = QtCore.QRectF(d['cx']-d['rx'], d['cy']-d['ry'], d['rx']*2, d['ry']*2) else: rect = None eti = cls(rect=rect) if 'fill' in d: eti.setColor(QtGui.QColor(*d['fill'])) if 'transform' in d: eti.setTransform(d['transform']) return eti
def newFromSvg(cls, e): d = svgparsing.ParseSvgAttribs(e) if 'points' in d: poly = QtGui.QPolygonF(d['points']) elif 'd' in d: poly = svgparsing.SvgPathCmdsToPolygons(d['d'])[0] else: poly = None pti = cls(polygon=poly) if 'fill' in d: pti.setColor(QtGui.QColor(*d['fill'])) if 'transform' in d: pti.setTransform(d['transform']) return pti
def newFromSvg(cls, e): parsedAttribs = svgparsing.ParseSvgAttribs(e) kwargs = {} for k in 'tiles:size'.split(): if k in parsedAttribs: kwargs[k.split(':')[1]] = parsedAttribs[k] if 'tiles:shapeno' in parsedAttribs: kwargs['shape'] = parsedAttribs['tiles:shapeno'] if 'points' in parsedAttribs: kwargs['polygon'] = QtGui.QPolygonF(parsedAttribs['points']) pti = cls(**kwargs) if 'fill' in parsedAttribs: pti.setColor(QtGui.QColor(*parsedAttribs['fill'])) if 'transform' in parsedAttribs: pti.setTransform(parsedAttribs['transform']) return pti