Make availability of GraphViz settings depend on output format

svn: r21366
This commit is contained in:
Nick Hall 2013-02-16 21:37:07 +00:00
parent 657d8e233f
commit 76eae75da2
2 changed files with 22 additions and 2 deletions

View File

@ -123,6 +123,7 @@ class GVOptions():
self.h_pages = None
self.v_pages = None
self.page_dir = None
self.dpi = None
def add_menu_options(self, menu):
"""
@ -217,9 +218,10 @@ class GVOptions():
dpi = NumberOption(_("DPI"), 75, 20, 1200)
dpi.set_help(_( "Dots per inch. When creating images such as "
".gif or .png files for the web, try numbers "
"such as 100 or 300 DPI. When creating PostScript "
"or PDF files, use 72 DPI."))
"such as 100 or 300 DPI. PostScript and PDF files "
"always use 72 DPI."))
menu.add_option(category, "dpi", dpi)
self.dpi = dpi
nodesep = NumberOption(_("Node spacing"), 0.20, 0.01, 5.00, 0.01)
nodesep.set_help(_( "The minimum amount of free space, in inches, "

View File

@ -211,6 +211,24 @@ class GraphvizReportDialog(ReportDialog):
fname = spath
self.target_fileentry.set_filename(fname)
format_str = obj.get_format_str()
if format_str in ['gvpdf', 'gspdf', 'ps']:
# Always use 72 DPI for PostScript and PDF files.
self.__gvoptions.dpi.set_value(72)
self.__gvoptions.dpi.set_available(False)
else:
self.__gvoptions.dpi.set_available(True)
if format_str in ['gspdf', 'dot']:
# Multiple pages only valid for dot and PDF via GhostsScript.
self.__gvoptions.h_pages.set_available(True)
self.__gvoptions.v_pages.set_available(True)
else:
self.__gvoptions.h_pages.set_value(1)
self.__gvoptions.v_pages.set_value(1)
self.__gvoptions.h_pages.set_available(False)
self.__gvoptions.v_pages.set_available(False)
def make_document(self):
"""Create a document of the type requested by the user.
"""