From 9f8a5b8d9a51c383175bdf9c17a1b2670783890b Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 15 Jul 2016 16:25:05 -0700 Subject: [PATCH] Fix bug when there are more than one code snippets in a set of overloaded methods. --- .../snippets/python/converted/wx.Font.__init__.1.py | 4 ++-- .../snippets/python/converted/wx.Font.__init__.2.py | 2 +- etgtools/sphinx_generator.py | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Font.__init__.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Font.__init__.1.py index cbf1e2f1..180fe0fb 100644 --- a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Font.__init__.1.py +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Font.__init__.1.py @@ -1,2 +1,2 @@ - - font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, True) + # Create a font using wx.FontInfo + font = wx.Font( wx.FontInfo(10).Bold().Underline() ) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Font.__init__.2.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Font.__init__.2.py index cbf1e2f1..68d30a68 100644 --- a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Font.__init__.2.py +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Font.__init__.2.py @@ -1,2 +1,2 @@ - + # Create a font using the old-style constructor font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, True) diff --git a/etgtools/sphinx_generator.py b/etgtools/sphinx_generator.py index 58415c8b..96ada993 100644 --- a/etgtools/sphinx_generator.py +++ b/etgtools/sphinx_generator.py @@ -2062,7 +2062,8 @@ class XMLDocString(object): break self.share_docstrings = share_docstrings - + + snippet_count = 0 for sub_item in [self.xml_item] + self.xml_item.overloads: if sub_item.ignored: @@ -2072,10 +2073,11 @@ class XMLDocString(object): docstring = XMLDocString(sub_item, is_overload=True, share_docstrings=share_docstrings) docstring.class_name = self.class_name docstring.current_module = self.current_module + docstring.snippet_count = snippet_count docs = docstring.Dump() self.overloads.append(docs) - + snippet_count = docstring.snippet_count # -----------------------------------------------------------------------