General cleanup to GraphizReportDialog.

svn: r10624
This commit is contained in:
Brian Matherly 2008-04-23 03:25:41 +00:00
parent 4a17bcf0aa
commit 634fd3964d

View File

@ -83,21 +83,22 @@ _RATIO = [ { 'name' : _("Minimal size"), 'value' : "compress" },
_NOTELOC = [ { 'name' : _("Top"), 'value' : "t" },
{ 'name' : _("Bottom"), 'value' : "b" }]
_dot_found = 0
_gs_cmd = ""
if os.sys.platform == "win32":
_dot_found = Utils.search_for("dot.exe")
_DOT_FOUND = Utils.search_for("dot.exe")
if Utils.search_for("gswin32c.exe") == 1:
_gs_cmd = "gswin32c.exe"
_GS_CMD = "gswin32c.exe"
elif Utils.search_for("gswin32.exe") == 1:
_gs_cmd = "gswin32.exe"
_GS_CMD = "gswin32.exe"
else:
_dot_found = Utils.search_for("dot")
_GS_CMD = ""
else:
_DOT_FOUND = Utils.search_for("dot")
if Utils.search_for("gs") == 1:
_gs_cmd = "gs"
_GS_CMD = "gs"
else:
_GS_CMD = ""
#-------------------------------------------------------------------------------
#
@ -568,7 +569,7 @@ class GVPdfGsDoc(GVDocBase):
# Convert to PDF using ghostscript
command = '%s -q -sDEVICE=pdfwrite -dNOPAUSE -dDEVICEWIDTHPOINTS=%d' \
' -dDEVICEHEIGHTPOINTS=%d -sOutputFile="%s" "%s" -c quit' \
% ( _gs_cmd, width_pt, height_pt, self.filename, tmp_ps )
% ( _GS_CMD, width_pt, height_pt, self.filename, tmp_ps )
os.system(command)
os.remove(tmp_ps)
@ -590,9 +591,9 @@ _formats += [{ 'type' : "dot",
'mime' : "text/x-graphviz",
'class': GVDotDoc }]
if _dot_found:
if _DOT_FOUND:
if _gs_cmd != "":
if _GS_CMD != "":
_formats += [{ 'type' : "gspdf",
'ext' : "pdf",
'descr': _("PDF (Ghostscript)"),
@ -895,7 +896,8 @@ class GraphvizReportDialog(ReportDialog):
self.paper_label = gtk.Label('<b>%s</b>'%_("Paper Options"))
self.paper_label.set_use_markup(True)
self.paper_frame = PaperFrame(self.options.handler.get_paper_metric(),
self.paper_frame = PaperFrame(
self.options.handler.get_paper_metric(),
self.options.handler.get_paper_name(),
self.options.handler.get_orientation(),
self.options.handler.get_margins(),
@ -957,11 +959,13 @@ class GraphvizReportDialog(ReportDialog):
self.parse_format_frame()
self.parse_user_options()
self.options.handler.set_paper_metric(self.paper_frame.get_paper_metric())
self.options.handler.set_paper_metric(
self.paper_frame.get_paper_metric())
self.options.handler.set_paper_name(self.paper_frame.get_paper_name())
self.options.handler.set_orientation(self.paper_frame.get_orientation())
self.options.handler.set_margins(self.paper_frame.get_paper_margins())
self.options.handler.set_custom_paper_size(self.paper_frame.get_custom_paper_size())
self.options.handler.set_custom_paper_size(
self.paper_frame.get_custom_paper_size())
# Create the output document.
self.make_document()