]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/py/PyShell.py
1 """PyShell is a python shell 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]
17 """PyShell standalone application."""
21 wx
.InitAllImageHandlers()
22 locals = __main__
.__dict
__
23 from shell
import ShellFrame
24 self
.frame
= ShellFrame(locals=locals)
25 self
.frame
.SetSize((750, 525))
27 self
.SetTopWindow(self
.frame
)
28 self
.frame
.shell
.SetFocus()
32 The main() function needs to handle being imported, such as with the
33 pyshell script that wxPython installs:
37 from wx.py.PyShell import main
42 """The main function for the PyShell 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 # Cleanup the main namespace some more.
54 if md
.has_key('App') and md
['App'] is App
:
56 if md
.has_key('__main__') and md
['__main__'] is __main__
:
58 # Mimic the contents of the standard Python shell's sys.path.
62 # Add the application object to the sys module's namespace.
63 # This allows a shell user to do:
65 # >>> sys.app.whatever
68 # Start the wxPython event loop.
71 if __name__
== '__main__':