diff --git a/docs/sphinx/_templates/layout.html b/docs/sphinx/_templates/layout.html index eacf8cd3..3ce43652 100644 --- a/docs/sphinx/_templates/layout.html +++ b/docs/sphinx/_templates/layout.html @@ -17,6 +17,6 @@ {% block header %}
-Phoenix Logo +Phoenix Logo
{% endblock %} diff --git a/docs/sphinx/conf.py b/docs/sphinx/conf.py index 9a627039..3c79ffdc 100644 --- a/docs/sphinx/conf.py +++ b/docs/sphinx/conf.py @@ -25,7 +25,7 @@ sys.path.append('..') # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.todo', 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.coverage', - 'availability'] + 'availability'] #, 'rst2pdf.pdfbuilder'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -261,18 +261,3 @@ pdf_verbosity = 2 # Enable experimental feature to split table cells. Use it # if you get "DelayedTable too big" errors pdf_splittables = True - -##def process_docstring(app, what, name, obj, options, lines): -## -## if what == "data": -## -## fid = open("autodata_docstrings.pkl", "rb") -## autodata_dict = cPickle.load(fid) -## fid.close() -## -## if name in autodata_dict: -## lines[:] = [autodata_dict[name].strip()] -## -## -##def setup(app): -## app.connect('autodoc-process-docstring', process_docstring) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/Cursor.__init__.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/Cursor.__init__.1.py new file mode 100644 index 00000000..517852b0 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/Cursor.__init__.1.py @@ -0,0 +1,3 @@ + + image.SetOption(wx.IMAGE_OPTION_CUR_HOTSPOT_X, hotSpotX) + image.SetOption(wx.IMAGE_OPTION_CUR_HOTSPOT_X, hotSpotY) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/FSFile.__init__.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/FSFile.__init__.1.py new file mode 100644 index 00000000..ae9aae3a --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/FSFile.__init__.1.py @@ -0,0 +1,8 @@ + + class MyFSFile(wx.FSFile): + + def __init__(self): + + wx.FSFile.__init__(self) + + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystem.AddHandler.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystem.AddHandler.1.py new file mode 100644 index 00000000..4f93a3a6 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystem.AddHandler.1.py @@ -0,0 +1,2 @@ + + wx.FileSystem.AddHandler(My_FS_Handler) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystem.ChangePathTo.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystem.ChangePathTo.1.py new file mode 100644 index 00000000..0d40d202 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystem.ChangePathTo.1.py @@ -0,0 +1,4 @@ + + ChangePathTo("dir/subdir/xh.htm") + ChangePathTo("dir/subdir", True) + ChangePathTo("dir/subdir/", True) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystem.ChangePathTo.2.py b/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystem.ChangePathTo.2.py new file mode 100644 index 00000000..4792fb75 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystem.ChangePathTo.2.py @@ -0,0 +1,4 @@ + + f = fs.OpenFile("hello.htm") # opens file 'hello.htm' + fs.ChangePathTo("subdir/folder", True) + f = fs.OpenFile("hello.htm") # opens file 'subdir/folder/hello.htm' !! diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystemHandler.CanOpen.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystemHandler.CanOpen.1.py new file mode 100644 index 00000000..f7a6692a --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystemHandler.CanOpen.1.py @@ -0,0 +1,5 @@ + + def CanOpen(self, location): + + return self.GetProtocol(location) == "http" + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystemHandler.GetMimeTypeFromExt.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystemHandler.GetMimeTypeFromExt.1.py new file mode 100644 index 00000000..bbbba263 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/FileSystemHandler.GetMimeTypeFromExt.1.py @@ -0,0 +1,3 @@ + + if GetMimeTypeFromExt("index.htm") == "text/html": + wx.MessageBox("Is HTML!") diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/MemoryFSHandler.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/MemoryFSHandler.1.py new file mode 100644 index 00000000..4e2a55ae --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/MemoryFSHandler.1.py @@ -0,0 +1,35 @@ + + def OnAbout(self, event): + + bcur = wx.BeginBusyCursor() + + wx.FileSystem.AddHandler(wx.MemoryFSHandler) + wx.MemoryFSHandler.AddFile("logo.pcx", wx.Bitmap("logo.pcx", wx.BITMAP_TYPE_PCX)) + wx.MemoryFSHandler.AddFile("about.htm", + "About: " + "") + + dlg = wx.Dialog(self, -1, _("About")) + + topsizer = wx.BoxSizer(wx.VERTICAL) + + html = wx.html.HtmlWindow(dlg, size=wx.Size(380, 160), style=wx.HW_SCROLLBAR_NEVER) + html.SetBorders(0) + html.LoadPage("memory:about.htm") + html.SetSize(html.GetInternalRepresentation().GetWidth(), + html.GetInternalRepresentation().GetHeight()) + + topsizer.Add(html, 1, wx.ALL, 10) + topsizer.Add(wx.StaticLine(dlg, -1), 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10) + topsizer.Add(wx.Button(dlg, wx.ID_OK, "Ok"), + 0, wx.ALL | wx.ALIGN_RIGHT, 15) + + dlg.SetAutoLayout(True) + dlg.SetSizer(topsizer) + topsizer.Fit(dlg) + dlg.Centre() + dlg.ShowModal() + + wx.MemoryFSHandler.RemoveFile("logo.pcx") + wx.MemoryFSHandler.RemoveFile("about.htm") + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/Window.SetBackgroundStyle.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/Window.SetBackgroundStyle.1.py new file mode 100644 index 00000000..89454855 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/Window.SetBackgroundStyle.1.py @@ -0,0 +1,17 @@ + + class MyWidget(wx.Window): + + def __init__(self, parent): + + pre = wx.PreWindow() # Use Pre- constructor here! + + # Do this first: + self.SetBackgroundStyle(wx.BG_STYLE_TRANSPARENT) + + # And really create the window afterwards: + pre.Create(parent) + self.PostCreate(pre) + + + + diff --git a/etgtools/sphinx_generator.py b/etgtools/sphinx_generator.py index 263ad405..3efba2a8 100644 --- a/etgtools/sphinx_generator.py +++ b/etgtools/sphinx_generator.py @@ -1685,7 +1685,7 @@ class Title(Node): text = '|phoenix_title| ' + ConvertToPython(self.element.text) lentext = len(text) - text = '\n\n%s\n%s\n\n'%(text, '='*lentext) + text = '\n\n%s\n%s\n\n'%(text.rstrip('.'), '='*lentext) return text @@ -2001,6 +2001,7 @@ class XMLDocString(object): rest_class = Emphasis(element, parent) elif tag == 'title': + text = ConvertToPython(element.text) rest_class = Title(element, parent) elif tag == 'para': @@ -2788,7 +2789,7 @@ class SphinxGenerator(generators.DocsGeneratorBase): filename = self.current_module + "%s.txt"%name - WriteSphinxOutput(stream, filename) + WriteSphinxOutput(stream, filename, append=True) # ----------------------------------------------------------------------- @@ -2945,7 +2946,7 @@ class SphinxGenerator(generators.DocsGeneratorBase): name = RemoveWxPrefix(self.current_class.name) or self.current_class.pyName filename = self.current_module + "%s.txt"%name - WriteSphinxOutput(stream, filename) + WriteSphinxOutput(stream, filename, append=True) # ----------------------------------------------------------------------- @@ -2971,7 +2972,7 @@ class SphinxGenerator(generators.DocsGeneratorBase): filename = self.current_module + "%s.txt"%name - WriteSphinxOutput(stream, filename) + WriteSphinxOutput(stream, filename, append=True) def createPropertyLinks(self, name, prop): diff --git a/sphinxtools/constants.py b/sphinxtools/constants.py index db985f3f..eb4e279e 100644 --- a/sphinxtools/constants.py +++ b/sphinxtools/constants.py @@ -131,6 +131,8 @@ MAGIC_METHODS = { # TODO: add more } +SECTIONS_EXCLUDE = {'TextCtrl': ('|phoenix_title| TextCtrl and ``C++`` Streams', '|phoenix_title| Event Handling')} + # A regex to split a string keeping the whitespaces RE_KEEP_SPACES = re.compile(r'(\s+)') @@ -141,7 +143,7 @@ HTML_REPLACE = ['module', 'function', 'method', 'class', 'classmethod', 'staticm # The SVN revision of wxWidgets/Phoenix used to build the Sphinx docs. # There must be a more intelligent way to get this information automatically. -SVN_REVISION = '70154' +SVN_REVISION = '70741' # Today's date representation for the Sphinx HTML docs TODAY = datetime.date.today().strftime('%d %B %Y') diff --git a/sphinxtools/postprocess.py b/sphinxtools/postprocess.py index 80c29804..388cf882 100644 --- a/sphinxtools/postprocess.py +++ b/sphinxtools/postprocess.py @@ -22,7 +22,7 @@ import templates from buildtools.config import copyIfNewer, writeIfChanged, newer from utilities import Wx2Sphinx -from constants import HTML_REPLACE, SVN_REVISION, TODAY, SPHINXROOT +from constants import HTML_REPLACE, SVN_REVISION, TODAY, SPHINXROOT, SECTIONS_EXCLUDE from constants import CONSTANT_INSTANCES, WIDGETS_IMAGES_ROOT, SPHINX_IMAGES_ROOT @@ -118,6 +118,14 @@ def BuildEnumsAndMethods(sphinxDir): for old, new in enum_dict.items(): text = text.replace(old, new) + widget_name = os.path.split(os.path.splitext(input)[0])[1] + + if widget_name in SECTIONS_EXCLUDE: + start, end = SECTIONS_EXCLUDE[widget_name] + lindex = text.index(start) + rindex = text.index(end) + text = text[0:lindex] + text[rindex:] + # Replace the "Perl Note" stuff, we don't need it newtext = '' for line in text.splitlines(): @@ -479,7 +487,7 @@ def PostProcess(folder): fileNames = glob.glob(folder + "/*.html") phoenix_image = '
\n' \ - 'Phoenix Logo\n' \ + 'Phoenix Logo\n' \ '
'