From ac2e0a26ac3b80ddd3f50e8cda37346714b5ee32 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Mon, 23 Oct 2017 00:17:55 -0700 Subject: [PATCH] warn user if no Ghostscript on their machine This is the thread which motivated me to write this: http://gramps.1791082.n4.nabble.com/Re-Relationship-graph-is-limited-to-1x1-page-td4680666.html but unfortunately the Nabble archive of gramps was dead at the start of that thread, so it is missing. Here is a related commit, addressing part of the problem: https://github.com/gramps-project/gramps/pull/472/commits/90de264ccf89578888c9c653c774632cde545b49 --- gramps/gen/plug/docgen/graphdoc.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/gramps/gen/plug/docgen/graphdoc.py b/gramps/gen/plug/docgen/graphdoc.py index 31da27655..5c93ec2ce 100644 --- a/gramps/gen/plug/docgen/graphdoc.py +++ b/gramps/gen/plug/docgen/graphdoc.py @@ -8,7 +8,7 @@ # Copyright (C) 2007 Brian G. Matherly # Copyright (C) 2009 Benny Malengier # Copyright (C) 2009 Gary Burton -# Copyright (C) 2017 Mindaugas Baranauskas +# Copyright (C) 2013 Mindaugas Baranauskas # Copyright (C) 2017 Paul Culley # # This program is free software; you can redistribute it and/or modify @@ -911,6 +911,15 @@ class GVPdfGsDoc(GVDocBase): options.menu.get_option_by_name('dpi').set_value(72) GVDocBase.__init__(self, options, paper_style) + def init(self): + """ + tell the user how to enable this output format, if necessary + """ + if _GS_CMD == '': + from gramps.gen.errors import ReportError + raise ReportError(_("'Ghostscript' is not installed"), + _("Use your package manager to install it")) + def close(self): """ Implements GVPdfGsDoc.close() """ GVDocBase.close(self) @@ -1007,12 +1016,11 @@ FORMATS = [] if _DOT_FOUND: - if _GS_CMD != "": - FORMATS += [{'type' : "gspdf", - 'ext' : "pdf", - 'descr': _("PDF (Ghostscript)"), - 'mime' : "application/pdf", - 'class': GVPdfGsDoc}] + FORMATS += [{'type' : "gspdf", + 'ext' : "pdf", + 'descr': _("PDF (Ghostscript)"), + 'mime' : "application/pdf", + 'class': GVPdfGsDoc}] FORMATS += [{'type' : "gvpdf", 'ext' : "pdf",