Make availability of GraphViz settings depend on output format

svn: r21365
This commit is contained in:
Nick Hall 2013-02-16 21:36:58 +00:00
parent f075325399
commit 6deead53fc
2 changed files with 22 additions and 2 deletions

View File

@ -124,6 +124,7 @@ class GVOptions():
self.h_pages = None
self.v_pages = None
self.page_dir = None
self.dpi = None
def add_menu_options(self, menu):
"""
@ -218,9 +219,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

@ -212,6 +212,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.
"""