]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wxPython/lib/PyCrust/crust.py
ceb62dc6d7c1000a649fba5e3c728a25ff5c82c1
1 """PyCrust Crust combines the shell and filling into one control."""
3 __author__
= "Patrick K. O'Brien <pobrien@orbtech.com>"
5 __date__
= "July 1, 2001"
6 __version__
= "$Revision$"[11:-2]
8 from wxPython
.wx
import *
9 from shell
import Shell
10 from filling
import Filling
11 from version
import VERSION
14 class Crust(wxSplitterWindow
):
15 """PyCrust Crust based on wxSplitterWindow."""
17 name
= 'PyCrust Crust'
18 revision
= __version__
20 def __init__(self
, parent
, id=-1, pos
=wxDefaultPosition
, \
21 size
=wxDefaultSize
, style
=wxSP_3D
, name
='Crust Window', \
22 rootObject
=None, rootLabel
=None, rootIsNamespace
=1, \
23 intro
='', locals=None, \
24 InterpClass
=None, *args
, **kwds
):
25 """Create a PyCrust Crust instance."""
26 wxSplitterWindow
.__init
__(self
, parent
, id, pos
, size
, style
, name
)
27 self
.shell
= Shell(parent
=self
, introText
=intro
, \
28 locals=locals, InterpClass
=InterpClass
, \
30 self
.filling
= Filling(parent
=self
, \
31 rootObject
=self
.shell
.interp
.locals, \
32 rootLabel
=rootLabel
, rootIsNamespace
=1)
33 """Add 'filling' to the interpreter's locals."""
34 self
.shell
.interp
.locals['filling'] = self
.filling
35 self
.SplitHorizontally(self
.shell
, self
.filling
, 300)
36 self
.SetMinimumPaneSize(1)
39 # Temporary hack to share menus between PyCrust and PyShell.
40 from shell
import ShellMenu
42 class CrustFrame(wxFrame
, ShellMenu
):
43 """Frame containing all the PyCrust components."""
45 name
= 'PyCrust Frame'
46 revision
= __version__
48 def __init__(self
, parent
=None, id=-1, title
='PyCrust', \
49 rootObject
=None, rootLabel
=None, rootIsNamespace
=1, \
50 locals=None, InterpClass
=None, *args
, **kwds
):
51 """Create a PyCrust CrustFrame instance."""
52 wxFrame
.__init
__(self
, parent
, id, title
)
53 intro
= 'Welcome To PyCrust %s - The Flakiest Python Shell' % VERSION
54 self
.CreateStatusBar()
55 self
.SetStatusText(intro
)
56 if wxPlatform
== '__WXMSW__':
57 icon
= wxIcon('PyCrust.ico', wxBITMAP_TYPE_ICO
)
59 self
.crust
= Crust(parent
=self
, intro
=intro
, \
60 rootObject
=rootObject
, \
61 rootLabel
=rootLabel
, \
62 rootIsNamespace
=rootIsNamespace
, \
64 InterpClass
=InterpClass
, *args
, **kwds
)
65 # Override the filling so that status messages go to the status bar.
66 self
.crust
.filling
.fillingTree
.setStatusText
= self
.SetStatusText
67 # Override the shell so that status messages go to the status bar.
68 self
.crust
.shell
.setStatusText
= self
.SetStatusText
69 # Fix a problem with the sash shrinking to nothing.
70 self
.crust
.filling
.SetSashPosition(200)
71 # Set focus to the shell editor.
72 self
.crust
.shell
.SetFocus()
73 # Temporary hack to share menus between PyCrust and PyShell.
74 self
.shell
= self
.crust
.shell