summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 19129d5)
raw | patch | inline | side by side (parent: 19129d5)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Mon, 29 May 2006 01:37:07 +0000 (01:37 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Mon, 29 May 2006 01:37:07 +0000 (01:37 +0000) |
share/extensions/inkex.py | patch | blob | history |
index 41fdcd95991c47995414dfc121148370ab3b7632..64efdabda1ecb088957ef449f41abf56d54336bd 100755 (executable)
#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))
+
+ layerattr = xml.xpath.Evaluate('//sodipodi:namedview/@inkscape:current-layer',self.document,context=ctx)
+ if layerattr:
+ layername = layerattr[0].value
+ layer = xml.xpath.Evaluate('//g[@id="%s"]' % layername,self.document,context=ctx)[0]
+ if layer:
+ self.current_layer = layer
+
+ xattr = xml.xpath.Evaluate('//sodipodi:namedview/@inkscape:cx',self.document,context=ctx)
+ yattr = xml.xpath.Evaluate('//sodipodi:namedview/@inkscape:cy',self.document,context=ctx)
+ if xattr and yattr:
+ x = xattr[0].value
+ y = yattr[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: