Generates wx package for epydoc.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
103
wxPython/wxPython/py/wxd/genapi.py
Normal file
103
wxPython/wxPython/py/wxd/genapi.py
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
"""API generator for decorator classes.
|
||||||
|
"""
|
||||||
|
|
||||||
|
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
|
||||||
|
__cvsid__ = "$Id$"
|
||||||
|
__revision__ = "$Revision$"[11:-2]
|
||||||
|
|
||||||
|
|
||||||
|
import inspect
|
||||||
|
|
||||||
|
|
||||||
|
header = '''\
|
||||||
|
"""Decorator classes for documentation and shell scripting."""
|
||||||
|
|
||||||
|
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
|
||||||
|
|
||||||
|
|
||||||
|
# This file is automatically generated, and these are not the real
|
||||||
|
# wxPython classes. These are Python versions for documentation
|
||||||
|
# purposes only.
|
||||||
|
|
||||||
|
|
||||||
|
from wxPython.py.wxd import Parameters as wx
|
||||||
|
|
||||||
|
try:
|
||||||
|
True
|
||||||
|
except NameError:
|
||||||
|
True = 1==1
|
||||||
|
False = 1==0
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
modlist = [
|
||||||
|
'Base',
|
||||||
|
'Window',
|
||||||
|
'Frames',
|
||||||
|
'Accelerators',
|
||||||
|
'App',
|
||||||
|
'ClipDragDrop',
|
||||||
|
'Config',
|
||||||
|
'Controls',
|
||||||
|
'DataStructures',
|
||||||
|
'DateTime',
|
||||||
|
'Dialogs',
|
||||||
|
'Drawing',
|
||||||
|
'Errors',
|
||||||
|
'EventFunctions',
|
||||||
|
'Events',
|
||||||
|
'FileSystem',
|
||||||
|
'Functions',
|
||||||
|
'Help',
|
||||||
|
'ImageHandlers',
|
||||||
|
'Joystick',
|
||||||
|
'LayoutConstraints',
|
||||||
|
'Logging',
|
||||||
|
'Menus',
|
||||||
|
'MimeTypes',
|
||||||
|
'Misc',
|
||||||
|
'Panel',
|
||||||
|
'Printing',
|
||||||
|
'Process',
|
||||||
|
'SashSplitter',
|
||||||
|
'Sizers',
|
||||||
|
'Streams',
|
||||||
|
'Threading',
|
||||||
|
'ToolBar',
|
||||||
|
'Tree',
|
||||||
|
'Validators',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
modules = {}
|
||||||
|
f = file('api/wx/__init__.py', 'w')
|
||||||
|
f.write(header)
|
||||||
|
for modname in modlist:
|
||||||
|
modules[modname] = __import__(modname, globals())
|
||||||
|
for modname in modlist:
|
||||||
|
module = modules[modname]
|
||||||
|
try:
|
||||||
|
source = inspect.getsource(module)
|
||||||
|
except IOError:
|
||||||
|
print 'No source for', module
|
||||||
|
else:
|
||||||
|
# Remove everything up to the first class or function definition.
|
||||||
|
splitter = '\n\nclass '
|
||||||
|
parts = source.split(splitter, 1)
|
||||||
|
if len(parts) == 2:
|
||||||
|
source = splitter + parts[1]
|
||||||
|
else:
|
||||||
|
splitter = '\n\ndef '
|
||||||
|
parts = source.split(splitter, 1)
|
||||||
|
if len(parts) == 2:
|
||||||
|
source = splitter + parts[1]
|
||||||
|
source = '\n\n\n' + source.strip()
|
||||||
|
f.write(source)
|
||||||
|
print 'Writing', modname, 'to file...'
|
||||||
|
f.write('\n')
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Reference in New Issue
Block a user