summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Spike <aaron@ekips.org>2007-04-01 21:33:25 +0000
committeracspike <acspike@users.sourceforge.net>2007-04-01 21:33:25 +0000
commit866294e1ef76aec71ffa295a70231c4ad1097f9a (patch)
tree30af6db3cfc0bcdb9e3a50969ef7db632cad9635
parentbe sure to use the sys prefix on exit; provide a resonable message to users w... (diff)
downloadinkscape-866294e1ef76aec71ffa295a70231c4ad1097f9a.tar.gz
inkscape-866294e1ef76aec71ffa295a70231c4ad1097f9a.zip
throw out stderr so that users don't see the warning about no svg extension on temp files. yes, we will mask other errors
(bzr r2804)
-rwxr-xr-xshare/extensions/perspective.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/share/extensions/perspective.py b/share/extensions/perspective.py
index 2f25f6a54..014a7b779 100755
--- a/share/extensions/perspective.py
+++ b/share/extensions/perspective.py
@@ -19,12 +19,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Perspective approach & math by Dmitry Platonov, shadowjack@mail.ru, 2006
"""
import sys, inkex, os, re, simplepath, cubicsuperpath
-from ffgeom import *
+from ffgeom import *
try:
from numpy import *
- from numpy.linalg import *
-except:
- inkex.debug("Failed to import the numpy or numpy.linalg modules. These modules are required by this extension. Please install them and try again.")
+ from numpy.linalg import *
+except:
+ inkex.debug("Failed to import the numpy or numpy.linalg modules. These modules are required by this extension. Please install them and try again.")
sys.exit()
uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'pc':15.0}
@@ -68,9 +68,10 @@ class Project(inkex.Effect):
file = self.args[-1]
id = self.options.ids[0]
for query in 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))
q[query] = float(f.read())
f.close()
+ err.close()
sp = array([[q['x'], q['y']+q['height']],[q['x'], q['y']],[q['x']+q['width'], q['y']],[q['x']+q['width'], q['y']+q['height']]], dtype=float64)
solmatrix = zeros((8,8), dtype=float64)
@@ -81,7 +82,7 @@ class Project(inkex.Effect):
solmatrix[i][2] = 1
solmatrix[i][6] = -dp[i][0]*sp[i][0]
solmatrix[i][7] = -dp[i][0]*sp[i][1]
- solmatrix[i+4][3] = sp[i][0]
+ solmatrix[i+4][3] = sp[i][0]
solmatrix[i+4][4] = sp[i][1]
solmatrix[i+4][5] = 1
solmatrix[i+4][6] = -dp[i][1]*sp[i][0]