From f0b6cbdae4aab216c0da79f95afff901e5c426aa Mon Sep 17 00:00:00 2001 From: Mesalu Date: Wed, 21 Feb 2018 15:28:27 -0800 Subject: [PATCH] Remove the version from deprecations from doxygen, fix helper method between multiple classes. --- docs/sphinx/itemToModuleMap.json | 2 +- etgtools/sphinx_generator.py | 42 +++++++++++++++----------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/docs/sphinx/itemToModuleMap.json b/docs/sphinx/itemToModuleMap.json index 2ae2aa70..bc1db430 100644 --- a/docs/sphinx/itemToModuleMap.json +++ b/docs/sphinx/itemToModuleMap.json @@ -801,7 +801,7 @@ "DirProperty":"wx.propgrid.", "DirSelector":"wx.", "DirSelectorPromptStr":"wx.", -"Direction":"wx.DataObject.", +"Direction":"wx.", "DisableAsserts":"wx.", "Display":"wx.", "DisplayChangedEvent":"wx.", diff --git a/etgtools/sphinx_generator.py b/etgtools/sphinx_generator.py index dccde2e3..6f51657e 100644 --- a/etgtools/sphinx_generator.py +++ b/etgtools/sphinx_generator.py @@ -1067,7 +1067,7 @@ class Section(Node): elif section_type == 'deprecated': # Special treatment for deprecated, wxWidgets devs do not put the version number - text = '%s\n%s%s'%(VERSION, sub_spacer, text.lstrip('Deprecated')) + text = '\n%s%s'%(sub_spacer, text.lstrip('Deprecated')) elif section_type == 'par': # Horrible hack... Why is there a end tag inside the @par tag??? @@ -2620,7 +2620,7 @@ class XMLDocString(object): self.Reformat(stream) - self._dumpDeprecationDirective(method, stream, 6) + writeDeprecationDirective(method, stream, 6) possible_py = self.HuntContributedSnippets() @@ -2667,7 +2667,7 @@ class XMLDocString(object): self.Reformat(stream) - self._dumpDeprecationDirective(function, stream, 3) + writeDeprecationDirective(function, stream, 3) possible_py = self.HuntContributedSnippets() @@ -2887,24 +2887,6 @@ class XMLDocString(object): stream.write(docstrings + "\n\n") - # ----------------------------------------------------------------------- - - def _dumpDeprecationDirective(self, defobj, stream, spacing): - """ - Writes the deprecation directive to the stream if necesseary. - - :param BaseDef defobj: The extractor object that is potentially deprecated - :param stream: The IO stream to write to - :param spacing: indicates how much to pad the directive by, in number of spaces. - """ - - # all BaseDefs have deprecated now: - dep = defobj.deprecated - if dep and isinstance(dep, string_base): - directive = "{space_a}.. wxdeprecated::\n{space_b}{message}".format(space_a = ' ' * spacing, - space_b = ' ' * (spacing + 3), - message = dep) - # --------------------------------------------------------------------------- class SphinxGenerator(generators.DocsGeneratorBase): @@ -3340,7 +3322,7 @@ class SphinxGenerator(generators.DocsGeneratorBase): stream.write(newdocs + '\n\n') - self._dumpDeprecationDirective(pm, stream, 6) + writeDeprecationDirective(pm, stream, 6) c = self.current_class name = c.pyName if c.pyName else removeWxPrefix(c.name) @@ -3622,4 +3604,20 @@ def guessTypeStr(v): return True return False +def writeDeprecationDirective(defobj, stream, spacing): + """ + Writes the deprecation directive to the stream if necesseary. + + :param BaseDef defobj: The extractor object that is potentially deprecated + :param stream: The IO stream to write to + :param spacing: indicates how much to pad the directive by, in number of spaces. + """ + + # all BaseDefs have deprecated now: + dep = defobj.deprecated + if dep and isinstance(dep, string_base): + directive = "{space_a}.. wxdeprecated::\n{space_b}{message}".format(space_a = ' ' * spacing, + space_b = ' ' * (spacing + 3), + message = dep) + # ---------------------------------------------------------------------------