Add more stuff to the output file.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -7,20 +7,26 @@ __revision__ = "$Revision$"[11:-2]
|
|||||||
|
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import types
|
||||||
|
|
||||||
|
|
||||||
header = '''\
|
header = '''\
|
||||||
"""Decorator classes for documentation and shell scripting."""
|
"""wxPython decorator classes.
|
||||||
|
|
||||||
|
This file is automatically generated, and these are not the real
|
||||||
|
wxPython classes. These are Python versions for API documentation
|
||||||
|
purposes only.
|
||||||
|
|
||||||
|
Please send corrections, questions, and suggestions to:
|
||||||
|
|
||||||
|
Patrick K. O'Brien <pobrien@orbtech.com>
|
||||||
|
"""
|
||||||
|
|
||||||
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
|
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
|
||||||
|
|
||||||
|
from wxd import Parameters as wx
|
||||||
# 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:
|
try:
|
||||||
True
|
True
|
||||||
@@ -29,7 +35,6 @@ except NameError:
|
|||||||
False = 1==0
|
False = 1==0
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
modlist = [
|
modlist = [
|
||||||
'Base',
|
'Base',
|
||||||
'Window',
|
'Window',
|
||||||
@@ -68,10 +73,12 @@ modlist = [
|
|||||||
'Validators',
|
'Validators',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
dir = os.path.realpath('api/wx/')
|
||||||
|
filename = os.path.join(dir, '__init__.py')
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
modules = {}
|
modules = {}
|
||||||
f = file('api/wx/__init__.py', 'w')
|
f = file(filename, 'w')
|
||||||
f.write(header)
|
f.write(header)
|
||||||
for modname in modlist:
|
for modname in modlist:
|
||||||
modules[modname] = __import__(modname, globals())
|
modules[modname] = __import__(modname, globals())
|
||||||
@@ -94,10 +101,33 @@ def main():
|
|||||||
source = splitter + parts[1]
|
source = splitter + parts[1]
|
||||||
source = '\n\n\n' + source.strip()
|
source = '\n\n\n' + source.strip()
|
||||||
f.write(source)
|
f.write(source)
|
||||||
print 'Writing', modname, 'to file...'
|
print 'Writing', modname
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
# Add constants and any other missing stuff.
|
||||||
|
f = file(filename, 'a')
|
||||||
|
f.write('\n\n## Other Stuff:\n\n')
|
||||||
|
import wx as old
|
||||||
|
old = old.__dict__
|
||||||
|
sys.path.insert(0, dir) # Munge the sys.path so that we can
|
||||||
|
import __init__ # import the file we just created.
|
||||||
|
new = __init__.__dict__
|
||||||
|
l = [(k, v) for (k, v) in old.items() if (not k.startswith('_')
|
||||||
|
and not k.endswith('Ptr')
|
||||||
|
and not (k == 'cvar'))]
|
||||||
|
l.sort()
|
||||||
|
from wxPython import wx
|
||||||
|
for key, value in l:
|
||||||
|
if key not in new:
|
||||||
|
if (inspect.isclass(value)
|
||||||
|
or inspect.isroutine(value)
|
||||||
|
or type(value) is types.InstanceType):
|
||||||
|
value = repr(value)
|
||||||
|
text = '%s = %r' % (key, value)
|
||||||
|
f.write(text + '\n')
|
||||||
|
print 'Writing', text
|
||||||
|
f.close()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Reference in New Issue
Block a user