diff --git a/build.py b/build.py
index dd636e88..575b2f0c 100755
--- a/build.py
+++ b/build.py
@@ -1145,6 +1145,7 @@ def clean_sphinx(options, args):
opj(sphinxDir, '_templates/gallery.html'),
opj(sphinxDir, 'rest_substitutions/snippets/python/*.py'),
opj(sphinxDir, 'rest_substitutions/snippets/cpp/*.cpp'),
+ opj(sphinxDir, '_static/images/inheritance/*.*'),
]
for wc in globs:
for f in glob.glob(wc):
@@ -1157,7 +1158,6 @@ def clean_sphinx(options, args):
if os.path.exists(d):
shutil.rmtree(d)
-
def clean(options, args):
clean_wx(options, args)
diff --git a/docs/sphinx/_static/images/sphinxdocs/state.gif b/docs/sphinx/_static/images/sphinxdocs/state.gif
new file mode 100644
index 00000000..12d98eb9
Binary files /dev/null and b/docs/sphinx/_static/images/sphinxdocs/state.gif differ
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxgtk/animationctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxgtk/adv.animationctrl.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxgtk/animationctrl.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxgtk/adv.animationctrl.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxgtk/calendarctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxgtk/adv.calendarctrl.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxgtk/calendarctrl.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxgtk/adv.calendarctrl.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxgtk/commandlinkbutton.png b/docs/sphinx/_static/images/widgets/fullsize/wxgtk/adv.commandlinkbutton.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxgtk/commandlinkbutton.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxgtk/adv.commandlinkbutton.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxgtk/datepickerctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxgtk/adv.datepickerctrl.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxgtk/datepickerctrl.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxgtk/adv.datepickerctrl.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxgtk/hyperlinkctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxgtk/adv.hyperlinkctrl.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxgtk/hyperlinkctrl.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxgtk/adv.hyperlinkctrl.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmac/animationctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxmac/adv.animationctrl.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxmac/animationctrl.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxmac/adv.animationctrl.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmac/calendarctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxmac/adv.calendarctrl.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxmac/calendarctrl.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxmac/adv.calendarctrl.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmac/adv.datepickerctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxmac/adv.datepickerctrl.png
new file mode 100644
index 00000000..51c989c7
Binary files /dev/null and b/docs/sphinx/_static/images/widgets/fullsize/wxmac/adv.datepickerctrl.png differ
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmac/hyperlinkctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxmac/adv.hyperlinkctrl.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxmac/hyperlinkctrl.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxmac/adv.hyperlinkctrl.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmac/datepickerctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxmac/datepickerctrl.png
deleted file mode 100644
index 41b1e4aa..00000000
Binary files a/docs/sphinx/_static/images/widgets/fullsize/wxmac/datepickerctrl.png and /dev/null differ
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmsw/animationctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxmsw/adv.animationctrl.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxmsw/animationctrl.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxmsw/adv.animationctrl.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmsw/calendarctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxmsw/adv.calendarctrl.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxmsw/calendarctrl.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxmsw/adv.calendarctrl.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmsw/commandlinkbutton.png b/docs/sphinx/_static/images/widgets/fullsize/wxmsw/adv.commandlinkbutton.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxmsw/commandlinkbutton.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxmsw/adv.commandlinkbutton.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmsw/datepickerctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxmsw/adv.datepickerctrl.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxmsw/datepickerctrl.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxmsw/adv.datepickerctrl.png
diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmsw/hyperlinkctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxmsw/adv.hyperlinkctrl.png
similarity index 100%
rename from docs/sphinx/_static/images/widgets/fullsize/wxmsw/hyperlinkctrl.png
rename to docs/sphinx/_static/images/widgets/fullsize/wxmsw/adv.hyperlinkctrl.png
diff --git a/docs/sphinx/_templates/main.html b/docs/sphinx/_templates/main.html
index edb87e81..c47df664 100644
--- a/docs/sphinx/_templates/main.html
+++ b/docs/sphinx/_templates/main.html
@@ -54,7 +54,7 @@
Note
- If you wish to help in the documentation effort, the main docstrings guidelines are outlined in
+ If you wish to help in the documentation effort, the main docstrings guidelines are outlined in
this document.
@@ -79,7 +79,7 @@
Phoenix Widgets
Swig-ed from wxWidgets
-
+
Phoenix Functions
Standalone/Static functions
@@ -90,6 +90,7 @@
wx.lib
diff --git a/docs/sphinx/rest_substitutions/overviews/DocstringsGuidelines.rst b/docs/sphinx/rest_substitutions/overviews/DocstringsGuidelines.rst
index 8c6ff7a5..07dc06b5 100644
--- a/docs/sphinx/rest_substitutions/overviews/DocstringsGuidelines.rst
+++ b/docs/sphinx/rest_substitutions/overviews/DocstringsGuidelines.rst
@@ -103,7 +103,7 @@ In general, the standards for the ``:param`` field are the following:
Or, alternatively::
:param `pt`: the mouse pointer location.
- :type `pt`: `Point`
+ :type `pt`: Point
Similarly, for the ``:return:`` and ``:rtype:`` field, you may consider doing the following:
diff --git a/docs/sphinx/rest_substitutions/overviews/index.rst b/docs/sphinx/rest_substitutions/overviews/index.rst
index 68083a92..81b397f5 100644
--- a/docs/sphinx/rest_substitutions/overviews/index.rst
+++ b/docs/sphinx/rest_substitutions/overviews/index.rst
@@ -173,6 +173,8 @@ The new wxPython API documentation is available `in this page `_.
window_ids_overview
window_sizing_overview
window_styles_overview
+ adv.1classindex
+ adv.functions
dataview.1classindex
lib
py
diff --git a/docs/sphinx/rest_substitutions/overviews/printing_framework_overview.rst b/docs/sphinx/rest_substitutions/overviews/printing_framework_overview.rst
index 0e48eb10..e8fd0ca4 100644
--- a/docs/sphinx/rest_substitutions/overviews/printing_framework_overview.rst
+++ b/docs/sphinx/rest_substitutions/overviews/printing_framework_overview.rst
@@ -104,8 +104,6 @@ Unlike a :ref:`PrinterDC`, there is no distinction between the page rectangle an
both rectangles are taken to represent the entire sheet of paper.
-.. _printdialog overview:
-
PrintDialog
-----------
diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/AboutDialogInfo.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/adv.AboutDialogInfo.1.py
similarity index 97%
rename from docs/sphinx/rest_substitutions/snippets/python/converted/AboutDialogInfo.1.py
rename to docs/sphinx/rest_substitutions/snippets/python/converted/adv.AboutDialogInfo.1.py
index cd1047ac..861b5428 100644
--- a/docs/sphinx/rest_substitutions/snippets/python/converted/AboutDialogInfo.1.py
+++ b/docs/sphinx/rest_substitutions/snippets/python/converted/adv.AboutDialogInfo.1.py
@@ -1,13 +1,13 @@
-
- def OnAbout(self, event):
-
- aboutInfo = wx.AboutDialogInfo()
- aboutInfo.SetName("MyApp")
- aboutInfo.SetVersion(MY_APP_VERSION_STRING)
- aboutInfo.SetDescription(_("My wxPython-based application!"))
- aboutInfo.SetCopyright("(C) 1992-2012")
- aboutInfo.SetWebSite("http:#myapp.org")
- aboutInfo.AddDeveloper("My Self")
-
- wx.AboutBox(aboutInfo)
-
+
+ def OnAbout(self, event):
+
+ aboutInfo = wx.AboutDialogInfo()
+ aboutInfo.SetName("MyApp")
+ aboutInfo.SetVersion(MY_APP_VERSION_STRING)
+ aboutInfo.SetDescription(_("My wxPython-based application!"))
+ aboutInfo.SetCopyright("(C) 1992-2012")
+ aboutInfo.SetWebSite("http:#myapp.org")
+ aboutInfo.AddDeveloper("My Self")
+
+ wx.AboutBox(aboutInfo)
+
diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/BannerWindow.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/adv.BannerWindow.1.py
similarity index 100%
rename from docs/sphinx/rest_substitutions/snippets/python/converted/BannerWindow.1.py
rename to docs/sphinx/rest_substitutions/snippets/python/converted/adv.BannerWindow.1.py
diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/Sound.Play.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/adv.Sound.Play.1.py
similarity index 100%
rename from docs/sphinx/rest_substitutions/snippets/python/converted/Sound.Play.1.py
rename to docs/sphinx/rest_substitutions/snippets/python/converted/adv.Sound.Play.1.py
diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/Sound.PlaySound.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/adv.Sound.PlaySound.1.py
similarity index 100%
rename from docs/sphinx/rest_substitutions/snippets/python/converted/Sound.PlaySound.1.py
rename to docs/sphinx/rest_substitutions/snippets/python/converted/adv.Sound.PlaySound.1.py
diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/SplashScreen.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/adv.SplashScreen.1.py
similarity index 100%
rename from docs/sphinx/rest_substitutions/snippets/python/converted/SplashScreen.1.py
rename to docs/sphinx/rest_substitutions/snippets/python/converted/adv.SplashScreen.1.py
diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/functions.AboutBox.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/adv.functions.AboutBox.1.py
similarity index 97%
rename from docs/sphinx/rest_substitutions/snippets/python/converted/functions.AboutBox.1.py
rename to docs/sphinx/rest_substitutions/snippets/python/converted/adv.functions.AboutBox.1.py
index 3e1e5593..ed610767 100644
--- a/docs/sphinx/rest_substitutions/snippets/python/converted/functions.AboutBox.1.py
+++ b/docs/sphinx/rest_substitutions/snippets/python/converted/adv.functions.AboutBox.1.py
@@ -1,11 +1,11 @@
-
- def ShowSimpleAboutDialog(self, event):
-
- info = wx.AboutDialogInfo()
- info.SetName(_("My Program"))
- info.SetVersion(_("1.2.3 Beta"))
- info.SetDescription(_("This program does something great."))
- info.SetCopyright(wx.T("(C) 2007 Me "))
-
- wx.AboutBox(info)
-
+
+ def ShowSimpleAboutDialog(self, event):
+
+ info = wx.AboutDialogInfo()
+ info.SetName(_("My Program"))
+ info.SetVersion(_("1.2.3 Beta"))
+ info.SetDescription(_("This program does something great."))
+ info.SetCopyright(wx.T("(C) 2007 Me "))
+
+ wx.AboutBox(info)
+
diff --git a/etg/bitmap.py b/etg/bitmap.py
index 338816c3..0d3b4563 100644
--- a/etg/bitmap.py
+++ b/etg/bitmap.py
@@ -132,12 +132,8 @@ def run():
============================= ================================
wx.BitmapBufferFormat_RGB A simple sequence of RGB bytes
wx.BitmapBufferFormat_RGBA A simple sequence of RGBA bytes
- wx.BitmapBufferFormat_ARGB32 A sequence of 32-bit values in native
- endian order, with alpha in the upper
- 8 bits, followed by red, green, and
- blue.
- wx.BitmapBufferFormat_RGB32 Same as above but the alpha byte
- is ignored.
+ wx.BitmapBufferFormat_ARGB32 A sequence of 32-bit values in native endian order, with alpha in the upper 8 bits, followed by red, green, and blue.
+ wx.BitmapBufferFormat_RGB32 Same as above but the alpha byte is ignored.
============================= ================================""",
body="""\
wxPyCopyBitmapFromBuffer(self, (byte*)data->m_ptr, data->m_len, format, stride);
diff --git a/etgtools/sphinx_generator.py b/etgtools/sphinx_generator.py
index 7d586160..bbce88c4 100644
--- a/etgtools/sphinx_generator.py
+++ b/etgtools/sphinx_generator.py
@@ -18,13 +18,21 @@ the various XML elements passed by the Phoenix extractors into ReST format.
# Standard library stuff
import os
import operator
+import sys
import shutil
import textwrap
import glob
-import cPickle
-from StringIO import StringIO
+if sys.version_info < (3, ):
+ from StringIO import StringIO
+ string_base = basestring
+
+else:
+
+ from io import StringIO
+ string_base = str
+
import xml.etree.ElementTree as et
# Phoenix-specific stuff
@@ -140,7 +148,7 @@ class Node(object):
:returns: The element text for the input `tag_name` or ``None``.
"""
- if isinstance(self.element, basestring):
+ if isinstance(self.element, string_base):
return None
return self.element.get(tag_name)
@@ -262,7 +270,7 @@ class Node(object):
if self.element is None:
return text
- if isinstance(self.element, basestring):
+ if isinstance(self.element, string_base):
text = self.element
else:
text, tail = self.element.text, self.element.tail
@@ -376,7 +384,7 @@ class Root(Node):
text = Node.Join(self, with_tail)
# Health check
- existing_sections = self.sections.keys()[:]
+ existing_sections = list(self.sections.keys())
for section_name, dummy in SECTIONS:
if section_name not in self.sections:
@@ -603,7 +611,7 @@ class ParameterList(Node):
signature = name + '(%s)'%arguments
arguments = arguments.split(',')
- py_parameters = self.py_parameters.keys()
+ py_parameters = list(self.py_parameters.keys())
message = '\nSEVERE: Incompatibility between function/method signature and list of parameters in `%s`:\n\n' \
'The parameter `%s` appears in the method signature but could not be found in the parameter list.\n\n' \
@@ -630,7 +638,7 @@ class ParameterList(Node):
if hasattr(xml_item, 'className') and xml_item.className is not None:
class_name = Wx2Sphinx(xml_item.className)[1] + '.'
- print message % (class_name + name, arg, signature, py_parameters)
+ print((message % (class_name + name, arg, signature, py_parameters)))
## for param in py_parameters:
## if param not in theargs:
@@ -666,7 +674,7 @@ class ParameterList(Node):
docstrings = ''
- for name, parameter in self.py_parameters.items():
+ for name, parameter in list(self.py_parameters.items()):
if parameter.type.strip():
docstrings += ':param `%s`: %s\n'%(name, parameter.Join().lstrip('\n'))
docstrings += ':type `%s`: %s\n'%(name, parameter.type)
@@ -992,7 +1000,7 @@ class Section(Node):
self.is_overload = is_overload
self.share_docstrings = share_docstrings
- dummy, section_type = self.element.items()[0]
+ dummy, section_type = list(self.element.items())[0]
self.section_type = section_type.split("_")[0]
@@ -1098,7 +1106,7 @@ class Image(Node):
to avoid wrong ReST output.
"""
- for key, value in self.element.items():
+ for key, value in list(self.element.items()):
if key == 'name':
break
@@ -1186,8 +1194,8 @@ class Table(Node):
has_title = False
count = 0
- for row in xrange(rows):
- for col in xrange(cols):
+ for row in range(rows):
+ for col in range(cols):
child = self.children[count]
text = child.Join(with_tail)
@@ -1210,11 +1218,11 @@ class Table(Node):
count = 0
- for row in xrange(rows):
+ for row in range(rows):
table += spacer
- for col in xrange(cols):
+ for col in range(cols):
table += formats[col] % (self.children[count].Join(with_tail).strip())
count += 1
@@ -1311,7 +1319,7 @@ class Snippet(Node):
if tag == 'sp':
self.snippet += ' '
- if isinstance(element, basestring):
+ if isinstance(element, string_base):
self.snippet += element
else:
if element.text:
@@ -1354,7 +1362,7 @@ class Snippet(Node):
message = '\nWARNING: Missing C++ => Python conversion of the snippet of code for %s'%(os.path.split(self.cpp_file)[1])
message += '\n\nA slightly Pythonized version of this snippet has been saved into:\n\n ==> %s\n\n'%self.python_file
- print message
+ print(message)
py_code = self.snippet.replace(';', '')
py_code = py_code.replace('{', '').replace('}', '')
@@ -1458,7 +1466,7 @@ class XRef(Node):
if "(" in text:
text = text[0:text.index("(")]
- refid, link = element.items()[0]
+ refid, link = list(element.items())[0]
remainder = link.split('_')[-1]
space_before, space_after = CountSpaces(text)
@@ -1789,7 +1797,7 @@ class ULink(Node):
to avoid wrong ReST output.
"""
- dummy, link = self.element.items()[0]
+ dummy, link = list(self.element.items())[0]
text = self.element.text
text = '`%s <%s>`_'%(text, link)
@@ -1981,7 +1989,7 @@ class XMLDocString(object):
if element is None:
return Node('', parent)
- if isinstance(element, basestring):
+ if isinstance(element, string_base):
rest_class = Paragraph(element, parent, self.kind)
return rest_class
@@ -2299,7 +2307,7 @@ class XMLDocString(object):
if found:
newlines = self.CodeIndent(line, newlines)
- newdocs = u''
+ newdocs = ''
for line in newlines:
newdocs += ' '*3 + line + "\n"
@@ -2577,7 +2585,7 @@ class XMLDocString(object):
name = ConvertToPython(RemoveWxPrefix(v.name))
stream.write('%-80s'%name)
- if not isinstance(docstrings, basestring):
+ if not isinstance(docstrings, string_base):
rest_class = self.RecurseXML(docstrings, self.root)
docstrings = rest_class.Join()
@@ -2692,7 +2700,7 @@ class XMLDocString(object):
elif self.is_overload and self.share_docstrings:
- docstrings = self.Indent(None, self.docstrings, spacer, u'')
+ docstrings = self.Indent(None, self.docstrings, spacer, '')
else:
@@ -2704,11 +2712,11 @@ class XMLDocString(object):
if isinstance(self.xml_item, (extractors.PyFunctionDef, extractors.PyClassDef)):
docstrings = self.xml_item.briefDoc
if docstrings:
- docstrings = self.Indent(class_name, docstrings, spacer, u'')
+ docstrings = self.Indent(class_name, docstrings, spacer, '')
else:
docstrings = ''
else:
- docstrings = self.Indent(class_name, self.docstrings, spacer, u'')
+ docstrings = self.Indent(class_name, self.docstrings, spacer, '')
if self.kind == 'class':
desc = ChopDescription(docstrings)
@@ -2767,7 +2775,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
continue
if name in done:
- print message % (kind, name, class_name, name, item.__class__.__name__)
+ print((message % (kind, name, class_name, name, item.__class__.__name__)))
duplicated_indexes.append(index)
continue
@@ -3202,7 +3210,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
simple_docs = ConvertToPython(method.pyDocstring)
else:
brief = method.briefDoc
- if not isinstance(brief, basestring):
+ if not isinstance(brief, string_base):
docstring = XMLDocString(method)
docstring.kind = 'method'
docstring.current_module = self.current_module
diff --git a/sphinxtools/constants.py b/sphinxtools/constants.py
index 6b1b73ad..bd0c4758 100644
--- a/sphinxtools/constants.py
+++ b/sphinxtools/constants.py
@@ -69,9 +69,12 @@ REMOVED_LINKS = ['Library:', 'Category:', 'Predefined objects/pointers:']
# wx.html and so on)
MODULENAME_REPLACE = {'_core' : '',
'_dataview': 'dataview.',
- '_adv' : '',
+ '_adv' : 'adv.',
}
+NO_MODULE = {'DatePickerCtrlGeneric': 'adv.',
+ 'GenericCalendarCtrl': 'adv.'}
+
# Other C++ specific things to strip away
CPP_ITEMS = ['*', '&', 'const', 'unsigned', '(size_t)', 'size_t', 'void']
@@ -88,11 +91,12 @@ SPHINXROOT = os.path.join(PHOENIXROOT, 'docs', 'sphinx')
# converted Python snippets in 3 sub-folders
SNIPPETROOT = os.path.join(SPHINXROOT, 'rest_substitutions', 'snippets')
-# A folder where some of the difficult-to-translate-to-ReST tables are. There are 3 of
+# A folder where some of the difficult-to-translate-to-ReST tables are. There are 4 of
# them up to now, for various reasons:
# 1. The wx.Sizer flags table is a grid table, very difficult to ReSTify automatically
# 2. The wx.ColourDatabase table of colour comes up all messy when ReSTified from XML
# 3. The "wxWidgets 2.8 Compatibility Functions" table for wx.VScrolledWindow
+# 4. The wx.ArtProvider table
TABLEROOT = os.path.join(SPHINXROOT, 'rest_substitutions', 'tables')
# Folder where to save the inheritance diagrams for the classes
diff --git a/sphinxtools/inheritance.py b/sphinxtools/inheritance.py
index a1e15ead..c33354ab 100644
--- a/sphinxtools/inheritance.py
+++ b/sphinxtools/inheritance.py
@@ -13,17 +13,23 @@
# Standard library imports
import os
+import sys
import errno
from subprocess import Popen, PIPE
# Phoenix-specific imports
-from utilities import Wx2Sphinx, FormatExternalLink
-from constants import INHERITANCEROOT
+from .utilities import Wx2Sphinx, FormatExternalLink
+from .constants import INHERITANCEROOT
ENOENT = getattr(errno, 'ENOENT', 0)
EPIPE = getattr(errno, 'EPIPE', 0)
+if sys.version_info < (3, ):
+ string_base = basestring
+else:
+ string_base = str
+
class InheritanceDiagram(object):
"""
@@ -36,7 +42,7 @@ class InheritanceDiagram(object):
if main_class is None:
self.class_info, self.specials = classes
- self.class_info = self.class_info.values()
+ self.class_info = list(self.class_info.values())
else:
self.class_info, self.specials = self._class_info(classes)
@@ -69,7 +75,7 @@ class InheritanceDiagram(object):
recurse(cls)
specials.append(self.class_name(cls)[1])
- return all_classes.values(), specials
+ return list(all_classes.values()), specials
def class_name(self, cls):
@@ -117,10 +123,10 @@ class InheritanceDiagram(object):
}
def _format_node_attrs(self, attrs):
- return ','.join(['%s=%s' % x for x in attrs.items()])
+ return ','.join(['%s=%s' % x for x in list(attrs.items())])
def _format_graph_attrs(self, attrs):
- return ''.join(['%s=%s;\n' % x for x in attrs.items()])
+ return ''.join(['%s=%s;\n' % x for x in list(attrs.items())])
def generate_dot(self, class_summary, name="dummy", graph_attrs={}, node_attrs={}, edge_attrs={}):
"""Generate a graphviz dot graph from the classes that were passed in
@@ -240,7 +246,7 @@ class InheritanceDiagram(object):
code = self.generate_dot(class_summary)
# graphviz expects UTF-8 by default
- if isinstance(code, unicode):
+ if isinstance(code, string_base):
code = code.encode('utf-8')
dot_args = ['dot']
@@ -257,19 +263,19 @@ class InheritanceDiagram(object):
p = Popen(dot_args, stdout=PIPE, stdin=PIPE, stderr=PIPE)
- except OSError, err:
+ except OSError as err:
if err.errno != ENOENT: # No such file or directory
raise
- print '\nERROR: Graphviz command `dot` cannot be run (needed for Graphviz output), check your ``PATH`` setting'
+ print('\nERROR: Graphviz command `dot` cannot be run (needed for Graphviz output), check your ``PATH`` setting')
try:
# Graphviz may close standard input when an error occurs,
# resulting in a broken pipe on communicate()
stdout, stderr = p.communicate(code)
- except OSError, err:
+ except OSError as err:
# in this case, read the standard output and standard error streams
# directly, to get the error message(s)
@@ -277,7 +283,7 @@ class InheritanceDiagram(object):
p.wait()
if p.returncode != 0:
- print '\nERROR: Graphviz `dot` command exited with error:\n[stderr]\n%s\n[stdout]\n%s\n\n' % (stderr, stdout)
+ print(('\nERROR: Graphviz `dot` command exited with error:\n[stderr]\n%s\n[stdout]\n%s\n\n' % (stderr, stdout)))
fid = open(mapfile, 'rt')
map = fid.read()
diff --git a/sphinxtools/librarydescription.py b/sphinxtools/librarydescription.py
index 797c4e4f..3047d747 100644
--- a/sphinxtools/librarydescription.py
+++ b/sphinxtools/librarydescription.py
@@ -2,21 +2,25 @@ import sys
import os
import operator
import re
-import cPickle
-from StringIO import StringIO
+if sys.version_info < (3,):
+ import cPickle as pickle
+ from StringIO import StringIO
+else:
+ import pickle
+ from io import StringIO
from inspect import getmro, getclasstree, getdoc, getcomments
-from utilities import MakeSummary, ChopDescription, WriteSphinxOutput
-from utilities import FindControlImages, FormatExternalLink
-from constants import object_types, MODULE_TO_ICON, DOXY_2_REST, SPHINXROOT
-import templates
+from .utilities import MakeSummary, ChopDescription, WriteSphinxOutput
+from .utilities import FindControlImages, FormatExternalLink, IsPython3
+from .constants import object_types, MODULE_TO_ICON, DOXY_2_REST, SPHINXROOT
+from . import templates
EPYDOC_PATTERN = re.compile(r'\S+{\S+}', re.DOTALL)
reload(sys)
-sys.setdefaultencoding("utf-8")
+sys.setdefaultencoding('utf-8')
def make_class_tree(tree):
@@ -271,8 +275,8 @@ class ParentBase(object):
self.name = name
self.kind = kind
- self.docs = u''
- self.comments = u''
+ self.docs = ''
+ self.comments = ''
self.is_redundant = False
@@ -281,7 +285,7 @@ class ParentBase(object):
def Add(self, klass):
- if u'lambda' in klass.name:
+ if 'lambda' in klass.name:
return
for child in self.children:
@@ -297,13 +301,13 @@ class ParentBase(object):
if self.GetShortName().startswith('__test') or '.extern.' in self.name:
self.is_redundant = True
- self.children = sorted(self.children, key=lambda k: (getattr(k, "order"), getattr(k, "name").lower()))
+ self.children = sorted(self.children, key=lambda k: (getattr(k, 'order'), getattr(k, 'name').lower()))
if self.docs is None:
- self.docs = u''
+ self.docs = ''
if self.comments is None or not self.comments.strip():
- self.comments = u''
+ self.comments = ''
for child in self.children:
child.Save()
@@ -321,7 +325,7 @@ class ParentBase(object):
def GetShortName(self):
- return self.name.split(".")[-1]
+ return self.name.split('.')[-1]
def GetObject(self):
@@ -349,7 +353,7 @@ class ParentBase(object):
total = count
- for n in xrange(count):
+ for n in range(count):
total += self.children[n].GetChildrenCount()
return total
@@ -396,10 +400,10 @@ class Library(ParentBase):
ParentBase.__init__(self, name, object_types.LIBRARY)
self.parent = None
- self.filename = u''
+ self.filename = ''
self.order = 0
- self.obj_type = u"Library"
- self.python_version = u''
+ self.obj_type = 'Library'
+ self.python_version = ''
self.sphinx_file = MakeSphinxFile(name)
self.base_name = name
@@ -478,7 +482,7 @@ class Library(ParentBase):
def ToRest(self, class_summary):
- print '\n\nReST-ifying %s...\n\n'%self.base_name
+ print(('\n\nReST-ifying %s...\n\n'%self.base_name))
stream = StringIO()
header = templates.TEMPLATE_DESCRIPTION%(self.base_name, self.base_name)
@@ -526,14 +530,14 @@ class Library(ParentBase):
if os.path.isfile(pickle_file):
fid = open(pickle_file, 'rb')
- items = cPickle.load(fid)
+ items = pickle.load(fid)
fid.close()
else:
items = {}
items.update(class_dict)
fid = open(pickle_file, 'wb')
- cPickle.dump(items, fid)
+ pickle.dump(items, fid)
fid.close()
@@ -543,11 +547,11 @@ class Module(ParentBase):
ParentBase.__init__(self, name, kind)
- self.filename = u''
+ self.filename = ''
self.sphinx_file = MakeSphinxFile(name)
if kind == object_types.PACKAGE:
- self.obj_type = u"Package"
+ self.obj_type = 'Package'
self.order = kind
return
@@ -588,14 +592,14 @@ class Module(ParentBase):
spacer = ' '*self.name.count('.')
if self.kind != object_types.PACKAGE:
- print '%s - %s (module)'%(spacer, self.name)
+ print(('%s - %s (module)'%(spacer, self.name)))
if self.inheritance_diagram:
png, map = self.inheritance_diagram.MakeInheritanceDiagram(class_summary)
short_name = self.GetShortName()
image_desc = templates.TEMPLATE_INHERITANCE % ('module', short_name, png, short_name, map)
stream.write(image_desc)
else:
- print '%s - %s (package)'%(spacer, self.name)
+ print(('%s - %s (package)'%(spacer, self.name)))
generic_summary(self, stream)
@@ -645,10 +649,10 @@ class Class(ParentBase):
for item in sups:
item = repr(item)
- sup = item.replace("", "").replace("', '').replace(' commaPos:
break
- description += " " + line.strip()
+ description += ' ' + line.strip()
- if "):" in line or ") :" in line or ") :" in line:
+ if '):' in line or ') :' in line or ') :' in line:
break
return description
@@ -207,17 +215,19 @@ def inspect_source(method_class, obj, source):
method_class.arguments = param_tuple
method_class.signature = description.strip()
- if "classmethod " in description or is_classmethod(obj):
+ if 'classmethod ' in description or is_classmethod(obj):
method_class.kind = object_types.CLASS_METHOD
- elif "staticmethod " in description:
+ elif 'staticmethod ' in description:
method_class.kind = object_types.STATIC_METHOD
def is_classmethod(instancemethod):
- " Determine if an instancemethod is a classmethod. "
+ """ Determine if an instancemethod is a classmethod. """
- if hasattr(instancemethod, 'im_self'):
- return instancemethod.im_self is not None
+ attribute = (IsPython3() and ['__self__'] or ['im_self'] )[0]
+
+ if hasattr(instancemethod, attribute):
+ return getattr(instancemethod, attribute) is not None
return False
@@ -235,10 +245,10 @@ def describe_func(obj, parent_class, module_name):
# Funny comtypes...
return
- if name.startswith("_") and "__init__" not in name:
+ if name.startswith('_') and '__init__' not in name:
return
- name = parent_class.name + "." + name
+ name = parent_class.name + '.' + name
docs = getdoc(obj)
comments = getcomments(obj)
@@ -256,7 +266,7 @@ def describe_func(obj, parent_class, module_name):
try:
source_code = getsource(obj)
except (IOError, TypeError):
- source_code = ""
+ source_code = ''
klass = Method(name, method)
klass.docs = docs
@@ -267,23 +277,32 @@ def describe_func(obj, parent_class, module_name):
if source_code:
inspect_source(klass, obj, source_code)
- klass.number_lines = "%d"%len(source_code.split("\n"))
+ klass.number_lines = '%d'%len(source_code.split('\n'))
if isinstance(obj, staticmethod):
klass.method = method = object_types.STATIC_METHOD
try:
if method in [object_types.METHOD, object_types.METHOD_DESCRIPTOR, object_types.INSTANCE_METHOD]:
- code = obj.im_func.func_code
+ if IsPython3():
+ code = obj.__func__.__code__
+ else:
+ code = obj.im_func.func_code
elif method == object_types.STATIC_METHOD:
- code = obj.im_func.func_code
+ if IsPython3():
+ code = obj.__func__.__code__
+ else:
+ code = obj.im_func.func_code
else:
- code = obj.func_code
+ if IsPython3():
+ obj.__code__
+ else:
+ code = obj.func_code
except AttributeError:
code = None
if code is not None:
- klass.firstlineno = "%d"%code.co_firstlineno
+ klass.firstlineno = '%d'%code.co_firstlineno
parent_class.Add(klass)
@@ -296,10 +315,10 @@ def describe_class(obj, module_class, module_name, constants):
class_name = obj.__name__
- if class_name == "object":
+ if class_name == 'object':
return
- class_name = module_class.name + "." + class_name
+ class_name = module_class.name + '.' + class_name
docs = getdoc(obj)
comments = getcomments(obj)
@@ -312,7 +331,7 @@ def describe_class(obj, module_class, module_name, constants):
for name in obj_dict:
- if name.startswith("_") and "__init__" not in name:
+ if name.startswith('_') and '__init__' not in name:
continue
if name in EXCLUDED_ATTRS:
@@ -340,7 +359,7 @@ def describe_class(obj, module_class, module_name, constants):
count += 1
describe_class(item, klass, module_name, constants)
else:
- name = class_name + "." + name
+ name = class_name + '.' + name
if isinstance(item, property):
item_class = Property(name, item)
klass.Add(item_class)
@@ -372,7 +391,7 @@ def describe_class(obj, module_class, module_name, constants):
try:
source_code = getsource(obj)
except (IOError, TypeError):
- source_code = ""
+ source_code = ''
if source_code:
description = get_constructor(source_code)
@@ -380,7 +399,7 @@ def describe_class(obj, module_class, module_name, constants):
description = description[0:description.index(':')]
klass.signature = description.strip()
- klass.number_lines = '%d'%len(source_code.split("\n"))
+ klass.number_lines = '%d'%len(source_code.split('\n'))
def describe_module(module, kind, constants=[]):
@@ -431,7 +450,7 @@ def describe_module(module, kind, constants=[]):
count +=1
describe_func(obj, klass, module_name)
else:
- attribute = Attribute(module_name + "." + name, type(obj), obj)
+ attribute = Attribute(module_name + '.' + name, type(obj), obj)
klass.Add(attribute)
if constants:
@@ -463,8 +482,7 @@ def Import(init_name, import_name, full_process=True):
except (ImportError, NameError):
message = format_traceback()
- message += ' Please check that the "Import command" text box is correctly filled'
- print "Error: %s"%message
+ print(('Error: %s'%message))
if not full_process:
sys.path = path[:]
@@ -482,10 +500,10 @@ def Import(init_name, import_name, full_process=True):
try:
version = mainmod.__VERSION__
except AttributeError:
- print "Warning: Library '%s' has no __version__ or __VERSION__ attribute. Please specify it in the 'Import command' textbox"%import_name
+ print(('Warning: Library "%s" has no __version__ or __VERSION__ attribute.'%import_name))
return
- print version
+ print(version)
return mainmod
@@ -494,9 +512,9 @@ def PrintProgress(name, looped_names):
looped_names.append(name)
if len(looped_names) == 4:
- message = ", ".join(looped_names)
+ message = ', '.join(looped_names)
looped_names = []
- print message
+ print(message)
return looped_names
@@ -517,7 +535,7 @@ def SubImport(import_string, module, parent_class, ispkg):
except:
# pubsub and Editra can be funny sometimes...
message = "Unable to import module/package '%s.%s'.\n Exception was: %s"%(import_string, module, format_traceback())
- print "\nWARNING: %s\n"%message
+ print(('\nWARNING: %s\n'%message))
return None, 0
if not ismodule(submod):
@@ -538,12 +556,12 @@ def SubImport(import_string, module, parent_class, ispkg):
if kind in [object_types.PY_MODULE, object_types.PACKAGE]:
- contents = open(filename, "rt").read()
+ contents = open(filename, 'rt').read()
consts = CONSTANT_RE.findall(contents)
for c in consts:
- if "," in c:
- c = c.split(",")
+ if ',' in c:
+ c = c.split(',')
constants.extend([v.strip() for v in c])
else:
constants.append(c.strip())
@@ -560,11 +578,11 @@ def ToRest(import_name):
pickle_file = os.path.join(sphinxDir, 'wx%s.pkl'%import_name)
fid = open(pickle_file, 'rb')
- library_class = cPickle.load(fid)
+ library_class = pickle.load(fid)
fid.close()
fid = open(os.path.join(sphinxDir, 'class_summary.lst'), 'rb')
- class_summary = cPickle.load(fid)
+ class_summary = pickle.load(fid)
fid.close()
library_class.Walk(library_class, class_summary)
@@ -592,33 +610,33 @@ def ModuleHunter(init_name, import_name, version):
return
message = "Importing main library '%s'..."%import_name
- print "Message: %s"%message
+ print(('Message: %s'%message))
- module_name = os.path.splitext(getfile(mainmod))[0] + ".py"
- contents = open(module_name, "rt").read()
+ module_name = os.path.splitext(getfile(mainmod))[0] + '.py'
+ contents = open(module_name, 'rt').read()
constants = CONSTANT_RE.findall(contents)
library_class, count = describe_module(mainmod, kind=object_types.LIBRARY, constants=constants)
- library_class.name = "%s-%s"%(import_name, version)
+ library_class.name = '%s-%s'%(import_name, version)
message = "Main library '%s' imported..."%library_class.name
- print "Message: %s"%message
+ print(('Message: %s'%message))
message = "Importing sub-modules and sub-packages...\n"
- print "Message: %s"%message
+ print(('Message: %s'%message))
looped_names = []
ancestors_dict = {import_name: library_class}
for importer, module_name, ispkg in pkgutil.walk_packages(path=[directory],
- prefix=import_name+".",
+ prefix=import_name+'.',
onerror=lambda x: None):
import_string = module_name
- splitted = module_name.split(".")
+ splitted = module_name.split('.')
fromlist = splitted[-1]
- parent_name = ".".join(splitted[0:-1])
+ parent_name = '.'.join(splitted[0:-1])
parent_class = ancestors_dict[parent_name]
module_class, count = SubImport(import_string, fromlist, parent_class, ispkg)
@@ -632,7 +650,7 @@ def ModuleHunter(init_name, import_name, version):
ancestors_dict[module_name] = module_class
major, minor, micro, release = sys.version_info[0:-1]
- pythonVersion = u"%d.%d.%d-%s"%(major, minor, micro, release)
+ pythonVersion = '%d.%d.%d-%s'%(major, minor, micro, release)
library_class.python_version = pythonVersion
library_class.Save()
@@ -640,13 +658,13 @@ def ModuleHunter(init_name, import_name, version):
sys.path[:] = path # restore
fid = open(pickle_file, 'wb')
- cPickle.dump(library_class, fid)
+ pickle.dump(library_class, fid)
fid.close()
ToRest(import_name)
-if __name__ == "__main__":
+if __name__ == '__main__':
argv = sys.argv[1:]
diff --git a/sphinxtools/postprocess.py b/sphinxtools/postprocess.py
index 81b7c106..3f4adb03 100644
--- a/sphinxtools/postprocess.py
+++ b/sphinxtools/postprocess.py
@@ -12,19 +12,24 @@
# Standard library imports
import os
+import sys
import re
-import cPickle
import glob
import random
import subprocess
+if sys.version_info < (3,):
+ import cPickle as pickle
+else:
+ import pickle
+
# Phoenix-specific imports
-import templates
from buildtools.config import copyIfNewer, writeIfChanged, newer, getSvnRev, textfile_open
-from utilities import Wx2Sphinx
-from constants import HTML_REPLACE, TODAY, SPHINXROOT, SECTIONS_EXCLUDE
-from constants import CONSTANT_INSTANCES, WIDGETS_IMAGES_ROOT, SPHINX_IMAGES_ROOT
+from . import templates
+from .utilities import Wx2Sphinx
+from .constants import HTML_REPLACE, TODAY, SPHINXROOT, SECTIONS_EXCLUDE
+from .constants import CONSTANT_INSTANCES, WIDGETS_IMAGES_ROOT, SPHINX_IMAGES_ROOT
def MakeHeadings():
@@ -94,7 +99,7 @@ def BuildEnumsAndMethods(sphinxDir):
"""
fid = open(os.path.join(sphinxDir, 'class_summary.lst'), 'rb')
- class_summary = cPickle.load(fid)
+ class_summary = pickle.load(fid)
fid.close()
unreferenced_classes = {}
@@ -116,7 +121,7 @@ def BuildEnumsAndMethods(sphinxDir):
orig_text = text = fid.read()
fid.close()
- for old, new in enum_dict.items():
+ for old, new in list(enum_dict.items()):
text = text.replace(old, new)
widget_name = os.path.split(os.path.splitext(input)[0])[1]
@@ -144,6 +149,7 @@ def BuildEnumsAndMethods(sphinxDir):
text = text.replace('wx.``', '``')
text = text.replace('non-NULL', 'not ``None``')
text = text.replace(',,', ',').replace(', ,', ',')
+ text = text.replace('|wx', '|')
if 'DocstringsGuidelines' not in input:
# Leave the DocstringsGuidelines.txt file alone on these ones
@@ -182,7 +188,7 @@ def BuildEnumsAndMethods(sphinxDir):
'the text file "unreferenced_classes.inc" together with the ReST file names where they\n' \
'appear.\n\n'
- keys = unreferenced_classes.keys()
+ keys = list(unreferenced_classes.keys())
keys.sort()
fid = textfile_open(os.path.join(SPHINXROOT, 'unreferenced_classes.inc'), 'wt')
@@ -197,7 +203,7 @@ def BuildEnumsAndMethods(sphinxDir):
fid.write('='*50 + ' ' + '='*50 + '\n')
fid.close()
- print warn%(len(keys))
+ print((warn%(len(keys))))
# ----------------------------------------------------------------------- #
@@ -319,7 +325,7 @@ def ReformatFunctions(file):
return
fid = open(file, 'rb')
- functions = cPickle.load(fid)
+ functions = pickle.load(fid)
fid.close()
if local_file.count('.') == 1:
@@ -328,7 +334,7 @@ def ReformatFunctions(file):
else:
label = local_file.split('.')[0:-2][0]
- names = functions.keys()
+ names = list(functions.keys())
names = [name.lower() for name in names]
names.sort()
@@ -343,7 +349,7 @@ def ReformatFunctions(file):
text += ' | '.join([':ref:`%s <%s %s>`'%(letter, label, letter) for letter in letters])
text += '\n\n\n'
- names = functions.keys()
+ names = list(functions.keys())
names = sorted(names, key=str.lower)
for letter in letters:
@@ -374,7 +380,7 @@ def MakeClassIndex(sphinxDir, file):
return
fid = open(file, 'rb')
- classes = cPickle.load(fid)
+ classes = pickle.load(fid)
fid.close()
if local_file.count('.') == 1:
@@ -390,7 +396,7 @@ def MakeClassIndex(sphinxDir, file):
enum_files = glob.glob(sphinxDir + '/%s*.enumeration.txt'%module)
enum_base = [os.path.split(os.path.splitext(enum)[0])[1] for enum in enum_files]
- names = classes.keys()
+ names = list(classes.keys())
names.sort()
text = ''
@@ -466,7 +472,7 @@ def GenGallery():
possible = possible.lower()
html_files[possible + '.png'] = simple + '.html'
- keys = html_files.keys()
+ keys = list(html_files.keys())
keys.sort()
text = ''
@@ -475,7 +481,7 @@ def GenGallery():
possible_png = key
html = html_files[possible_png]
- rand_list = range(3)
+ rand_list = list(range(3))
random.shuffle(rand_list)
for plat_index in rand_list:
@@ -647,7 +653,7 @@ def PostProcess(folder):
newtext += line + '\n'
- for old, new in enum_dict.items():
+ for old, new in list(enum_dict.items()):
newtext = newtext.replace(old, new)
newtext = AddJavaScript(newtext)
diff --git a/sphinxtools/utilities.py b/sphinxtools/utilities.py
index cd5b7ebc..2545563b 100644
--- a/sphinxtools/utilities.py
+++ b/sphinxtools/utilities.py
@@ -15,18 +15,25 @@ import sys
import os
import codecs
import shutil
+import glob
+import imp
+
if sys.version_info < (3,):
import cPickle as pickle
from UserDict import UserDict
+ string_base = basestring
else:
import pickle
from collections import UserDict
+ string_base = str
# Phoenix-specific imports
+from buildtools.config import phoenixDir
+
from .templates import TEMPLATE_CONTRIB
-from .constants import IGNORE, PUNCTUATION
-from .constants import CPP_ITEMS, VERSION, VALUE_MAP
+from .constants import IGNORE, PUNCTUATION, MODULENAME_REPLACE
+from .constants import CPP_ITEMS, VERSION, VALUE_MAP, NO_MODULE
from .constants import RE_KEEP_SPACES, EXTERN_INHERITANCE
from .constants import DOXYROOT, SPHINXROOT, WIDGETS_IMAGES_ROOT
@@ -67,7 +74,7 @@ class odict(UserDict):
return dict
def items(self):
- return zip(self._keys, self.values())
+ return list(zip(self._keys, list(self.values())))
def keys(self):
return self._keys
@@ -89,11 +96,11 @@ class odict(UserDict):
def update(self, dict):
UserDict.update(self, dict)
- for key in dict.keys():
+ for key in list(dict.keys()):
if key not in self._keys: self._keys.append(key)
def values(self):
- return map(self.get, self._keys)
+ return list(map(self.get, self._keys))
# ----------------------------------------------------------------------- #
@@ -417,7 +424,7 @@ def FindControlImages(elementOrString):
"""
- if isinstance(elementOrString, basestring):
+ if isinstance(elementOrString, string_base):
class_name = py_class_name = elementOrString.lower()
else:
element = elementOrString
@@ -456,14 +463,14 @@ def FindControlImages(elementOrString):
appearance[sub_folder] = py_png_file
- if not any(appearance.values()):
+ if not any(list(appearance.values())):
return []
- for sub_folder, image in appearance.items():
+ for sub_folder, image in list(appearance.items()):
if not image:
appearance[sub_folder] = '../no_appearance.png'
- return appearance.values()
+ return list(appearance.values())
# ----------------------------------------------------------------------- #
@@ -627,6 +634,35 @@ def PickleClassInfo(class_name, element, short_description):
# ----------------------------------------------------------------------- #
+
+global ALL_ITEMS
+ALL_ITEMS = {}
+
+def Class2Module():
+
+ global ALL_ITEMS
+
+ if ALL_ITEMS:
+ return ALL_ITEMS
+
+ etg_files = glob.glob(os.path.join(phoenixDir(), 'etg') + '/*.py')
+ etg_files = [files for files in etg_files if not files.startswith('_')]
+
+ for files in etg_files:
+ split = os.path.split(os.path.splitext(files)[0])[1]
+ module = imp.load_source(split, files)
+
+ current_module = MODULENAME_REPLACE.get(module.MODULE, '')
+
+ for item in module.ITEMS:
+
+ item = RemoveWxPrefix(item)
+ ALL_ITEMS[item] = current_module
+
+ ALL_ITEMS.update(NO_MODULE)
+
+ return ALL_ITEMS
+
def Wx2Sphinx(name):
"""
@@ -636,13 +672,22 @@ def Wx2Sphinx(name):
"""
if '<' in name:
- name = name[0:name.index('<')].strip()
+ name = name[0:name.index('<')]
+ name = name.strip()
newname = fullname = RemoveWxPrefix(name)
- if 'DataView' in name:
- fullname = 'dataview.' + fullname
+ if '.' in newname:
+ lookup, remainder = newname.split('.')
+ remainder = '.%s'%remainder
+ else:
+ lookup = newname
+ remainder = ''
+ all_items = Class2Module()
+ if lookup in all_items:
+ fullname = all_items[lookup] + lookup + remainder
+
return newname, fullname
@@ -759,3 +804,9 @@ def FormatExternalLink(fullname, inheritance=False):
return full_page
+
+def IsPython3():
+ """ Returns ``True`` if we are using Python 3.x. """
+
+ return sys.version_info >= (3, )
+
|