]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/py/wxd/genapi.py
   1 """API generator for decorator classes. 
   4 __author__ 
= "Patrick K. O'Brien <pobrien@orbtech.com>" 
   6 __revision__ 
= "$Revision$"[11:-2] 
  16 """wxPython decorator classes. 
  18 This file is automatically generated, and these are not the real 
  19 wxPython classes.  These are Python versions for API documentation 
  22 Please send corrections, questions, and suggestions to: 
  24 Patrick K. O'Brien <pobrien@orbtech.com> 
  27 __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>" 
  29 from wxd import Parameters as wx 
  76 dir = os
.path
.realpath('api/wx/') 
  77 filename 
= os
.path
.join(dir, '__init__.py') 
  81     f 
= file(filename
, 'w') 
  83     for modname 
in modlist
: 
  84         modules
[modname
] = __import__(modname
, globals()) 
  85     for modname 
in modlist
: 
  86         module 
= modules
[modname
] 
  88             source 
= inspect
.getsource(module
) 
  90             print 'No source for', module
 
  92             # Remove everything up to the first class or function definition. 
  93             splitter 
= '\n\nclass ' 
  94             parts 
= source
.split(splitter
, 1) 
  96                 source 
= splitter 
+ parts
[1] 
  99                 parts 
= source
.split(splitter
, 1) 
 101                     source 
= splitter 
+ parts
[1] 
 102             source 
= '\n\n\n' + source
.strip() 
 104             print 'Writing', modname
 
 108     # Add constants and any other missing stuff. 
 109     f 
= file(filename
, 'a') 
 110     f
.write('\n\n## Other Stuff:\n\n') 
 113     sys
.path
.insert(0, dir) # Munge the sys.path so that we can 
 114     import __init__         
# import the file we just created. 
 115     new 
= __init__
.__dict
__ 
 116     l 
= [(k
, v
) for (k
, v
) in old
.items() if (not k
.startswith('_') 
 117                                               and not k
.endswith('Ptr') 
 118                                               and not (k 
== 'cvar'))] 
 120     from wxPython 
import wx
 
 123             if (inspect
.isclass(value
) 
 124                 or inspect
.isroutine(value
) 
 125                 or type(value
) is types
.InstanceType
): 
 127             text 
= '%s = %r' % (key
, value
) 
 129             print 'Writing', text
 
 132 if __name__ 
== '__main__':