mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 09:40:07 +01:00
Phoenix: Revise the way `:param: and :rtype: are handled in sphinx_generator.py so that the module name does not appear in front of the class. Minor cleanups to the docstrings generators. Fixed interlinks in wx.lib.busy.py and wx.lib.softwareupdate.py`.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73137 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -277,8 +277,9 @@ class Node(object):
|
||||
text = (text is not None and [text] or [''])[0]
|
||||
tail = (tail is not None and [tail] or [''])[0]
|
||||
|
||||
if text.strip() in REMOVED_LINKS:
|
||||
return ''
|
||||
for link in REMOVED_LINKS:
|
||||
if link in text.strip():
|
||||
return ''
|
||||
|
||||
text = ConvertToPython(text)
|
||||
|
||||
@@ -730,7 +731,7 @@ class Parameter(Node):
|
||||
self.pdef = pdef
|
||||
self.name = pdef.name
|
||||
|
||||
self.type = PythonizeType(pdef.type)
|
||||
self.type = PythonizeType(pdef.type, is_param=True)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
@@ -2547,7 +2548,7 @@ class XMLDocString(object):
|
||||
|
||||
else:
|
||||
|
||||
rtype = PythonizeType(after)
|
||||
rtype = PythonizeType(after, is_param=False)
|
||||
|
||||
if not rtype:
|
||||
return
|
||||
@@ -3438,7 +3439,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
|
||||
else:
|
||||
|
||||
rtype = PythonizeType(after)
|
||||
rtype = PythonizeType(after, is_param=False)
|
||||
|
||||
if not rtype:
|
||||
return ''
|
||||
|
||||
@@ -691,7 +691,10 @@ def PostProcess(folder):
|
||||
elif stripline == '<dl class="attribute">' and not properties_done:
|
||||
line = '<br><h3>Properties<a class="headerlink" href="#properties" title="Permalink to this headline">¶</a></h3>' + '\n' + line
|
||||
properties_done = True
|
||||
|
||||
|
||||
if '<em> ' in line and '–' in line:
|
||||
line = line.replace('<em> ', '<em>')
|
||||
|
||||
newtext += line + '\n'
|
||||
|
||||
for old, new in list(enum_dict.items()):
|
||||
|
||||
@@ -232,13 +232,15 @@ def ReplaceCppItems(line):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def PythonizeType(ptype):
|
||||
def PythonizeType(ptype, is_param):
|
||||
"""
|
||||
Replaces various C++ specific stuff with more Pythonized version of them,
|
||||
for parameter lists and return types (i.e., the `:param:` and `:rtype:`
|
||||
ReST roles).
|
||||
|
||||
:param string `ptype`: any string.
|
||||
:param string `ptype`: any string;
|
||||
:param bool `is_param`: ``True`` if this is a parameter description, ``False``
|
||||
if it is a return type.
|
||||
|
||||
:rtype: `string`
|
||||
"""
|
||||
@@ -295,7 +297,15 @@ def PythonizeType(ptype):
|
||||
ptype = ptype[0:-1]
|
||||
if ' ' not in ptype:
|
||||
ptype = ':class:`%s`'%ptype
|
||||
|
||||
|
||||
else:
|
||||
if is_param and '.' in ptype:
|
||||
modules = MODULENAME_REPLACE.values()
|
||||
modules.sort()
|
||||
modules = modules[1:]
|
||||
if ptype.split('.')[0] + '.' in modules:
|
||||
ptype = ':ref:`%s`'%ptype
|
||||
|
||||
return ptype
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
"""
|
||||
A class like wx.BusyInfo but which doesn't take up so much space by default
|
||||
A class like :class:`BusyInfo` but which doesn't take up so much space by default
|
||||
and which has a nicer look.
|
||||
"""
|
||||
|
||||
@@ -21,7 +21,7 @@ from wx.lib.stattext import GenStaticText as StaticText
|
||||
|
||||
class BusyInfo(object):
|
||||
"""
|
||||
This class is just like :class:`wx.BusyInfo`, except that its default
|
||||
This class is just like :class:`BusyInfo`, except that its default
|
||||
size is smaller, (unless the size of the message requires a larger window
|
||||
size) and the background and foreground colors of the message box can be
|
||||
set.
|
||||
@@ -29,7 +29,7 @@ class BusyInfo(object):
|
||||
Creating an instace of the class witll create an show a window with the
|
||||
given message, and when the instance is deleted then that window will be
|
||||
closed. This class also implements the context manager magic methods, so
|
||||
it can be used with Python's 'with` statement, like this::
|
||||
it can be used with Python's `with` statement, like this::
|
||||
|
||||
with BusyInfo('Please wait...'):
|
||||
doSomethingThatNeedsWaiting()
|
||||
@@ -38,16 +38,16 @@ class BusyInfo(object):
|
||||
|
||||
def __init__(self, msg, parent=None, bgColour=None, fgColour=None):
|
||||
"""
|
||||
Create a new `BusyInfo`.
|
||||
Create a new :class:`BusyInfo`.
|
||||
|
||||
:param `msg`: a string to be displayed in the BusyInfo window.
|
||||
:param `parent`: an optional window to be used as the parent of
|
||||
the `BusyInfo`. If given then the BusyInfo will be centered
|
||||
:param string `msg`: a string to be displayed in the BusyInfo window.
|
||||
:param Window `parent`: an optional window to be used as the parent of
|
||||
the `:class:`BusyInfo`. If given then the BusyInfo will be centered
|
||||
over that window, otherwise it will be centered on the screen.
|
||||
:param `bgColour`: :class:`Colour` to be used for the background
|
||||
of the `BusyInfo`
|
||||
:param `fgColour`: :class:`Colour` to be used for the foreground (text)
|
||||
of the `BusyInfo`
|
||||
:param Colour `bgColour`: colour to be used for the background
|
||||
of the :class:`BusyInfo`
|
||||
:param Colour `fgColour`: colour to be used for the foreground (text)
|
||||
of the :class:`BusyInfo`
|
||||
"""
|
||||
self.frame = _InfoFrame(parent, msg, bgColour, fgColour)
|
||||
self.frame.Show()
|
||||
@@ -59,7 +59,7 @@ class BusyInfo(object):
|
||||
|
||||
def Close(self):
|
||||
"""
|
||||
Hide and close the busy info box
|
||||
Hide and close the busy info box.
|
||||
"""
|
||||
if self.frame:
|
||||
self.frame.Hide()
|
||||
|
||||
@@ -59,8 +59,8 @@ class UpdateAbortedError(RuntimeError):
|
||||
|
||||
class SoftwareUpdate(object):
|
||||
"""
|
||||
Mix this class with wx.App and call InitForUpdates from the derived class'
|
||||
OnInit method. Be sure that the wx.App has set a display name
|
||||
Mix this class with :class:`App` and call :meth:`InitForUpdates` from the derived class'
|
||||
OnInit method. Be sure that the :class:`App` has set a display name
|
||||
(self.SetAppDisplayName) as that value will be used in the update dialogs.
|
||||
"""
|
||||
|
||||
@@ -100,7 +100,7 @@ class SoftwareUpdate(object):
|
||||
|
||||
def AutoCheckForUpdate(self, frequencyInDays, parentWindow=None, cfg=None):
|
||||
"""
|
||||
If it has been frequencyInDays since the last auto-check then check if
|
||||
If it has been `frequencyInDays` since the last auto-check then check if
|
||||
a software update is available and prompt the user to download and
|
||||
install it. This can be called after a application has started up, and
|
||||
if there is no update available the user will not be bothered.
|
||||
|
||||
Reference in New Issue
Block a user