mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 03:50:06 +01:00
Phoenix docs: handle funny-formatted heading sections for window styles, extra styles and event handling; Add missing modules in the main.html Sphinx file; Convert some more snippets, specifying the highlight language used (XML/HTML for some snippets in wx.html); Correctly reference classes and functions in wx.Bitmap pure-Python methods.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73069 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -68,6 +68,9 @@
|
||||
<p class="biglink"><a class="biglink" href="{{ pathto("html.1classindex") }}">wx.html</a><br/>
|
||||
<span class="linkdescr">Widget and supporting classes for a generic html renderer</span></p>
|
||||
|
||||
<p class="biglink"><a class="biglink" href="{{ pathto("html2.1classindex") }}">wx.html2</a><br/>
|
||||
<span class="linkdescr">Widget and supporting classes to render web (HTML / CSS / javascript) documents</span></p>
|
||||
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p class="biglink"><a class="biglink" href="{{ pathto("lib") }}">wx.lib</a><br/>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# .. code-block:: text
|
||||
|
||||
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
|
||||
|
|
||||
@@ -1,3 +1,4 @@
|
||||
# .. code-block:: text
|
||||
|
||||
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
|
||||
|
|
||||
@@ -1,3 +1,4 @@
|
||||
# .. code-block:: text
|
||||
|
||||
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
|
||||
|
|
||||
@@ -174,7 +174,7 @@ def run():
|
||||
c.addCppMethod('void', 'CopyToBuffer',
|
||||
'(wxPyBuffer* data, wxBitmapBufferFormat format=wxBitmapBufferFormat_RGB, int stride=-1)',
|
||||
doc="""\
|
||||
Copy pixel data to a buffer object. See `CopyFromBuffer` for buffer
|
||||
Copy pixel data to a buffer object. See :meth:`CopyFromBuffer` for buffer
|
||||
format details.""",
|
||||
body="""\
|
||||
wxPyCopyBitmapToBuffer(self, (byte*)data->m_ptr, data->m_len, format, stride);
|
||||
@@ -188,7 +188,7 @@ def run():
|
||||
isStatic=True,
|
||||
factory=True,
|
||||
doc="""\
|
||||
Creates a `wx.Bitmap` from in-memory data. The data and alpha
|
||||
Creates a :class:`Bitmap` from in-memory data. The data and alpha
|
||||
parameters must be a Python object that implements the buffer
|
||||
interface, such as a string, bytearray, etc. The data object
|
||||
is expected to contain a series of RGB bytes and be at least
|
||||
@@ -198,7 +198,7 @@ def run():
|
||||
'premultiplied' by the alpha values. (The other platforms do
|
||||
the multiplication themselves.)
|
||||
|
||||
Unlike `wx.ImageFromBuffer` the bitmap created with this function
|
||||
Unlike :func:`ImageFromBuffer` the bitmap created with this function
|
||||
does not share the memory block with the buffer object. This is
|
||||
because the native pixel buffer format varies on different
|
||||
platforms, and so instead an efficient as possible copy of the
|
||||
@@ -240,12 +240,12 @@ def run():
|
||||
isStatic=True,
|
||||
factory=True,
|
||||
doc="""\
|
||||
Creates a `wx.Bitmap` from in-memory data. The data parameter
|
||||
Creates a :class:`Bitmap` from in-memory data. The data parameter
|
||||
must be a Python object that implements the buffer interface, such
|
||||
as a string, bytearray, etc. The data object is expected to contain
|
||||
a series of RGB bytes and be at least width*height*3 bytes long.
|
||||
|
||||
Unlike `wx.ImageFromBuffer` the bitmap created with this function
|
||||
Unlike :func:`ImageFromBuffer` the bitmap created with this function
|
||||
does not share the memory block with the buffer object. This is
|
||||
because the native pixel buffer format varies on different
|
||||
platforms, and so instead an efficient as possible copy of the
|
||||
@@ -280,14 +280,14 @@ def run():
|
||||
isStatic=True,
|
||||
factory=True,
|
||||
doc="""\
|
||||
Creates a `wx.Bitmap` from in-memory data. The data parameter
|
||||
Creates a :class:`Bitmap` from in-memory data. The data parameter
|
||||
must be a Python object that implements the buffer interface, such
|
||||
as a string, bytearray, etc. The data object is expected to contain
|
||||
a series of RGBA bytes and be at least width*height*4 bytes long.
|
||||
On Windows and Mac the RGB values will be 'premultiplied' by the
|
||||
alpha values. (The other platforms do the multiplication themselves.)
|
||||
|
||||
Unlike `wx.ImageFromBuffer` the bitmap created with this function
|
||||
Unlike :func:`ImageFromBuffer` the bitmap created with this function
|
||||
does not share the memory block with the buffer object. This is
|
||||
because the native pixel buffer format varies on different
|
||||
platforms, and so instead an efficient as possible copy of the
|
||||
@@ -318,7 +318,7 @@ def run():
|
||||
isStatic=True,
|
||||
factory=True,
|
||||
doc="""\
|
||||
Creates a new empty 32-bit `wx.Bitmap` where every pixel has been
|
||||
Creates a new empty 32-bit :class:`Bitmap` where every pixel has been
|
||||
initialized with the given RGBA values.
|
||||
""",
|
||||
body="""\
|
||||
|
||||
@@ -67,7 +67,7 @@ def run():
|
||||
wxVector<wxSharedPtr<wxWebViewHistoryItem> > vector = self->{method}();
|
||||
for (size_t idx=0; idx < vector.size(); idx++) {{
|
||||
PyObject* obj;
|
||||
wxWebViewHistoryItem* item = new wxWebViewHistoryItem(*vector[idx].get());
|
||||
wxWebViewHistoryItem* item = new wxWebViewHistoryItem(*vector[idx].get())
|
||||
obj = wxPyConstructObject((void*)item, "wxWebViewHistoryItem", true);
|
||||
PyList_Append(result, obj);
|
||||
Py_DECREF(obj);
|
||||
|
||||
@@ -1431,8 +1431,9 @@ class Snippet(Node):
|
||||
|
||||
if highlight:
|
||||
docstrings += '\n\n%s\n\n'%highlight
|
||||
|
||||
else:
|
||||
docstrings += '::\n\n'
|
||||
|
||||
docstrings += code.rstrip() + '\n\n'
|
||||
|
||||
if self.element.tail and len(self.element.tail.strip()) > 1:
|
||||
@@ -2676,7 +2677,7 @@ class XMLDocString(object):
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
def EventsInStyle(self, line, class_name, added=False):
|
||||
def EventsInStyle(self, line, class_name, added):
|
||||
|
||||
docstrings = ''
|
||||
newline = line
|
||||
@@ -2688,19 +2689,28 @@ class XMLDocString(object):
|
||||
docstrings += templates.TEMPLATE_WINDOW_STYLES % class_name
|
||||
|
||||
elif 'The following event handler macros' in line and not added:
|
||||
last = line.index(':')
|
||||
line = line[last+1:].strip()
|
||||
index = line.index('The following event handler macros')
|
||||
newline1 = line[0:index] + '\n\n'
|
||||
macro_line = line[index:]
|
||||
last = macro_line.index(':')
|
||||
line = macro_line[last+1:].strip()
|
||||
|
||||
if line.count(':') > 2:
|
||||
newline = 'Handlers bound for the following event types will receive one of the %s parameters.'%line
|
||||
else:
|
||||
newline = 'Handlers bound for the following event types will receive a %s parameter.'%line
|
||||
|
||||
docstrings += templates.TEMPLATE_EVENTS % class_name
|
||||
docstrings += newline1 + templates.TEMPLATE_EVENTS % class_name
|
||||
docstrings = docstrings.replace('Event macros for events emitted by this class: ', '')
|
||||
newline = newline.replace('Event macros for events emitted by this class: ', '')
|
||||
added = True
|
||||
|
||||
elif 'Event macros for events' in line and not added:
|
||||
elif 'Event macros for events' in line:
|
||||
if added:
|
||||
newline = ''
|
||||
else:
|
||||
docstrings += templates.TEMPLATE_EVENTS % class_name
|
||||
|
||||
added = True
|
||||
|
||||
elif 'following extra styles:' in line:
|
||||
@@ -2741,6 +2751,7 @@ class XMLDocString(object):
|
||||
for line in item.splitlines():
|
||||
if line.strip():
|
||||
newdocs, newline, added = self.EventsInStyle(line, class_name, added)
|
||||
if newline.strip():
|
||||
docstrings += newdocs
|
||||
docstrings += spacer + newline + '\n'
|
||||
else:
|
||||
@@ -2802,6 +2813,10 @@ class XMLDocString(object):
|
||||
|
||||
docstrings += '%s**~~~**\n\n'%spacer
|
||||
|
||||
if '**Perl Note:**' in docstrings:
|
||||
index = docstrings.index('**Perl Note:**')
|
||||
docstrings = docstrings[0:index]
|
||||
|
||||
stream.write(docstrings + "\n\n")
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ from buildtools.config import phoenixDir, wxDir
|
||||
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', 'SDI', 'TDI', 'URL',
|
||||
'XPM', 'HTML', 'MIME', 'C++', 'XDG', 'A4', 'A5', 'KDE', 'GNOME', 'XFCE']
|
||||
'XPM', 'HTML', 'MIME', 'C++', 'XDG', 'A4', 'A5', 'KDE', 'GNOME', 'XFCE', 'CSS', 'IE', 'FONT',
|
||||
'SIZE', 'COLOR']
|
||||
|
||||
# C++ stuff to Python/ReST stuff
|
||||
VALUE_MAP = {'true': '``True``',
|
||||
@@ -176,7 +177,7 @@ SECTIONS_EXCLUDE = {
|
||||
'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'),
|
||||
'TextCtrl' : ('|phoenix_title| TextCtrl and C++ Streams', '|phoenix_title| Event Handling'),
|
||||
'TextEntry' : ('Notice that you need', 'Currently this method is only '),
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ def BuildEnumsAndMethods(sphinxDir):
|
||||
|
||||
# Replace ArrayXXX stuff...
|
||||
|
||||
for cpp in ['ArrayString()', 'ArrayInt()', 'ArrayDouble()']:
|
||||
for cpp in ['ArrayString()', 'ArrayInt()', 'ArrayDouble()', 'ArrayString']:
|
||||
text = text.replace(cpp, '[]')
|
||||
|
||||
text = TooltipsOnInheritance(text, class_summary)
|
||||
|
||||
@@ -214,6 +214,11 @@ def ReplaceCppItems(line):
|
||||
item = 'float'
|
||||
|
||||
if len(item.replace('``', '')) > 2:
|
||||
if '*' in item:
|
||||
try:
|
||||
eval(item)
|
||||
item = item.replace('*', 'x')
|
||||
except:
|
||||
# Avoid replacing standalone '&&' and similar
|
||||
for cpp in CPP_ITEMS[0:2]:
|
||||
item = item.replace(cpp, '')
|
||||
@@ -283,6 +288,9 @@ def PythonizeType(ptype):
|
||||
if 'Image.' in ptype:
|
||||
ptype = ptype.split('.')[-1]
|
||||
|
||||
if ptype.endswith('&'):
|
||||
ptype = ':class:`%s`'%ptype[0:-1]
|
||||
|
||||
return ptype
|
||||
|
||||
|
||||
@@ -354,6 +362,7 @@ def ConvertToPython(text):
|
||||
if '``' not in newword and '()' not in word and '**' not in word:
|
||||
word = word.replace(newword, "``%s``"%newword)
|
||||
|
||||
word = word.replace('->', '.')
|
||||
newline.append(word)
|
||||
|
||||
newline = spacer + ''.join(newline)
|
||||
|
||||
Reference in New Issue
Block a user