summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9bf2641)
raw | patch | inline | side by side (parent: 9bf2641)
author | acspike <acspike@users.sourceforge.net> | |
Sun, 28 May 2006 03:41:31 +0000 (03:41 +0000) | ||
committer | acspike <acspike@users.sourceforge.net> | |
Sun, 28 May 2006 03:41:31 +0000 (03:41 +0000) |
share/extensions/inkex.py | patch | blob | history |
index b8bba3803860d9d3b74154709d3768f91da4ba1b..41fdcd95991c47995414dfc121148370ab3b7632 100755 (executable)
stream = sys.stdin
self.document = reader.fromStream(stream)
stream.close()
+ def getposinlayer(self):
+ ctx = xml.xpath.Context.Context(self.document,processorNss=NSS)
+ #defaults
+ self.current_layer = self.document.documentElement
+ self.view_center = (0.0,0.0)
+
+ layername = xml.xpath.Evaluate('//sodipodi:namedview/@inkscape:current-layer',self.document,context=ctx)[0].value
+ layer = xml.xpath.Evaluate('//g[@id="%s"]' % layername,self.document,context=ctx)[0]
+ if layer:
+ self.current_layer = layer
+
+ x = xml.xpath.Evaluate('//sodipodi:namedview/@inkscape:cx',self.document,context=ctx)[0].value
+ y = xml.xpath.Evaluate('//sodipodi:namedview/@inkscape:cy',self.document,context=ctx)[0].value
+ if x and y:
+ self.view_center = (float(x),float(y))
def getselected(self):
"""Collect selected nodes"""
for id in self.options.ids:
"""Affect an SVG document with a callback effect"""
self.getoptions()
self.parse()
+ self.getposinlayer()
self.getselected()
self.effect()
self.output()