Skip to content

Commit f53c74a

Browse files
committed
Fixed eps method runtime error
1 parent a90c075 commit f53c74a

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

Packages/vcs/vcs/Canvas.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4913,6 +4913,7 @@ def _compute_width_height(self, width, height, units, ps=False):
49134913
H = tmp
49144914
return W, H
49154915

4916+
49164917
def postscript(self, file, mode='r', orientation=None, width=None, height=None,
49174918
units='inches', textAsPaths=True):
49184919
"""
@@ -5330,8 +5331,7 @@ def gs(self, filename='noname.gs', device='png256',
53305331
# #
53315332
##########################################################################
53325333
def eps(self, file, mode='r', orientation=None, width=None, height=None,
5333-
units='inches', left_margin=None, right_margin=None, top_margin=None,
5334-
bottom_margin=None, textAsPaths=True):
5334+
units='inches', textAsPaths=True):
53355335
"""
53365336
Function: Encapsulated PostScript
53375337
@@ -5369,11 +5369,8 @@ def eps(self, file, mode='r', orientation=None, width=None, height=None,
53695369
width,
53705370
height,
53715371
units,
5372-
left_margin,
5373-
right_margin,
5374-
top_margin,
5375-
bottom_margin,
53765372
textAsPaths)
5373+
53775374
os.popen("ps2epsi %s %s" % (tmpfile, file)).readlines()
53785375
os.remove(tmpfile)
53795376

testing/vcs/test_vcs_export_text.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,50 @@
22

33
x = vcs.init(bg=1, geometry=(800, 600))
44
txt = x.createtext()
5-
txt.x = [.0000005,.00000005,.5,.99999,.999999]
6-
txt.y = [0.05,.9,.5,.9,0.05]
5+
txt.x = [0.2, 0.2, 0.5, 0.8, 0.8]
6+
txt.y = [0.2, 0.8, 0.5, 0.8, 0.2]
77
txt.string = ["SAMPLE TEXT A","SAMPLE TEXT B","SAMPLE TEXT C","SAMPLE TEXT D","SAMPLE TEXT E"]
88
txt.halign = "center"
99
txt.valign = "base"
1010
txt.height = 10
1111
x.plot(txt)
1212

1313
tmpfile = tempfile.NamedTemporaryFile(suffix='.ps', \
14-
prefix='textAsPathsFalse', delete=True)
14+
prefix='textAsPathsFalse', delete=False)
1515
x.postscript(tmpfile.name, textAsPaths=False)
1616
tmpfile.close()
1717

1818
tmpfile = tempfile.NamedTemporaryFile(suffix='.ps', \
19-
prefix='textAsPathsTrue', delete=True)
19+
prefix='textAsPathsTrue', delete=False)
2020
x.postscript(tmpfile.name, textAsPaths=True)
2121
tmpfile.close()
2222

2323
tmpfile = tempfile.NamedTemporaryFile(suffix='.pdf', \
24-
prefix='textAsPathsFalse', delete=True)
24+
prefix='textAsPathsFalse', delete=False)
2525
x.pdf(tmpfile.name, textAsPaths=False)
26-
# tmpfile.close()
26+
tmpfile.close()
2727

2828
tmpfile = tempfile.NamedTemporaryFile(suffix='.pdf', \
29-
prefix='textAsPathsTrue', delete=True )
29+
prefix='textAsPathsTrue', delete=False)
3030
x.pdf(tmpfile.name, textAsPaths=True)
3131
tmpfile.close()
3232

3333
tmpfile = tempfile.NamedTemporaryFile(suffix='.svg', \
34-
prefix='textAsPathsFalse', delete=True)
34+
prefix='textAsPathsFalse', delete=False)
3535
x.svg(tmpfile.name, textAsPaths=False)
3636
tmpfile.close()
3737

3838
tmpfile = tempfile.NamedTemporaryFile(suffix='.svg', \
39-
prefix='textAsPathsTrue', delete=True)
39+
prefix='textAsPathsTrue', delete=False)
4040
x.svg(tmpfile.name, textAsPaths=True)
4141
tmpfile.close()
4242

4343
tmpfile = tempfile.NamedTemporaryFile(suffix='.eps', \
44-
prefix='textAsPathsFalse', delete=True)
44+
prefix='textAsPathsFalse', delete=False)
4545
x.eps(tmpfile.name, textAsPaths=False)
4646
tmpfile.close()
4747

4848
tmpfile = tempfile.NamedTemporaryFile(suffix='.eps', \
49-
prefix='textAsPathsTrue', delete=True)
49+
prefix='textAsPathsTrue', delete=False)
5050
x.eps(tmpfile.name, textAsPaths=True)
5151
tmpfile.close()

0 commit comments

Comments
 (0)