- Update the `sphinx_generator.py` to handle the latest `sashwin.py` and `laywin.py`;
- Remove non-pertinent sections from the wxWidgets docs (stuff talking about cpp/h include files);
- Optimize the handling of enumeration stuff thus reducing the number of unreferenced classes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71609 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Andrea Gavana
2012-05-30 19:06:06 +00:00
parent 45ac7c4273
commit c56045244f
6 changed files with 70 additions and 22 deletions

View File

@@ -25,7 +25,7 @@ wxPython has five variants of this control:
Best Book
---------
:ref:`BookCtrl` is mapped to the class best suited for a given platform. Currently it provides :ref:`Choicebook`
:ref:`BookCtrlBase` is mapped to the class best suited for a given platform. Currently it provides :ref:`Choicebook`
for smartphones equipped with WinCE, and :ref:`Notebook` for all other platforms. The mapping consists of:
=============================================== ==================================================

View File

@@ -52,7 +52,7 @@ List of Reference Counted Classes
The following classes in wxPython have efficient (i.e. fast) assignment operators and copy constructors since they are reference-counted:
- :ref:`AcceleratorTable`
- :ref:`animate.Animation`
- :ref:`adv.Animation`
- :ref:`Bitmap`
- :ref:`Brush`
- :ref:`Cursor`

View File

@@ -136,7 +136,7 @@ be stretched horizontally. The following sample shows the same dialog as in the
StaticBoxSizer
^^^^^^^^^^^^^^
:ref:`StaticBoxSixer` is the same as a :ref:`BoxSizer`, but surrounded by a static box. Here is a sample:
:class:`StaticBoxSixer` is the same as a :class:`BoxSizer`, but surrounded by a static box. Here is a sample:
.. figure:: _static/images/overviews/overview_sizer_09.png
@@ -301,7 +301,7 @@ the width of each field is the width of the widest child, the height of each fie
same height and all fields in one column having the same width, but all rows or all columns are not necessarily the same height or
width as in the :ref:`GridSizer`.
:ref:`StaticBoxSizer` is a sizer derived from :ref:`BoxSizer` but adds a static box around the sizer. Note that this static box
:class:`StaticBoxSizer` is a sizer derived from :ref:`BoxSizer` but adds a static box around the sizer. Note that this static box
has to be created separately.
:ref:`GridBagSizer` is a rather special kind of sizer which, unlike the other classes, allows to directly put the elements at the

View File

@@ -55,7 +55,7 @@ from sphinxtools.utilities import FormatContributedSnippets
from sphinxtools.constants import VERSION, REMOVED_LINKS, SECTIONS
from sphinxtools.constants import MAGIC_METHODS, MODULENAME_REPLACE
from sphinxtools.constants import IGNORE
from sphinxtools.constants import IGNORE, NO_MODULE
from sphinxtools.constants import SPHINXROOT, DOXYROOT
from sphinxtools.constants import SNIPPETROOT, TABLEROOT, OVERVIEW_IMAGES_ROOT
@@ -1534,15 +1534,18 @@ class XRef(Node):
if '(' in stripped:
stripped = stripped[0:stripped.index('(')].strip()
if '.' not in stripped:
klass = self.IsClassDescription()
if klass:
text = ':meth:`~%s.%s`'%(klass, stripped)
if stripped in NO_MODULE:
text = ':ref:`%s`'%(NO_MODULE[stripped] + stripped)
else:
if '.' not in stripped:
klass = self.IsClassDescription()
if klass:
text = ':meth:`~%s.%s`'%(klass, stripped)
else:
text = ':meth:`%s` '%stripped
else:
text = ':meth:`%s` '%stripped
else:
text = ':meth:`%s` '%stripped
else:
text = ':ref:`%s`'%Wx2Sphinx(stripped)[1]
@@ -2423,10 +2426,15 @@ class XMLDocString(object):
new_section = []
for ret in return_section:
if ret[0].isupper():
new_section.append(':ref:`%s`'%ret.strip())
stripped = ret.strip()
if stripped in NO_MODULE:
ret = NO_MODULE[stripped] + stripped
new_section.append(':ref:`%s`'%ret)
else:
new_section.append('`%s`'%ret.strip())
if ret[0].isupper():
new_section.append(':ref:`%s`'%stripped)
else:
new_section.append('`%s`'%stripped)
element = et.Element('return', kind='return')
element.text = '( %s )'%(', '.join(new_section))

View File

@@ -20,10 +20,11 @@ import buildtools.version as version
from buildtools.config import phoenixDir, wxDir
# List of strings that should be ignored when creating inline literals
# such as ``ID_ANY`` or ``HORIZONtAL``, with double backticks
# such as ``ID_ANY`` or ``HORIZONTAL``, with double backticks
IGNORE = ['wxPython', 'wxWidgets', 'wxOSX', 'wxMGL', 'wxDFB', 'wxMAC', 'wxGTK', 'wxGTK2', 'wxUniversal',
'OS', 'X', 'OSX', 'DFB', 'MAC', 'GTK', 'GTK2', 'MSW', 'wxMSW', 'X11', 'OS2', 'MS', 'XP', 'GTK+',
'UI', 'GUI', '--', 'OTOH', 'GDI+', 'API', 'NT', 'RTL', 'GDI', '3D', 'MDI']
'UI', 'GUI', '--', 'OTOH', 'GDI+', 'API', 'NT', 'RTL', 'GDI', '3D', 'MDI', 'SDI', 'TDI', 'URL',
'XPM', 'HTML', 'MIME', 'C++', 'XDG', 'A4', 'A5']
# C++ stuff to Python/ReST stuff
VALUE_MAP = {'true': '``True``',
@@ -72,8 +73,31 @@ MODULENAME_REPLACE = {'_core' : '',
'_adv' : 'adv.',
}
NO_MODULE = {'DatePickerCtrlGeneric': 'adv.',
'GenericCalendarCtrl': 'adv.'}
NO_MODULE = {
# -- wxAdvanced -- #
# Widgets
'DatePickerCtrlGeneric': 'adv.',
'GenericCalendarCtrl' : 'adv.',
# Enums/constants
'AnimationType' : 'adv.',
'CalendarDateBorder' : 'adv.',
'CalendarHitTestResult': 'adv.',
'LayoutAlignment' : 'adv.',
'LayoutOrientation' : 'adv.',
'SashDragStatus' : 'adv.',
'SashEdgePosition' : 'adv.',
'TaskBarIconType' : 'adv.',
# -- wxDataView -- #
# Widgets
# Enums/constants
'DataViewCellMode' : 'dataview.',
'DataViewCellRenderState': 'dataview.',
'DataViewColumnFlags' : 'dataview.',
}
# Other C++ specific things to strip away
CPP_ITEMS = ['*', '&', 'const', 'unsigned', '(size_t)', 'size_t', 'void']
@@ -136,7 +160,15 @@ MAGIC_METHODS = {
# TODO: add more
}
SECTIONS_EXCLUDE = {'TextCtrl': ('|phoenix_title| TextCtrl and ``C++`` Streams', '|phoenix_title| Event Handling')}
SECTIONS_EXCLUDE = {
'ConfigBase' : ('Related Include Files', '|phoenix_title| Example'),
'KeyboardState': ('This class is implemented ', '.. seealso::'),
'Menu' : ('|phoenix_title| Allocation strategy', '|phoenix_title| Event handling'),
'MouseState' : ('This class is implemented', '.. seealso::'),
'Panel' : ('Please see :ref:`/', 'if not all characters'),
'TextCtrl' : ('|phoenix_title| TextCtrl and ``C++`` Streams', '|phoenix_title| Event Handling'),
'TextEntry' : ('Notice that you need', 'Currently this method is only '),
}
# A regex to split a string keeping the whitespaces
RE_KEEP_SPACES = re.compile(r'(\s+)')
@@ -155,7 +187,7 @@ PYTHON_DOCS = 'http://docs.python.org/library/'
NUMPY_DOCS = 'http://docs.scipy.org/doc/numpy/reference/generated/'
EXTERN_INHERITANCE = {'UserDict.' : PYTHON_DOCS,
'ctypes.' : PYTHON_DOCS,
'ctypes.' : PYTHON_DOCS,
'code.' : PYTHON_DOCS,
'exceptions.': PYTHON_DOCS,
'threading.' : PYTHON_DOCS,

View File

@@ -302,13 +302,21 @@ def RemoveUnreferenced(input, class_summary, enum_base, unreferenced_classes, te
# Overview pages
continue
if '.' in reg:
# Sometimes in wxWidgets the enums and structures are reported as
# Class.Enum/Class.Structure, while we only have links to Enum and Structures
possible_enum = reg.split('.')[1]
if possible_enum in enum_base or possible_enum in class_summary:
text = text.replace(':ref:`%s`'%reg, ':ref:`%s`'%possible_enum, 1)
continue
if reg not in unreferenced_classes:
unreferenced_classes[reg] = []
split = os.path.split(input)[1]
if split not in unreferenced_classes[reg]:
unreferenced_classes[reg].append(split)
text = text.replace(':ref:`%s`'%reg, '`%s`'%reg, 1)
return text, unreferenced_classes