protect from foot-shooting by printing to stdout

pull/1/head
Lex Neva 2016-05-16 22:12:28 -04:00
rodzic 9f59051c97
commit 6a23fe868b
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -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