]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/py/PyCrust.py
   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] 
  17     """PyCrust standalone application.""" 
  22         wx
.InitAllImageHandlers() 
  23         self
.frame 
= py
.crust
.CrustFrame() 
  24         self
.frame
.SetSize((800, 600)) 
  26         self
.SetTopWindow(self
.frame
) 
  30 The main() function needs to handle being imported, such as with the 
  31 pycrust script that wxPython installs: 
  35     from wx.py.PyCrust import main 
  40     """The main function for the PyCrust program.""" 
  41     # Cleanup the main namespace, leaving the App class. 
  43     md 
= __main__
.__dict
__ 
  47         if key 
not in keepers
: 
  49     # Create an application instance. 
  51     # Mimic the contents of the standard Python shell's sys.path. 
  55     # Add the application object to the sys module's namespace. 
  56     # This allows a shell user to do: 
  58     # >>> sys.app.whatever 
  61     # Cleanup the main namespace some more. 
  62     if md
.has_key('App') and md
['App'] is App
: 
  64     if md
.has_key('__main__') and md
['__main__'] is __main__
: 
  66     # Start the wxPython event loop. 
  69 if __name__ 
== '__main__':