| 1 | """ |
| 2 | |
| 3 | |
| 4 | When this script is run it will create a .py module (output to the |
| 5 | current directory) containing a class derived from |
| 6 | wx.activex.ActiveXWindow for the progID or CLSID given on the command |
| 7 | line. By default the class name will be used as the module name as |
| 8 | well, but this is just because I am lazy, not trying to define a |
| 9 | standard or anything. Feel free to rename the module, I do. |
| 10 | |
| 11 | Usage: |
| 12 | |
| 13 | python genax.py CLSID|progID className |
| 14 | |
| 15 | """ |
| 16 | |
| 17 | import wx |
| 18 | import wx.activex |
| 19 | import sys |
| 20 | |
| 21 | |
| 22 | def main(args): |
| 23 | if len(args) < 3: |
| 24 | print __doc__ |
| 25 | sys.exit(1) |
| 26 | |
| 27 | # unfortunatly we need to make an app, frame and an instance of |
| 28 | # the ActiceX control in order to get the TypeInfo about it... |
| 29 | app = wx.PySimpleApp() |
| 30 | f = wx.Frame(None, -1, "") |
| 31 | clsid = wx.activex.CLSID(args[1]) |
| 32 | axw = wx.activex.ActiveXWindow(f, clsid) |
| 33 | |
| 34 | wx.activex.GernerateAXModule(axw, args[2], '.', verbose=True) |
| 35 | |
| 36 | # Cleanup |
| 37 | f.Close() |
| 38 | app.MainLoop() |
| 39 | |
| 40 | |
| 41 | if __name__ == "__main__": |
| 42 | main(sys.argv) |
| 43 | |