Update of /cvsroot/pycrust/PyCrust
In directory sc8-pr-cvs1:/tmp/cvs-serv7864
Modified Files:
editor.py
Log Message:
Make the first tab a PyCrust session.
Index: editor.py
===================================================================
RCS file: /cvsroot/pycrust/PyCrust/editor.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** editor.py 5 Apr 2003 02:22:41 -0000 1.21
--- editor.py 6 Apr 2003 04:29:43 -0000 1.22
***************
*** 9,16 ****
--- 9,18 ----
import base
import buffer
+ import crust
import dispatcher
import frame
import interpreter
import shell
+ import version
try:
***************
*** 25,29 ****
def __init__(self, parent=None, id=-1, title='PyAlaCarte',
! pos=wx.wxDefaultPosition, size=(600, 400),
style=wx.wxDEFAULT_FRAME_STYLE, filename=None):
"""Create an EditorFrame instance."""
--- 27,31 ----
def __init__(self, parent=None, id=-1, title='PyAlaCarte',
! pos=wx.wxDefaultPosition, size=(800, 600),
style=wx.wxDEFAULT_FRAME_STYLE, filename=None):
"""Create an EditorFrame instance."""
***************
*** 36,40 ****
wx.EVT_IDLE(self, self.OnIdle)
self._setup()
! self.bufferCreate(filename)
def _setup(self):
--- 38,43 ----
wx.EVT_IDLE(self, self.OnIdle)
self._setup()
! if filename:
! self.bufferCreate(filename)
def _setup(self):
***************
*** 215,219 ****
def __init__(self, parent=None, id=-1, title='PyAlaMode',
! pos=wx.wxDefaultPosition, size=(600, 400),
style=wx.wxDEFAULT_FRAME_STYLE, filename=None):
"""Create an EditorNotebookFrame instance."""
--- 218,222 ----
def __init__(self, parent=None, id=-1, title='PyAlaMode',
! pos=wx.wxDefaultPosition, size=(800, 600),
style=wx.wxDEFAULT_FRAME_STYLE, filename=None):
"""Create an EditorNotebookFrame instance."""
***************
*** 228,231 ****
--- 231,252 ----
dispatcher.connect(receiver=self._bufferChange,
signal='BufferChange', sender=self._notebook)
+ intro = 'PyCrust %s' % version.VERSION
+ import imp
+ module = imp.new_module('__main__')
+ import __builtin__
+ module.__dict__['__builtins__'] = __builtin__
+ namespace = module.__dict__.copy()
+ self.crust = crust.Crust(parent=self._notebook, intro=intro, locals=namespace)
+ self.shell = self.crust.shell
+ # Override the filling so that status messages go to the status bar.
+ self.crust.filling.tree.setStatusText = self.SetStatusText
+ # Override the shell so that status messages go to the status bar.
+ self.shell.setStatusText = self.SetStatusText
+ # Fix a problem with the sash shrinking to nothing.
+ self.crust.filling.SetSashPosition(200)
+ self._notebook.AddPage(page=self.crust, text='PyCrust', select=True)
+ self._buffer = self.crust.buffer
+ self._buffers[self._buffer.id] = self._buffer
+ self._buffer.editor.SetFocus()
def _bufferChange(self, buffer):
***************
*** 492,496 ****
"""Create a Editor instance."""
base.Editor.__init__(self, parent, id, pos, size, style)
- self.confirmed = False
self.interp = interp
# Find out for which keycodes the interpreter will autocomplete.
--- 513,516 ----
|