diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2015-07-11 10:32:29 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2015-07-11 10:32:29 +0000 |
| commit | 71ea4a616b147d4b962f4e7a8fec9ff8562945e3 (patch) | |
| tree | cc3def64cf333cf449bb3800ce0d86a18aa88dc0 | |
| parent | Extensions. Fix for Bug #1463623 (Error trying to save Optimized SVG (no 'wid... (diff) | |
| download | inkscape-71ea4a616b147d4b962f4e7a8fec9ff8562945e3.tar.gz inkscape-71ea4a616b147d4b962f4e7a8fec9ff8562945e3.zip | |
Extensions. Fix for Bug #1461346 (getposinlayer fails if height attribute is missing)
(bzr r14241)
| -rwxr-xr-x | share/extensions/inkex.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py index 2517c7e04..6eb229885 100755 --- a/share/extensions/inkex.py +++ b/share/extensions/inkex.py @@ -207,7 +207,7 @@ class Effect: x = self.unittouu( xattr[0] + 'px' ) y = self.unittouu( yattr[0] + 'px') doc_height = self.unittouu(self.document.getroot().get('height')) - if x and y: + if x and y and doc_height is not None: self.view_center = (float(x), doc_height - float(y)) # FIXME: y-coordinate flip, eliminate it when it's gone in Inkscape def getselected(self): @@ -340,19 +340,22 @@ class Effect: unit = re.compile('(%s)$' % '|'.join(self.__uuconv.keys())) param = re.compile(r'(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)') - p = param.match(string) - u = unit.search(string) - if p: - retval = float(p.string[p.start():p.end()]) + if string is not None: + p = param.match(string) + u = unit.search(string) + if p: + retval = float(p.string[p.start():p.end()]) + else: + retval = 0.0 + if u: + try: + return retval * (self.__uuconv[u.string[u.start():u.end()]] / self.__uuconv[self.getDocumentUnit()]) + except KeyError: + pass + else: # default assume 'px' unit + return retval / self.__uuconv[self.getDocumentUnit()] else: - retval = 0.0 - if u: - try: - return retval * (self.__uuconv[u.string[u.start():u.end()]] / self.__uuconv[self.getDocumentUnit()]) - except KeyError: - pass - else: # default assume 'px' unit - return retval / self.__uuconv[self.getDocumentUnit()] + retval = None return retval |
