]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wxPython/py/wxd/gen.py
wxPython Merge #2 of 2.4 branch --> HEAD (branch tag: wxPy_2_4_merge_2)
[wxWidgets.git] / wxPython / wxPython / py / wxd / gen.py
diff --git a/wxPython/wxPython/py/wxd/gen.py b/wxPython/wxPython/py/wxd/gen.py
new file mode 100644 (file)
index 0000000..2e07922
--- /dev/null
@@ -0,0 +1,71 @@
+
+import inspect
+from wxPython import wx
+
+
+def scan():
+    d = wx.__dict__
+    newd = {}
+    keys = d.keys()
+    keys.sort()
+    for key in keys:
+        if key.endswith('Ptr'):
+            # Skip
+            pass
+        elif key+'Ptr' in keys:
+            # Rename
+            newd[key] = d[key+'Ptr']
+        else:
+            # Include as is
+            newd[key] = d[key]
+    d = newd
+    keys = d.keys()
+    keys.sort()
+    for key in keys:
+        value = d[key]
+        if inspect.isclass(value):
+            # genClass(value)
+            pass
+        elif callable(value):
+            genFunction(value)
+            pass
+        else:
+            # print type(value), value            
+            pass
+
+
+def genClass(cls):
+    sp4 = ' ' * 4
+    name = cls.__name__
+    if name.endswith('Ptr'):
+        name = name[:-3]
+##     if name != 'wxNotebook':
+##         return
+    parent = ''
+    if cls.__bases__:
+        parent = cls.__bases__[0].__name__
+        if parent.endswith('Ptr'):
+            parent = parent[:-3]
+        parent = '(%s)' % parent
+    items = cls.__dict__.keys()
+    items.sort()
+    print
+    print 'class %s%s:' % (name, parent)
+    print sp4 + '""""""'
+    print
+    for item in items:
+        attr = cls.__dict__[item]
+        if inspect.isfunction(attr):
+            print sp4 + 'def ' + item + '(self):'
+            print sp4 + sp4 + '""""""'
+            print sp4 + sp4 + 'pass'
+            print
+
+
+def genFunction(func):
+    sp4 = ' ' * 4
+    name = func.__name__
+    print 'def %s():' % name
+    print sp4 + '""""""'
+    print sp4 + 'pass'
+    print