]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wxPython/lib/PyCrust/crust.py
d45941a05a3666b8a08d9eb676e456932f9e331c
[wxWidgets.git] / wxPython / wxPython / lib / PyCrust / crust.py
1 """PyCrust Crust combines the shell and filling into one control."""
2
3 __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
4 __cvsid__ = "$Id$"
5 __date__ = "July 1, 2001"
6 __version__ = "$Revision$"[11:-2]
7
8 from wxPython.wx import *
9 from shell import Shell
10 from filling import Filling
11 from version import VERSION
12
13
14 class Crust(wxSplitterWindow):
15 """PyCrust Crust based on wxSplitterWindow."""
16
17 name = 'PyCrust Crust'
18 revision = __version__
19
20 def __init__(self, parent, id=-1, pos=wxDefaultPosition, \
21 size=wxDefaultSize, style=wxSP_3D, name='Crust Window', \
22 ingredients=None, rootLabel=None, intro='', locals=None, \
23 InterpClass=None, *args, **kwds):
24 """Create a PyCrust Crust instance."""
25 wxSplitterWindow.__init__(self, parent, id, pos, size, style, name)
26 self.shell = Shell(parent=self, introText=intro, \
27 locals=locals, InterpClass=InterpClass, \
28 *args, **kwds)
29 self.filling = Filling(parent=self, \
30 ingredients=self.shell.interp.locals, \
31 rootLabel=rootLabel)
32 """Add 'filling' to the interpreter's locals."""
33 self.shell.interp.locals['filling'] = self.filling
34 self.SplitHorizontally(self.shell, self.filling, 300)
35 # Set focus to the shell editor. Doesn't always work as intended.
36 self.shell.SetFocus()
37
38
39 class CrustFrame(wxFrame):
40 """Frame containing all the PyCrust components."""
41
42 name = 'PyCrust Frame'
43 revision = __version__
44
45 def __init__(self, parent=None, id=-1, title='PyCrust', \
46 ingredients=None, rootLabel=None, locals=None, \
47 InterpClass=None, *args, **kwds):
48 """Create a PyCrust CrustFrame instance."""
49 wxFrame.__init__(self, parent, id, title)
50 intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % VERSION
51 self.CreateStatusBar()
52 self.SetStatusText(intro)
53 if wxPlatform == '__WXMSW__':
54 icon = wxIcon('PyCrust.ico', wxBITMAP_TYPE_ICO)
55 self.SetIcon(icon)
56 self.crust = Crust(parent=self, intro=intro, \
57 ingredients=ingredients, \
58 rootLabel=rootLabel, locals=locals, \
59 InterpClass=InterpClass, *args, **kwds)
60 # Override the filling so that status messages go to the status bar.
61 self.crust.filling.fillingTree.setStatusText = self.SetStatusText
62 # Override the shell so that status messages go to the status bar.
63 self.crust.shell.setStatusText = self.SetStatusText
64 # Set focus to the shell editor. Doesn't always work as intended.
65 self.crust.shell.SetFocus()
66
67