~ubuntu-branches/ubuntu/utopic/inkscape/utopic-proposed

« back to all changes in this revision

Viewing changes to share/extensions/summersnight.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:
22
22
import gettext
23
23
_ = gettext.gettext
24
24
 
 
25
try:
 
26
    from subprocess import Popen, PIPE
 
27
    bsubprocess = True
 
28
except:
 
29
    bsubprocess = False
 
30
 
25
31
class Project(inkex.Effect):
26
32
    def __init__(self):
27
33
            inkex.Effect.__init__(self)
58
64
                file = self.args[-1]
59
65
                id = self.options.ids[0]
60
66
                for query in self.q.keys():
61
 
                    f,err = os.popen3('inkscape --query-%s --query-id=%s "%s"' % (query,id,file))[1:]
62
 
                    self.q[query] = float(f.read())
63
 
                    f.close()
64
 
                    err.close()
 
67
                    if bsubprocess:
 
68
                        p = Popen('inkscape --query-%s --query-id=%s "%s"' % (query,id,file), shell=True, stdout=PIPE, stderr=PIPE)
 
69
                        rc = p.wait()
 
70
                        self.q[query] = float(p.stdout.read())
 
71
                        err = p.stderr.read()
 
72
                    else:
 
73
                        f,err = os.popen3('inkscape --query-%s --query-id=%s "%s"' % (query,id,file))[1:]
 
74
                        self.q[query] = float(f.read())
 
75
                        f.close()
 
76
                        err.close()
65
77
 
66
78
                if obj.tag == inkex.addNS("path",'svg'):
67
79
                    self.process_path(obj)