From 3c3e5e8248d9af41df39eb09ee0c6255db543de3 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Fri, 23 Nov 2012 04:12:50 +0000 Subject: [PATCH] Tweak docgen registration to specify options class name. Fix CLI reports. svn: r20695 --- gramps/cli/plug/__init__.py | 2 +- gramps/gen/plug/_manager.py | 8 +++---- gramps/gen/plug/_pluginreg.py | 8 +++---- gramps/plugins/docgen/docgen.gpr.py | 36 ++++++++++++++--------------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/gramps/cli/plug/__init__.py b/gramps/cli/plug/__init__.py index b2adf9314..4002d1dbd 100644 --- a/gramps/cli/plug/__init__.py +++ b/gramps/cli/plug/__init__.py @@ -433,7 +433,7 @@ class CommandLineReport(object): menu = self.option_class.menu menu_opt_names = menu.get_all_option_names() - format_str = self.options_str_dict.pop('off', None) + _format_str = self.options_str_dict.pop('off', None) if _format_str: self.options_dict['off'] = _format_str diff --git a/gramps/gen/plug/_manager.py b/gramps/gen/plug/_manager.py index 7359b1dfa..f97f816db 100644 --- a/gramps/gen/plug/_manager.py +++ b/gramps/gen/plug/_manager.py @@ -535,16 +535,16 @@ class BasePluginManager(object): mod = self.load_plugin(pdata) if mod: oclass = None - if pdata.options: - oclass = getattr(mod, pdata.basedocclass + 'Options') + if pdata.optionclass: + oclass = getattr(mod, pdata.optionclass) dgp = DocGenPlugin(name=pdata.name, description = pdata.description, - basedoc = getattr(mod, pdata.basedocclass), + basedoc = getattr(mod, pdata.docclass), paper = pdata.paper, style = pdata.style, extension = pdata.extension, docoptclass = oclass, - basedocname = pdata.basedocclass ) + basedocname = pdata.docclass ) self.__docgen_plugins.append(dgp) return self.__docgen_plugins diff --git a/gramps/gen/plug/_pluginreg.py b/gramps/gen/plug/_pluginreg.py index 44e26e778..450465899 100644 --- a/gramps/gen/plug/_pluginreg.py +++ b/gramps/gen/plug/_pluginreg.py @@ -254,7 +254,7 @@ class PluginData(object): or the view category a plugin belongs to, default=("Miscellaneous", _("Miscellaneous")) - Attributes for REPORT and TOOL plugins + Attributes for REPORT and TOOL and DOCGEN plugins .. attribute:: optionclass The class in the module that is the option class @@ -265,7 +265,7 @@ class PluginData(object): The tool modes: list of TOOL_MODE_GUI, TOOL_MODE_CLI Attributes for DOCGEN plugins - .. attribute :: basedocclass + .. attribute :: docclass The class in the module that is the BaseDoc defined .. attribute :: paper bool, Indicates whether the plugin uses paper or not, default=True @@ -641,8 +641,8 @@ class PluginData(object): #REPORT OR TOOL attributes def _set_optionclass(self, optionclass): - if not (self._ptype == REPORT or self.ptype == TOOL): - raise ValueError('optionclass may only be set for REPORT/TOOL plugins') + if not (self._ptype == REPORT or self.ptype == TOOL or self._ptype == DOCGEN): + raise ValueError('optionclass may only be set for REPORT/TOOL/DOCGEN plugins') self._optionclass = optionclass def _get_optionclass(self): diff --git a/gramps/plugins/docgen/docgen.gpr.py b/gramps/plugins/docgen/docgen.gpr.py index df9a4dd8d..9ecbb2226 100644 --- a/gramps/plugins/docgen/docgen.gpr.py +++ b/gramps/plugins/docgen/docgen.gpr.py @@ -35,11 +35,11 @@ plg.gramps_target_version = '4.0' plg.status = STABLE plg.fname = 'asciidoc.py' plg.ptype = DOCGEN -plg.basedocclass = 'AsciiDoc' +plg.docclass = 'AsciiDoc' +plg.optionclass = 'AsciiDocOptions' plg.paper = True plg.style = True plg.extension = "txt" -plg.options = True #------------------------------------------------------------------------ # @@ -56,11 +56,11 @@ plg.gramps_target_version = '4.0' plg.status = STABLE plg.fname = 'gtkprint.py' plg.ptype = DOCGEN -plg.basedocclass = 'GtkPrint' +plg.docclass = 'GtkPrint' +plg.optionclass = None plg.paper = True plg.style = True plg.extension = "" -plg.options = False #------------------------------------------------------------------------ # @@ -77,11 +77,11 @@ plg.gramps_target_version = '4.0' plg.status = STABLE plg.fname = 'htmldoc.py' plg.ptype = DOCGEN -plg.basedocclass = 'HtmlDoc' +plg.docclass = 'HtmlDoc' +plg.optionclass = None plg.paper = False plg.style = True plg.extension = "html" -plg.options = False #------------------------------------------------------------------------ # @@ -98,11 +98,11 @@ plg.gramps_target_version = '4.0' plg.status = STABLE plg.fname = 'latexdoc.py' plg.ptype = DOCGEN -plg.basedocclass = 'LaTeXDoc' +plg.docclass = 'LaTeXDoc' +plg.optionoclass = None plg.paper = True plg.style = False plg.extension = "tex" -plg.options = False #------------------------------------------------------------------------ # @@ -120,11 +120,11 @@ plg.gramps_target_version = '4.0' plg.status = STABLE plg.fname = 'odfdoc.py' plg.ptype = DOCGEN -plg.basedocclass = 'ODFDoc' +plg.docclass = 'ODFDoc' +plg.optionclass = None plg.paper = True plg.style = True plg.extension = "odt" -plg.options = False #------------------------------------------------------------------------ # @@ -141,11 +141,11 @@ plg.gramps_target_version = '4.0' plg.status = STABLE plg.fname = 'pdfdoc.py' plg.ptype = DOCGEN -plg.basedocclass = 'PdfDoc' +plg.docclass = 'PdfDoc' +plg.optionclass = None plg.paper = True plg.style = True plg.extension = "pdf" -plg.options = False #------------------------------------------------------------------------ # @@ -162,11 +162,11 @@ plg.gramps_target_version = '4.0' plg.status = STABLE plg.fname = 'psdrawdoc.py' plg.ptype = DOCGEN -plg.basedocclass = 'PSDrawDoc' +plg.docclass = 'PSDrawDoc' +plg.optionclass = None plg.paper = True plg.style = True plg.extension = "ps" -plg.options = False #------------------------------------------------------------------------ # @@ -183,11 +183,11 @@ plg.gramps_target_version = '4.0' plg.status = STABLE plg.fname = 'rtfdoc.py' plg.ptype = DOCGEN -plg.basedocclass = 'RTFDoc' +plg.docclass = 'RTFDoc' +plg.optionclass = None plg.paper = True plg.style = True plg.extension = "rtf" -plg.options = False #------------------------------------------------------------------------ # @@ -205,8 +205,8 @@ plg.gramps_target_version = '4.0' plg.status = STABLE plg.fname = 'svgdrawdoc.py' plg.ptype = DOCGEN -plg.basedocclass = 'SvgDrawDoc' +plg.docclass = 'SvgDrawDoc' +plg.optionclass = None plg.paper = True plg.style = True plg.extension = "svg" -plg.options = False