~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to share/extensions/restack.py

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
"""
24
24
import inkex, os, csv, math
25
25
 
 
26
try:
 
27
    from subprocess import Popen, PIPE
 
28
    bsubprocess = True
 
29
except:
 
30
    bsubprocess = False
 
31
 
26
32
class Restack(inkex.Effect):
27
33
    def __init__(self):
28
34
        inkex.Effect.__init__(self)
50
56
            file = self.args[ -1 ]
51
57
            #get all bounding boxes in file by calling inkscape again with the --querry-all command line option
52
58
            #it returns a comma seperated list structured id,x,y,w,h
53
 
            _,f,err = os.popen3( "inkscape --query-all %s" % ( file ) )
 
59
            if bsubprocess:
 
60
                p = Popen('inkscape --query-all "%s"' % (file), shell=True, stdout=PIPE, stderr=PIPE)
 
61
                rc = p.wait()
 
62
                f = p.stdout
 
63
                err = p.stderr
 
64
            else:
 
65
                _,f,err = os.popen3( "inkscape --query-all %s" % ( file ) )
54
66
            reader=csv.reader( f.readlines() )
55
67
            f.close()
56
68
            err.close()