]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/py/PyCrust.py
4bd56370507b147ba538c59acfded7466829db99
1 """PyCrust is a python shell and namespace browser application."""
3 # The next two lines, and the other code below that makes use of
4 # ``__main__`` and ``original``, serve the purpose of cleaning up the
5 # main namespace to look as much as possible like the regular Python
8 original
= __main__
.__dict
__.keys()
10 __author__
= "Patrick K. O'Brien <pobrien@orbtech.com>"
12 __revision__
= "$Revision$"[11:-2]
18 """PyCrust standalone application."""
22 wx
.InitAllImageHandlers()
23 locals = __main__
.__dict
__
24 from crust
import CrustFrame
25 self
.frame
= CrustFrame(locals=locals)
26 self
.frame
.SetSize((800, 600))
28 self
.SetTopWindow(self
.frame
)
32 The main() function needs to handle being imported, such as with the
33 pycrust script that wxPython installs:
37 from wx.py.PyCrust import main
42 """The main function for the PyCrust program."""
43 # Cleanup the main namespace, leaving the App class.
45 md
= __main__
.__dict
__
49 if key
not in keepers
:
51 # Create an application instance.
53 # Mimic the contents of the standard Python shell's sys.path.
57 # Add the application object to the sys module's namespace.
58 # This allows a shell user to do:
60 # >>> sys.app.whatever
63 # Cleanup the main namespace some more.
64 if md
.has_key('App') and md
['App'] is App
:
66 if md
.has_key('__main__') and md
['__main__'] is __main__
:
68 # Start the wxPython event loop.
71 if __name__
== '__main__':