From b5fcfba5434af292d6687fdf941e23535af0ed77 Mon Sep 17 00:00:00 2001 From: Andrea Gavana Date: Tue, 12 Jun 2012 22:08:35 +0000 Subject: [PATCH] Phoenix: - Handle the `typedef` stuff as classes when the `docAsClass` attribute is set to ``True`` in the documentation building process (see `ScrolledWindow` and `ScrolledCanvas`). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71732 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- etgtools/sphinx_generator.py | 36 ++++++++++++++++++++++++++++++++++-- sphinxtools/postprocess.py | 5 +++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/etgtools/sphinx_generator.py b/etgtools/sphinx_generator.py index 77fe5b2a..ea3098ec 100644 --- a/etgtools/sphinx_generator.py +++ b/etgtools/sphinx_generator.py @@ -1865,7 +1865,7 @@ class XMLDocString(object): self.kind = 'method' elif isinstance(xml_item, (extractors.FunctionDef, extractors.PyFunctionDef)): self.kind = 'function' - elif isinstance(xml_item, (extractors.ClassDef, extractors.PyClassDef)): + elif isinstance(xml_item, (extractors.ClassDef, extractors.PyClassDef, extractors.TypedefDef)): self.kind = 'class' self.appearance = FindControlImages(xml_item) self.class_name = RemoveWxPrefix(xml_item.name) or xml_item.pyName @@ -3196,7 +3196,39 @@ class SphinxGenerator(generators.DocsGeneratorBase): # ----------------------------------------------------------------------- def generateTypedef(self, typedef): assert isinstance(typedef, extractors.TypedefDef) - # write nothing for this one + + if typedef.ignored or not typedef.docAsClass: + return + + name = RemoveWxPrefix(typedef.name) or typedef.pyName + typedef.module = self.current_module + + all_classes = {} + nodename = fullname = name + specials = [nodename] + + baselist = [base for base in typedef.bases if base != 'object'] + all_classes[nodename] = (nodename, fullname, baselist) + + self.UnIndent(typedef) + + typedef.nodeBases = all_classes, specials + typedef.subClasses = [] + typedef.method_list = typedef.property_list = [] + typedef.pyDocstring = typedef.briefDoc + self.current_class = typedef + + docstring = XMLDocString(typedef) + docstring.kind = 'class' + + filename = self.current_module + "%s.txt"%name + docstring.output_file = filename + docstring.current_module = self.current_module + + docstring.Dump() + + PickleClassInfo(self.current_module + name, self.current_class, docstring.short_description) + # ----------------------------------------------------------------------- def generateWigCode(self, wig): diff --git a/sphinxtools/postprocess.py b/sphinxtools/postprocess.py index 8a15c21d..a38c17a4 100644 --- a/sphinxtools/postprocess.py +++ b/sphinxtools/postprocess.py @@ -266,6 +266,11 @@ def FindInherited(input, class_summary, enum_base, text): if meth_name in methods: continue + if meth_name in class_summary: + newtext = ':ref:`%s`'%meth_name + text = text.replace(regs, newtext, 1) + continue + newstr = '' for cls in bases: