diff --git a/wxPython/wxPython/py/wxd/genapi.py b/wxPython/wxPython/py/wxd/genapi.py index f3cd4532d0..8b09cc3380 100644 --- a/wxPython/wxPython/py/wxd/genapi.py +++ b/wxPython/wxPython/py/wxd/genapi.py @@ -7,20 +7,26 @@ __revision__ = "$Revision$"[11:-2] import inspect +import os +import sys +import types 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 +""" __author__ = "Patrick K. O'Brien " - -# 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 +from wxd import Parameters as wx try: True @@ -29,7 +35,6 @@ except NameError: False = 1==0 ''' - modlist = [ 'Base', 'Window', @@ -68,10 +73,12 @@ modlist = [ 'Validators', ] +dir = os.path.realpath('api/wx/') +filename = os.path.join(dir, '__init__.py') def main(): modules = {} - f = file('api/wx/__init__.py', 'w') + f = file(filename, 'w') f.write(header) for modname in modlist: modules[modname] = __import__(modname, globals()) @@ -94,10 +101,33 @@ def main(): source = splitter + parts[1] source = '\n\n\n' + source.strip() f.write(source) - print 'Writing', modname, 'to file...' + print 'Writing', modname f.write('\n') 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__': main()