index af660d9d9bf12d0817cc224779a238955aabf0a7..7e1ea58686e29118710947f3e7dd39a78c2cdee5 100755 (executable)
#obj is selected second
obj = self.selected[self.options.ids[0]]
trafo = self.selected[self.options.ids[1]]
- if obj.tagName == 'path' and trafo.tagName == 'path':
+ if obj.tag == inkex.addNS('path','svg') and trafo.tag == inkex.addNS('path','svg'):
#distil trafo into four node points
- trafo = cubicsuperpath.parsePath(trafo.attributes.getNamedItem('d').value)
+ trafo = cubicsuperpath.parsePath(trafo.get('d'))
trafo = [[Point(csp[1][0],csp[1][1]) for csp in subs] for subs in trafo][0][:4]
#vectors pointing away from the trafo origin
file = self.args[-1]
id = self.options.ids[0]
for query in self.q.keys():
- f = os.popen("inkscape --query-%s --query-id=%s %s" % (query,id,file))
+ _,f,err = os.popen3("inkscape --query-%s --query-id=%s %s" % (query,id,file))
self.q[query] = float(f.read())
f.close()
+ err.close()
#process path
- d = obj.attributes.getNamedItem('d')
- p = cubicsuperpath.parsePath(d.value)
+ d = obj.get('d')
+ p = cubicsuperpath.parsePath(d)
for subs in p:
for csp in subs:
csp[0] = self.trafopoint(csp[0])
csp[1] = self.trafopoint(csp[1])
csp[2] = self.trafopoint(csp[2])
- d.value = cubicsuperpath.formatPath(p)
+ obj.set('d',cubicsuperpath.formatPath(p))
def trafopoint(self,(x,y)):
#Transform algorithm thanks to Jose Hevia (freon)