mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 20:10:08 +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]
|
text = (text is not None and [text] or [''])[0]
|
||||||
tail = (tail is not None and [tail] or [''])[0]
|
tail = (tail is not None and [tail] or [''])[0]
|
||||||
|
|
||||||
if text.strip() in REMOVED_LINKS:
|
for link in REMOVED_LINKS:
|
||||||
return ''
|
if link in text.strip():
|
||||||
|
return ''
|
||||||
|
|
||||||
text = ConvertToPython(text)
|
text = ConvertToPython(text)
|
||||||
|
|
||||||
@@ -730,7 +731,7 @@ class Parameter(Node):
|
|||||||
self.pdef = pdef
|
self.pdef = pdef
|
||||||
self.name = pdef.name
|
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:
|
else:
|
||||||
|
|
||||||
rtype = PythonizeType(after)
|
rtype = PythonizeType(after, is_param=False)
|
||||||
|
|
||||||
if not rtype:
|
if not rtype:
|
||||||
return
|
return
|
||||||
@@ -3438,7 +3439,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
rtype = PythonizeType(after)
|
rtype = PythonizeType(after, is_param=False)
|
||||||
|
|
||||||
if not rtype:
|
if not rtype:
|
||||||
return ''
|
return ''
|
||||||
|
|||||||
@@ -691,7 +691,10 @@ def PostProcess(folder):
|
|||||||
elif stripline == '<dl class="attribute">' and not properties_done:
|
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
|
line = '<br><h3>Properties<a class="headerlink" href="#properties" title="Permalink to this headline">¶</a></h3>' + '\n' + line
|
||||||
properties_done = True
|
properties_done = True
|
||||||
|
|
||||||
|
if '<em> ' in line and '–' in line:
|
||||||
|
line = line.replace('<em> ', '<em>')
|
||||||
|
|
||||||
newtext += line + '\n'
|
newtext += line + '\n'
|
||||||
|
|
||||||
for old, new in list(enum_dict.items()):
|
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,
|
Replaces various C++ specific stuff with more Pythonized version of them,
|
||||||
for parameter lists and return types (i.e., the `:param:` and `:rtype:`
|
for parameter lists and return types (i.e., the `:param:` and `:rtype:`
|
||||||
ReST roles).
|
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`
|
:rtype: `string`
|
||||||
"""
|
"""
|
||||||
@@ -295,7 +297,15 @@ def PythonizeType(ptype):
|
|||||||
ptype = ptype[0:-1]
|
ptype = ptype[0:-1]
|
||||||
if ' ' not in ptype:
|
if ' ' not in ptype:
|
||||||
ptype = ':class:`%s`'%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
|
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.
|
and which has a nicer look.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ from wx.lib.stattext import GenStaticText as StaticText
|
|||||||
|
|
||||||
class BusyInfo(object):
|
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 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
|
size) and the background and foreground colors of the message box can be
|
||||||
set.
|
set.
|
||||||
@@ -29,7 +29,7 @@ class BusyInfo(object):
|
|||||||
Creating an instace of the class witll create an show a window with the
|
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
|
given message, and when the instance is deleted then that window will be
|
||||||
closed. This class also implements the context manager magic methods, so
|
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...'):
|
with BusyInfo('Please wait...'):
|
||||||
doSomethingThatNeedsWaiting()
|
doSomethingThatNeedsWaiting()
|
||||||
@@ -38,16 +38,16 @@ class BusyInfo(object):
|
|||||||
|
|
||||||
def __init__(self, msg, parent=None, bgColour=None, fgColour=None):
|
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 string `msg`: a string to be displayed in the BusyInfo window.
|
||||||
:param `parent`: an optional window to be used as the parent of
|
:param Window `parent`: an optional window to be used as the parent of
|
||||||
the `BusyInfo`. If given then the BusyInfo will be centered
|
the `:class:`BusyInfo`. If given then the BusyInfo will be centered
|
||||||
over that window, otherwise it will be centered on the screen.
|
over that window, otherwise it will be centered on the screen.
|
||||||
:param `bgColour`: :class:`Colour` to be used for the background
|
:param Colour `bgColour`: colour to be used for the background
|
||||||
of the `BusyInfo`
|
of the :class:`BusyInfo`
|
||||||
:param `fgColour`: :class:`Colour` to be used for the foreground (text)
|
:param Colour `fgColour`: colour to be used for the foreground (text)
|
||||||
of the `BusyInfo`
|
of the :class:`BusyInfo`
|
||||||
"""
|
"""
|
||||||
self.frame = _InfoFrame(parent, msg, bgColour, fgColour)
|
self.frame = _InfoFrame(parent, msg, bgColour, fgColour)
|
||||||
self.frame.Show()
|
self.frame.Show()
|
||||||
@@ -59,7 +59,7 @@ class BusyInfo(object):
|
|||||||
|
|
||||||
def Close(self):
|
def Close(self):
|
||||||
"""
|
"""
|
||||||
Hide and close the busy info box
|
Hide and close the busy info box.
|
||||||
"""
|
"""
|
||||||
if self.frame:
|
if self.frame:
|
||||||
self.frame.Hide()
|
self.frame.Hide()
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ class UpdateAbortedError(RuntimeError):
|
|||||||
|
|
||||||
class SoftwareUpdate(object):
|
class SoftwareUpdate(object):
|
||||||
"""
|
"""
|
||||||
Mix this class with wx.App and call InitForUpdates from the derived class'
|
Mix this class with :class:`App` and call :meth:`InitForUpdates` from the derived class'
|
||||||
OnInit method. Be sure that the wx.App has set a display name
|
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.
|
(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):
|
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
|
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
|
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.
|
if there is no update available the user will not be bothered.
|
||||||
|
|||||||
Reference in New Issue
Block a user