06256: Can't create graph reports
svn: r21001
This commit is contained in:
parent
17824534cb
commit
ddd1aae5c3
@ -633,7 +633,10 @@ class GVPsDoc(GVDocBase):
|
|||||||
|
|
||||||
# Create a temporary dot file
|
# Create a temporary dot file
|
||||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
dotfile = os.fdopen(handle, "w")
|
dotfile = os.fdopen(handle, "w")
|
||||||
|
else:
|
||||||
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
|
|
||||||
@ -650,10 +653,13 @@ class GVPsDoc(GVDocBase):
|
|||||||
# See bug tracker issue 2815
|
# See bug tracker issue 2815
|
||||||
# :cairo does not work with Graphviz 2.26.3 and later See issue 4164
|
# :cairo does not work with Graphviz 2.26.3 and later See issue 4164
|
||||||
# Covert filename to str using file system encoding.
|
# Covert filename to str using file system encoding.
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||||
|
else:
|
||||||
|
fname = self._filename
|
||||||
|
|
||||||
command = 'dot -Tps:cairo -o"%s" "%s"' % (fname, tmp_dot)
|
command = 'dot -Tps:cairo -o"%s" "%s"' % (fname, tmp_dot)
|
||||||
dotversion = Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1]
|
dotversion = str(Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1])
|
||||||
# Problem with dot 2.26.3 and later and multiple pages, which gives "cairo: out of
|
# Problem with dot 2.26.3 and later and multiple pages, which gives "cairo: out of
|
||||||
# memory" If the :cairo is skipped for these cases it gives acceptable
|
# memory" If the :cairo is skipped for these cases it gives acceptable
|
||||||
# result.
|
# result.
|
||||||
@ -688,11 +694,17 @@ class GVSvgDoc(GVDocBase):
|
|||||||
|
|
||||||
# Create a temporary dot file
|
# Create a temporary dot file
|
||||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
dotfile = os.fdopen(handle, "w")
|
dotfile = os.fdopen(handle, "w")
|
||||||
|
else:
|
||||||
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
# Covert filename to str using file system encoding.
|
# Covert filename to str using file system encoding.
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||||
|
else:
|
||||||
|
fname = self._filename
|
||||||
|
|
||||||
# Generate the SVG file.
|
# Generate the SVG file.
|
||||||
os.system( 'dot -Tsvg -o"%s" "%s"' % (fname, tmp_dot) )
|
os.system( 'dot -Tsvg -o"%s" "%s"' % (fname, tmp_dot) )
|
||||||
@ -725,11 +737,17 @@ class GVSvgzDoc(GVDocBase):
|
|||||||
|
|
||||||
# Create a temporary dot file
|
# Create a temporary dot file
|
||||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
dotfile = os.fdopen(handle, "w")
|
dotfile = os.fdopen(handle, "w")
|
||||||
|
else:
|
||||||
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
# Covert filename to str using file system encoding.
|
# Covert filename to str using file system encoding.
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||||
|
else:
|
||||||
|
fname = self._filename
|
||||||
|
|
||||||
# Generate the SVGZ file.
|
# Generate the SVGZ file.
|
||||||
os.system( 'dot -Tsvgz -o"%s" "%s"' % (fname, tmp_dot) )
|
os.system( 'dot -Tsvgz -o"%s" "%s"' % (fname, tmp_dot) )
|
||||||
@ -762,11 +780,17 @@ class GVPngDoc(GVDocBase):
|
|||||||
|
|
||||||
# Create a temporary dot file
|
# Create a temporary dot file
|
||||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
dotfile = os.fdopen(handle, "w")
|
dotfile = os.fdopen(handle, "w")
|
||||||
|
else:
|
||||||
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
# Covert filename to str using file system encoding.
|
# Covert filename to str using file system encoding.
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||||
|
else:
|
||||||
|
fname = self._filename
|
||||||
|
|
||||||
# Generate the PNG file.
|
# Generate the PNG file.
|
||||||
os.system( 'dot -Tpng -o"%s" "%s"' % (fname, tmp_dot) )
|
os.system( 'dot -Tpng -o"%s" "%s"' % (fname, tmp_dot) )
|
||||||
@ -799,11 +823,17 @@ class GVJpegDoc(GVDocBase):
|
|||||||
|
|
||||||
# Create a temporary dot file
|
# Create a temporary dot file
|
||||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
dotfile = os.fdopen(handle, "w")
|
dotfile = os.fdopen(handle, "w")
|
||||||
|
else:
|
||||||
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
# Covert filename to str using file system encoding.
|
# Covert filename to str using file system encoding.
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||||
|
else:
|
||||||
|
fname = self._filename
|
||||||
|
|
||||||
# Generate the JPEG file.
|
# Generate the JPEG file.
|
||||||
os.system( 'dot -Tjpg -o"%s" "%s"' % (fname, tmp_dot) )
|
os.system( 'dot -Tjpg -o"%s" "%s"' % (fname, tmp_dot) )
|
||||||
@ -836,11 +866,17 @@ class GVGifDoc(GVDocBase):
|
|||||||
|
|
||||||
# Create a temporary dot file
|
# Create a temporary dot file
|
||||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
dotfile = os.fdopen(handle, "w")
|
dotfile = os.fdopen(handle, "w")
|
||||||
|
else:
|
||||||
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
# Covert filename to str using file system encoding.
|
# Covert filename to str using file system encoding.
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||||
|
else:
|
||||||
|
fname = self._filename
|
||||||
|
|
||||||
# Generate the GIF file.
|
# Generate the GIF file.
|
||||||
os.system( 'dot -Tgif -o"%s" "%s"' % (fname, tmp_dot) )
|
os.system( 'dot -Tgif -o"%s" "%s"' % (fname, tmp_dot) )
|
||||||
@ -882,8 +918,11 @@ class GVPdfGvDoc(GVDocBase):
|
|||||||
dotfile = os.fdopen(handle, "wb")
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
# Covert filename to str using file system encoding.
|
# Convert filename to str using file system encoding.
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||||
|
else:
|
||||||
|
fname = self._filename
|
||||||
|
|
||||||
# Generate the PDF file.
|
# Generate the PDF file.
|
||||||
os.system( 'dot -Tpdf -o"%s" "%s"' % (fname, tmp_dot) )
|
os.system( 'dot -Tpdf -o"%s" "%s"' % (fname, tmp_dot) )
|
||||||
@ -914,7 +953,10 @@ class GVPdfGsDoc(GVDocBase):
|
|||||||
|
|
||||||
# Create a temporary dot file
|
# Create a temporary dot file
|
||||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
dotfile = os.fdopen(handle, "w")
|
dotfile = os.fdopen(handle, "w")
|
||||||
|
else:
|
||||||
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
|
|
||||||
@ -928,7 +970,7 @@ class GVPdfGsDoc(GVDocBase):
|
|||||||
# :cairo does not work with Graphviz 2.26.3 and later See issue 4164
|
# :cairo does not work with Graphviz 2.26.3 and later See issue 4164
|
||||||
|
|
||||||
command = 'dot -Tps:cairo -o"%s" "%s"' % ( tmp_ps, tmp_dot )
|
command = 'dot -Tps:cairo -o"%s" "%s"' % ( tmp_ps, tmp_dot )
|
||||||
dotversion = Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1]
|
dotversion = str(Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1])
|
||||||
# Problem with dot 2.26.3 and later and multiple pages, which gives "cairo: out
|
# Problem with dot 2.26.3 and later and multiple pages, which gives "cairo: out
|
||||||
# of memory". If the :cairo is skipped for these cases it gives
|
# of memory". If the :cairo is skipped for these cases it gives
|
||||||
# acceptable result.
|
# acceptable result.
|
||||||
@ -942,7 +984,10 @@ class GVPdfGsDoc(GVDocBase):
|
|||||||
height_pt = int( (paper_size.get_height_inches() * 72) + 0.5 )
|
height_pt = int( (paper_size.get_height_inches() * 72) + 0.5 )
|
||||||
|
|
||||||
# Convert to PDF using ghostscript
|
# Convert to PDF using ghostscript
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||||
|
else:
|
||||||
|
fname = self._filename
|
||||||
command = '%s -q -sDEVICE=pdfwrite -dNOPAUSE -dDEVICEWIDTHPOINTS=%d' \
|
command = '%s -q -sDEVICE=pdfwrite -dNOPAUSE -dDEVICEWIDTHPOINTS=%d' \
|
||||||
' -dDEVICEHEIGHTPOINTS=%d -sOutputFile="%s" "%s" -c quit' \
|
' -dDEVICEHEIGHTPOINTS=%d -sOutputFile="%s" "%s" -c quit' \
|
||||||
% ( _GS_CMD, width_pt, height_pt, fname, tmp_ps )
|
% ( _GS_CMD, width_pt, height_pt, fname, tmp_ps )
|
||||||
|
Loading…
Reference in New Issue
Block a user