]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wxPython/lib/PyCrust/crust.py
Updates to contributed library stuff, a new version of PyCrust
[wxWidgets.git] / wxPython / wxPython / lib / PyCrust / crust.py
CommitLineData
fea018f8
RD
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
8from wxPython.wx import *
9from shell import Shell
10from filling import Filling
11from version import VERSION
12
13
14class 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', \
ce68e8d0
RD
22 rootObject=None, rootLabel=None, rootIsNamespace=1, \
23 intro='', locals=None, \
fea018f8
RD
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, \
29 *args, **kwds)
30 self.filling = Filling(parent=self, \
ce68e8d0
RD
31 rootObject=self.shell.interp.locals, \
32 rootLabel=rootLabel, rootIsNamespace=1)
fea018f8
RD
33 """Add 'filling' to the interpreter's locals."""
34 self.shell.interp.locals['filling'] = self.filling
35 self.SplitHorizontally(self.shell, self.filling, 300)
ce68e8d0 36 self.SetMinimumPaneSize(1)
fea018f8
RD
37
38
ce68e8d0
RD
39# Temporary hack to share menus between PyCrust and PyShell.
40from shell import ShellMenu
41
42class CrustFrame(wxFrame, ShellMenu):
fea018f8
RD
43 """Frame containing all the PyCrust components."""
44
45 name = 'PyCrust Frame'
46 revision = __version__
47
48 def __init__(self, parent=None, id=-1, title='PyCrust', \
ce68e8d0
RD
49 rootObject=None, rootLabel=None, rootIsNamespace=1, \
50 locals=None, InterpClass=None, *args, **kwds):
fea018f8
RD
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)
58 self.SetIcon(icon)
59 self.crust = Crust(parent=self, intro=intro, \
ce68e8d0
RD
60 rootObject=rootObject, \
61 rootLabel=rootLabel, \
62 rootIsNamespace=rootIsNamespace, \
63 locals=locals, \
fea018f8
RD
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
ce68e8d0
RD
69 # Fix a problem with the sash shrinking to nothing.
70 self.crust.filling.SetSashPosition(200)
71 # Set focus to the shell editor.
fea018f8 72 self.crust.shell.SetFocus()
ce68e8d0
RD
73 # Temporary hack to share menus between PyCrust and PyShell.
74 self.shell = self.crust.shell
75 self.createMenus()
fea018f8
RD
76
77