diff options
| author | Lex Neva <github@lexneva.name> | 2016-05-16 22:12:28 -0400 |
|---|---|---|
| committer | Lex Neva <github@lexneva.name> | 2016-05-16 22:16:36 -0400 |
| commit | 6a23fe868bd58af539c67011b53b1aef72733e0a (patch) | |
| tree | 46ec3ce9f6c79f4aaff0d45cf1f83a93d164e8c8 /embroider.py | |
| parent | 9f59051c979920b733ac54457aad4509ef0324ad (diff) | |
protect from foot-shooting by printing to stdout
Diffstat (limited to 'embroider.py')
| -rw-r--r-- | embroider.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/embroider.py b/embroider.py index bcca7042..17b29aff 100644 --- a/embroider.py +++ b/embroider.py @@ -962,6 +962,10 @@ class Embroider(inkex.Effect): process(self.document.getroot()) def effect(self): + # Printing anything other than a valid SVG on stdout blows inkscape up. + old_stdout = sys.stdout + sys.stdout = sys.stderr + self.cache_order() #print >> sys.stderr, "cached stacking order:", self.order @@ -1013,6 +1017,8 @@ class Embroider(inkex.Effect): new_layer.set(inkex.addNS('groupmode', 'inkscape'), 'layer') eo.emit_inkscape(new_layer, emb) + sys.stdout = old_stdout + def emit_inkscape_bbox(self, parent, eo): (x0, y0, x1, y1) = eo.bbox() new_path = [] @@ -1205,7 +1211,8 @@ class Embroider(inkex.Effect): # if they're the same, we don't know which direction # to offset in, so we have to just return the points return pos1, pos2 - print >> sys.stderr, pos1, pos2 + + print pos1, pos2 midpoint = (pos2 + pos1) * 0.5 pos1 = pos1 + (pos1 - midpoint).unit() * offset_px |
