Tweak docgen registration to specify options class name. Fix CLI reports.
svn: r20695
This commit is contained in:
		@@ -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
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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):
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user