]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/py/PyWrap.py
Make InheritAttributes and ShouldInheritColours public so they can be
[wxWidgets.git] / wxPython / wx / py / PyWrap.py
1 """PyWrap is a command line utility that runs a wxPython program with
2 additional runtime-tools, such as PyCrust."""
3
4 __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
5 __cvsid__ = "$Id$"
6 __revision__ = "$Revision$"[11:-2]
7
8 import wx
9 from wx import py
10
11 import os
12 import sys
13
14 def wrap(app):
15 wx.InitAllImageHandlers()
16 frame = py.crust.CrustFrame()
17 frame.SetSize((750, 525))
18 frame.Show(True)
19 frame.shell.interp.locals['app'] = app
20 app.MainLoop()
21
22 def main(modulename=None):
23 sys.path.insert(0, os.curdir)
24 if not modulename:
25 if len(sys.argv) < 2:
26 print "Please specify a module name."
27 raise SystemExit
28 modulename = sys.argv[1]
29 if modulename.endswith('.py'):
30 modulename = modulename[:-3]
31 module = __import__(modulename)
32 # Find the App class.
33 App = None
34 d = module.__dict__
35 for item in d.keys():
36 try:
37 if issubclass(d[item], wx.App):
38 App = d[item]
39 except (NameError, TypeError):
40 pass
41 if App is None:
42 print "No App class was found."
43 raise SystemExit
44 app = App()
45 wrap(app)
46
47 if __name__ == '__main__':
48 main()