Pylint on graphdoc
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
#
|
#
|
||||||
|
""" Graphviz adapter for Graphs """
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Standard Python modules
|
# Standard Python modules
|
||||||
@@ -36,13 +36,12 @@ import os
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import tempfile
|
import tempfile
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
import sys
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Gramps modules
|
# Gramps modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from ...const import GRAMPS_LOCALE as glocale
|
from ...const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
from ...utils.file import search_for
|
from ...utils.file import search_for
|
||||||
@@ -57,13 +56,13 @@ from ...constfunc import win
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(".graphdoc")
|
LOG = logging.getLogger(".graphdoc")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Private Constants
|
# Private Constants
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
_FONTS = [{'name' : _("Default"), 'value' : ""},
|
_FONTS = [{'name' : _("Default"), 'value' : ""},
|
||||||
{'name' : _("PostScript / Helvetica"), 'value' : "Helvetica"},
|
{'name' : _("PostScript / Helvetica"), 'value' : "Helvetica"},
|
||||||
{'name' : _("TrueType / FreeSans"), 'value' : "FreeSans"}]
|
{'name' : _("TrueType / FreeSans"), 'value' : "FreeSans"}]
|
||||||
@@ -110,11 +109,12 @@ else:
|
|||||||
else:
|
else:
|
||||||
_GS_CMD = ""
|
_GS_CMD = ""
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVOptions
|
# GVOptions
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVOptions:
|
class GVOptions:
|
||||||
"""
|
"""
|
||||||
Defines all of the controls necessary
|
Defines all of the controls necessary
|
||||||
@@ -206,7 +206,8 @@ class GVOptions:
|
|||||||
aspect_ratio = EnumeratedListOption(_("Aspect ratio"), "fill")
|
aspect_ratio = EnumeratedListOption(_("Aspect ratio"), "fill")
|
||||||
for item in _RATIO:
|
for item in _RATIO:
|
||||||
aspect_ratio.add_item(item["value"], item["name"])
|
aspect_ratio.add_item(item["value"], item["name"])
|
||||||
help_text = _('Affects node spacing and scaling of the graph.\n'
|
help_text = _(
|
||||||
|
'Affects node spacing and scaling of the graph.\n'
|
||||||
'If the graph is smaller than the print area:\n'
|
'If the graph is smaller than the print area:\n'
|
||||||
' Compress will not change the node spacing. \n'
|
' Compress will not change the node spacing. \n'
|
||||||
' Fill will increase the node spacing to fit the print area in '
|
' Fill will increase the node spacing to fit the print area in '
|
||||||
@@ -280,17 +281,17 @@ class GVOptions:
|
|||||||
pages are set to "1", then the page_dir control needs to
|
pages are set to "1", then the page_dir control needs to
|
||||||
be unavailable
|
be unavailable
|
||||||
"""
|
"""
|
||||||
if self.v_pages.get_value() > 1 or \
|
if self.v_pages.get_value() > 1 or self.h_pages.get_value() > 1:
|
||||||
self.h_pages.get_value() > 1:
|
|
||||||
self.page_dir.set_available(True)
|
self.page_dir.set_available(True)
|
||||||
else:
|
else:
|
||||||
self.page_dir.set_available(False)
|
self.page_dir.set_available(False)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVDoc
|
# GVDoc
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVDoc(metaclass=ABCMeta):
|
class GVDoc(metaclass=ABCMeta):
|
||||||
"""
|
"""
|
||||||
Abstract Interface for Graphviz document generators. Output formats
|
Abstract Interface for Graphviz document generators. Output formats
|
||||||
@@ -376,11 +377,12 @@ class GVDoc(metaclass=ABCMeta):
|
|||||||
:return: nothing
|
:return: nothing
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVDocBase
|
# GVDocBase
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVDocBase(BaseDoc, GVDoc):
|
class GVDocBase(BaseDoc, GVDoc):
|
||||||
"""
|
"""
|
||||||
Base document generator for all Graphviz document generators. Classes that
|
Base document generator for all Graphviz document generators. Classes that
|
||||||
@@ -394,24 +396,23 @@ class GVDocBase(BaseDoc, GVDoc):
|
|||||||
self._dot = BytesIO()
|
self._dot = BytesIO()
|
||||||
self._paper = paper_style
|
self._paper = paper_style
|
||||||
|
|
||||||
get_option_by_name = options.menu.get_option_by_name
|
get_option = options.menu.get_option_by_name
|
||||||
get_value = lambda name: get_option_by_name(name).get_value()
|
|
||||||
|
|
||||||
self.dpi = get_value('dpi')
|
self.dpi = get_option('dpi').get_value()
|
||||||
self.fontfamily = get_value('font_family')
|
self.fontfamily = get_option('font_family').get_value()
|
||||||
self.fontsize = get_value('font_size')
|
self.fontsize = get_option('font_size').get_value()
|
||||||
self.hpages = get_value('h_pages')
|
self.hpages = get_option('h_pages').get_value()
|
||||||
self.nodesep = get_value('nodesep')
|
self.nodesep = get_option('nodesep').get_value()
|
||||||
self.noteloc = get_value('noteloc')
|
self.noteloc = get_option('noteloc').get_value()
|
||||||
self.notesize = get_value('notesize')
|
self.notesize = get_option('notesize').get_value()
|
||||||
self.note = get_value('note')
|
self.note = get_option('note').get_value()
|
||||||
self.pagedir = get_value('page_dir')
|
self.pagedir = get_option('page_dir').get_value()
|
||||||
self.rankdir = get_value('rank_dir')
|
self.rankdir = get_option('rank_dir').get_value()
|
||||||
self.ranksep = get_value('ranksep')
|
self.ranksep = get_option('ranksep').get_value()
|
||||||
self.ratio = get_value('ratio')
|
self.ratio = get_option('ratio').get_value()
|
||||||
self.vpages = get_value('v_pages')
|
self.vpages = get_option('v_pages').get_value()
|
||||||
self.usesubgraphs = get_value('usesubgraphs')
|
self.usesubgraphs = get_option('usesubgraphs').get_value()
|
||||||
self.spline = get_value('spline')
|
self.spline = get_option('spline').get_value()
|
||||||
|
|
||||||
paper_size = paper_style.get_size()
|
paper_size = paper_style.get_size()
|
||||||
|
|
||||||
@@ -458,8 +459,8 @@ class GVDocBase(BaseDoc, GVDoc):
|
|||||||
' size="%3.2f,%3.2f"; \n' % (sizew, sizeh) +
|
' size="%3.2f,%3.2f"; \n' % (sizew, sizeh) +
|
||||||
' splines="%s";\n' % self.spline +
|
' splines="%s";\n' % self.spline +
|
||||||
'\n' +
|
'\n' +
|
||||||
' edge [len=0.5 style=solid fontsize=%d];\n' % self.fontsize
|
' edge [len=0.5 style=solid fontsize=%d];\n' % self.fontsize)
|
||||||
)
|
|
||||||
if self.fontfamily:
|
if self.fontfamily:
|
||||||
self.write(' node [style=filled fontname="%s" fontsize=%d];\n'
|
self.write(' node [style=filled fontname="%s" fontsize=%d];\n'
|
||||||
% (self.fontfamily, self.fontsize))
|
% (self.fontfamily, self.fontsize))
|
||||||
@@ -497,8 +498,7 @@ class GVDocBase(BaseDoc, GVDoc):
|
|||||||
'\n' +
|
'\n' +
|
||||||
' label="%s";\n' % label +
|
' label="%s";\n' % label +
|
||||||
' labelloc="%s";\n' % self.noteloc +
|
' labelloc="%s";\n' % self.noteloc +
|
||||||
' fontsize="%d";\n' % self.notesize
|
' fontsize="%d";\n' % self.notesize)
|
||||||
)
|
|
||||||
|
|
||||||
self.write('}\n\n')
|
self.write('}\n\n')
|
||||||
|
|
||||||
@@ -596,18 +596,18 @@ class GVDocBase(BaseDoc, GVDoc):
|
|||||||
self.write(
|
self.write(
|
||||||
' subgraph cluster_%s\n' % graph_id +
|
' subgraph cluster_%s\n' % graph_id +
|
||||||
' {\n' +
|
' {\n' +
|
||||||
' style="invis";\n' # no border around subgraph (#0002176)
|
' style="invis";\n') # no border around subgraph (#0002176)
|
||||||
)
|
|
||||||
|
|
||||||
def end_subgraph(self):
|
def end_subgraph(self):
|
||||||
""" Implement GVDocBase.end_subgraph() """
|
""" Implement GVDocBase.end_subgraph() """
|
||||||
self.write(' }\n')
|
self.write(' }\n')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVDotDoc
|
# GVDotDoc
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVDotDoc(GVDocBase):
|
class GVDotDoc(GVDocBase):
|
||||||
""" GVDoc implementation that generates a .gv text file. """
|
""" GVDoc implementation that generates a .gv text file. """
|
||||||
|
|
||||||
@@ -622,11 +622,12 @@ class GVDotDoc(GVDocBase):
|
|||||||
with open(self._filename, "wb") as dotfile:
|
with open(self._filename, "wb") as dotfile:
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVPsDoc
|
# GVPsDoc
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVPsDoc(GVDocBase):
|
class GVPsDoc(GVDocBase):
|
||||||
""" GVDoc implementation that generates a .ps file using Graphviz. """
|
""" GVDoc implementation that generates a .ps file using Graphviz. """
|
||||||
|
|
||||||
@@ -669,25 +670,28 @@ class GVPsDoc(GVDocBase):
|
|||||||
# disappeared. I used 1 inch margins always.
|
# disappeared. I used 1 inch margins always.
|
||||||
# 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
|
||||||
# recent versions of Graphvis doesn't even try, just puts out a single
|
# recent versions of Graphviz doesn't even try, just puts out a single
|
||||||
# large page.
|
# large page.
|
||||||
|
|
||||||
command = 'dot -Tps:cairo -o"%s" "%s"' % (self._filename, tmp_dot)
|
command = 'dot -Tps:cairo -o"%s" "%s"' % (self._filename, tmp_dot)
|
||||||
dotversion = str(Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1])
|
dotversion = str(Popen(['dot', '-V'],
|
||||||
# Problem with dot 2.26.3 and later and multiple pages, which gives "cairo: out of
|
stderr=PIPE).communicate(input=None)[1])
|
||||||
# memory" If the :cairo is skipped for these cases it gives bad
|
# Problem with dot 2.26.3 and later and multiple pages, which gives
|
||||||
# result for non-Latin-1 characters (utf-8).
|
# "cairo: out of memory" If the :cairo is skipped for these cases it
|
||||||
if (dotversion.find('2.26.3') or dotversion.find('2.28.0') != -1) and (self.vpages * self.hpages) > 1:
|
# gives bad result for non-Latin-1 characters (utf-8).
|
||||||
|
if (dotversion.find('2.26.3') or dotversion.find('2.28.0') != -1) and \
|
||||||
|
(self.vpages * self.hpages) > 1:
|
||||||
command = command.replace(':cairo', '')
|
command = command.replace(':cairo', '')
|
||||||
os.system(command)
|
os.system(command)
|
||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVSvgDoc
|
# GVSvgDoc
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVSvgDoc(GVDocBase):
|
class GVSvgDoc(GVDocBase):
|
||||||
""" GVDoc implementation that generates a .svg file using Graphviz. """
|
""" GVDoc implementation that generates a .svg file using Graphviz. """
|
||||||
|
|
||||||
@@ -717,11 +721,12 @@ class GVSvgDoc(GVDocBase):
|
|||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVSvgzDoc
|
# GVSvgzDoc
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVSvgzDoc(GVDocBase):
|
class GVSvgzDoc(GVDocBase):
|
||||||
""" GVDoc implementation that generates a .svg file using Graphviz. """
|
""" GVDoc implementation that generates a .svg file using Graphviz. """
|
||||||
|
|
||||||
@@ -751,11 +756,12 @@ class GVSvgzDoc(GVDocBase):
|
|||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVPngDoc
|
# GVPngDoc
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVPngDoc(GVDocBase):
|
class GVPngDoc(GVDocBase):
|
||||||
""" GVDoc implementation that generates a .png file using Graphviz. """
|
""" GVDoc implementation that generates a .png file using Graphviz. """
|
||||||
|
|
||||||
@@ -785,11 +791,12 @@ class GVPngDoc(GVDocBase):
|
|||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVJpegDoc
|
# GVJpegDoc
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVJpegDoc(GVDocBase):
|
class GVJpegDoc(GVDocBase):
|
||||||
""" GVDoc implementation that generates a .jpg file using Graphviz. """
|
""" GVDoc implementation that generates a .jpg file using Graphviz. """
|
||||||
|
|
||||||
@@ -819,11 +826,12 @@ class GVJpegDoc(GVDocBase):
|
|||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVGifDoc
|
# GVGifDoc
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVGifDoc(GVDocBase):
|
class GVGifDoc(GVDocBase):
|
||||||
""" GVDoc implementation that generates a .gif file using Graphviz. """
|
""" GVDoc implementation that generates a .gif file using Graphviz. """
|
||||||
|
|
||||||
@@ -853,11 +861,12 @@ class GVGifDoc(GVDocBase):
|
|||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVPdfGvDoc
|
# GVPdfGvDoc
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVPdfGvDoc(GVDocBase):
|
class GVPdfGvDoc(GVDocBase):
|
||||||
""" GVDoc implementation that generates a .pdf file using Graphviz. """
|
""" GVDoc implementation that generates a .pdf file using Graphviz. """
|
||||||
|
|
||||||
@@ -892,11 +901,12 @@ class GVPdfGvDoc(GVDocBase):
|
|||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVPdfGsDoc
|
# GVPdfGsDoc
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
class GVPdfGsDoc(GVDocBase):
|
class GVPdfGsDoc(GVDocBase):
|
||||||
""" GVDoc implementation that generates a .pdf file using Ghostscript. """
|
""" GVDoc implementation that generates a .pdf file using Ghostscript. """
|
||||||
def __init__(self, options, paper_style):
|
def __init__(self, options, paper_style):
|
||||||
@@ -927,11 +937,10 @@ class GVPdfGsDoc(GVDocBase):
|
|||||||
# Reason for using -Tps:cairo. Needed for Non Latin-1 letters
|
# Reason for using -Tps:cairo. Needed for Non Latin-1 letters
|
||||||
# See bug tracker issue 2815
|
# See bug tracker issue 2815
|
||||||
# :cairo does not work with with multi-page See issue 4164
|
# :cairo does not work with with multi-page See issue 4164
|
||||||
# recent versions of Graphvis doesn't even try, just puts out a single
|
# recent versions of Graphviz doesn't even try, just puts out a single
|
||||||
# large page, so we use Ghostscript to split it up.
|
# large page, so we use Ghostscript to split it up.
|
||||||
|
|
||||||
command = 'dot -Tps:cairo -o"%s" "%s"' % (tmp_ps, tmp_dot)
|
command = 'dot -Tps:cairo -o"%s" "%s"' % (tmp_ps, tmp_dot)
|
||||||
dotversion = str(Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1])
|
|
||||||
os.system(command)
|
os.system(command)
|
||||||
|
|
||||||
# Add .5 to remove rounding errors.
|
# Add .5 to remove rounding errors.
|
||||||
@@ -948,12 +957,12 @@ class GVPdfGsDoc(GVDocBase):
|
|||||||
os.remove(tmp_ps)
|
os.remove(tmp_ps)
|
||||||
return
|
return
|
||||||
# Margins (in centimeters) to pixels 72/2.54=28.345
|
# Margins (in centimeters) to pixels 72/2.54=28.345
|
||||||
MarginT = int(28.345 * self._paper.get_top_margin())
|
margin_t = int(28.345 * self._paper.get_top_margin())
|
||||||
MarginB = int(28.345 * self._paper.get_bottom_margin())
|
margin_b = int(28.345 * self._paper.get_bottom_margin())
|
||||||
MarginR = int(28.345 * self._paper.get_right_margin())
|
margin_r = int(28.345 * self._paper.get_right_margin())
|
||||||
MarginL = int(28.345 * self._paper.get_left_margin())
|
margin_l = int(28.345 * self._paper.get_left_margin())
|
||||||
MarginX = MarginL + MarginR
|
margin_x = margin_l + margin_r
|
||||||
MarginY = MarginT + MarginB
|
margin_y = margin_t + margin_b
|
||||||
# Convert to PDF using ghostscript
|
# Convert to PDF using ghostscript
|
||||||
list_of_pieces = []
|
list_of_pieces = []
|
||||||
|
|
||||||
@@ -962,14 +971,14 @@ class GVPdfGsDoc(GVDocBase):
|
|||||||
y_rng = range(1, self.vpages + 1) if 'B' in self.pagedir \
|
y_rng = range(1, self.vpages + 1) if 'B' in self.pagedir \
|
||||||
else range(self.vpages, 0, -1)
|
else range(self.vpages, 0, -1)
|
||||||
if self.pagedir[0] in 'TB':
|
if self.pagedir[0] in 'TB':
|
||||||
the_list = ((x, y) for y in y_rng for x in x_rng)
|
the_list = ((__x, __y) for __y in y_rng for __x in x_rng)
|
||||||
else:
|
else:
|
||||||
the_list = ((x, y) for x in x_rng for y in y_rng)
|
the_list = ((__x, __y) for __x in x_rng for __y in y_rng)
|
||||||
for x, y in the_list:
|
for __x, __y in the_list:
|
||||||
# Slit PS file to pieces of PDF
|
# Slit PS file to pieces of PDF
|
||||||
PageOffsetX = (x - 1) * (MarginX - width_pt)
|
page_offset_x = (__x - 1) * (margin_x - width_pt)
|
||||||
PageOffsetY = (y - 1) * (MarginY - height_pt)
|
page_offset_y = (__y - 1) * (margin_y - height_pt)
|
||||||
tmp_pdf_piece = "%s_%d_%d.pdf" % (tmp_ps, x, y)
|
tmp_pdf_piece = "%s_%d_%d.pdf" % (tmp_ps, __x, __y)
|
||||||
list_of_pieces.append(tmp_pdf_piece)
|
list_of_pieces.append(tmp_pdf_piece)
|
||||||
# Generate Ghostscript code
|
# Generate Ghostscript code
|
||||||
command = '%s -q -dBATCH -dNOPAUSE -dSAFER -g%dx%d '\
|
command = '%s -q -dBATCH -dNOPAUSE -dSAFER -g%dx%d '\
|
||||||
@@ -977,8 +986,8 @@ class GVPdfGsDoc(GVDocBase):
|
|||||||
'-c "<</.HWMargins [%d %d %d %d] /PageOffset [%d %d]>> '\
|
'-c "<</.HWMargins [%d %d %d %d] /PageOffset [%d %d]>> '\
|
||||||
'setpagedevice" -f "%s"' % (
|
'setpagedevice" -f "%s"' % (
|
||||||
_GS_CMD, width_pt + 10, height_pt + 10, tmp_pdf_piece,
|
_GS_CMD, width_pt + 10, height_pt + 10, tmp_pdf_piece,
|
||||||
MarginL, MarginB, MarginR, MarginT,
|
margin_l, margin_b, margin_r, margin_t,
|
||||||
PageOffsetX + 5, PageOffsetY + 5, tmp_ps)
|
page_offset_x + 5, page_offset_y + 5, tmp_ps)
|
||||||
# Execute Ghostscript
|
# Execute Ghostscript
|
||||||
os.system(command)
|
os.system(command)
|
||||||
# Merge pieces to single multipage PDF ;
|
# Merge pieces to single multipage PDF ;
|
||||||
@@ -993,11 +1002,11 @@ class GVPdfGsDoc(GVDocBase):
|
|||||||
os.remove(tmp_pdf_piece)
|
os.remove(tmp_pdf_piece)
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Various Graphviz formats.
|
# Various Graphviz formats.
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
FORMATS = []
|
FORMATS = []
|
||||||
|
|
||||||
if _DOT_FOUND:
|
if _DOT_FOUND:
|
||||||
|
Reference in New Issue
Block a user