コード例 #1
0
class PythonEditor(wx.Panel):
	def __init__(self,parente,filename=None):
		wx.Panel.__init__(self,parente)
		sizer = wx.BoxSizer(wx.VERTICAL)
		self.buffer = Buffer()
		self.editor = Editor(self,id=-1,size=parente.GetClientSize())
		self.buffer.addEditor(self.editor)
		self.buffer.open(filename)
		self.buffer.interp.locals.clear()
		
		sizer.Add(self.editor.window, 1, wx.EXPAND, 0)
		self.SetSizer(sizer)
コード例 #2
0
	def bufferCreate(self, filename=None):
		"""Create new buffer."""
		buffer = Buffer()
		panel = wx.Panel(parent=self, id=-1)
		panel.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: x)        
		editor = Editor(parent=panel)
		panel.editor = editor
		sizer = wx.BoxSizer(wx.VERTICAL)
		sizer.Add(editor.window, 1, wx.EXPAND)
		panel.SetSizer(sizer)
		panel.SetAutoLayout(True)
		sizer.Layout()
		buffer.addEditor(editor)
		buffer.open(filename)
		self.setEditor(editor)
		self.AddPage(page=panel, text=self.buffer.name, select=True)
		self.editor.setFocus()
コード例 #3
0
ファイル: ui_editor.py プロジェクト: Distrotech/libkate
  def addStream(self,filename):
     buffer=Buffer()
     panel=wx.Panel(parent=self.notebook,id=-1)
     panel.Bind(wx.EVT_ERASE_BACKGROUND,lambda x: x)
     editor=Editor(parent=panel)

     panel.editor=editor
     panel.buffer=buffer
     panel.filename=filename

     sizer=wx.BoxSizer(wx.VERTICAL)
     sizer.Add(editor.window,1,wx.EXPAND)
     panel.SetSizer(sizer)
     panel.SetAutoLayout(True)
     sizer.Layout()
     buffer.addEditor(editor)
     buffer.open(filename)
     self.notebook.AddPage(page=panel,text=buffer.name,select=True)
     if (self.notebook.GetPageCount()==1):
       self.OnPageSelected(0)
     self.buffers.append(buffer)
     editor.setFocus()
コード例 #4
0
 def bufferCreate(self, filename=None):
     """Create new buffer."""
     buffer = Buffer()
     panel = wx.Panel(parent=self.notebook, id=-1)
     panel.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: x)
     editor = Editor(parent=panel)
     panel.editor = editor
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(editor.window, 1, wx.EXPAND)
     panel.SetSizer(sizer)
     panel.SetAutoLayout(True)
     sizer.Layout()
     buffer.addEditor(editor)
     buffer.open(filename)
     self.setEditor(editor)
     self.notebook.AddPage(page=panel, text=self.buffer.name, select=True)
     self.editor.setFocus()
コード例 #5
0
 def bufferCreate(self, filename=None):
     """Create new buffer."""
     self.bufferDestroy()
     buffer = Buffer()
     self.panel = panel = wx.Panel(parent=self, id=-1)
     panel.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: x)
     editor = Editor(parent=panel)
     panel.editor = editor
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(editor.window, 1, wx.EXPAND)
     panel.SetSizer(sizer)
     panel.SetAutoLayout(True)
     sizer.Layout()
     buffer.addEditor(editor)
     buffer.open(filename)
     self.setEditor(editor)
     self.editor.setFocus()
     self.SendSizeEvent()
コード例 #6
0
ファイル: ui_editor.py プロジェクト: ManasJayanth/esy-libkate
    def addStream(self, filename):
        buffer = Buffer()
        panel = wx.Panel(parent=self.notebook, id=-1)
        panel.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: x)
        editor = Editor(parent=panel)

        panel.editor = editor
        panel.buffer = buffer
        panel.filename = filename

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(editor.window, 1, wx.EXPAND)
        panel.SetSizer(sizer)
        panel.SetAutoLayout(True)
        sizer.Layout()
        buffer.addEditor(editor)
        buffer.open(filename)
        self.notebook.AddPage(page=panel, text=buffer.name, select=True)
        if (self.notebook.GetPageCount() == 1):
            self.OnPageSelected(0)
        self.buffers.append(buffer)
        editor.setFocus()
コード例 #7
0
    def __init__(self,
                 parent,
                 id=-1,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.CLIP_CHILDREN,
                 introText='',
                 locals=None,
                 InterpClass=None,
                 *args,
                 **kwds):
        """ Create Shell instance.
        """
        editwindow.EditWindow.__init__(self, parent, id, pos, size, style)

        # Set the shell to automatically wrap lines instead of scrolling when
        # lines are wider than the shell width.
        self.wrap()

        # We want all the variables available in __main__ within our local
        # dict. (
        # fixme: Do we really want this?  Is this something handled by
        #        IPython?
        if locals is None:
            import __main__
            locals = __main__.__dict__

        self._ipython_interpreter = IPythonInterpreter(user_ns=locals)

        self.ip_readline = IPReadline(interpreter=self._ipython_interpreter)

        # Set up the buffer.
        # FIXME: What is this?
        self.buffer = Buffer()

        # Find out for which keycodes the interpreter will autocomplete.
        self.autoCompleteKeys = []  #self.interp.getAutoCompleteKeys()

        # Keep track of the last non-continuation prompt positions.
        self.promptPosStart = 0
        self.promptPosEnd = 0

        # Keep track of multi-line commands.
        self.more = False

        #seb add mode for "free edit"
        self.noteMode = 0
        self.MarkerDefine(0, stc.STC_MARK_ROUNDRECT)  # marker for hidden
        self.searchTxt = ""

        # Assign handlers for keyboard events.
        self.Bind(wx.EVT_CHAR, self.OnChar)
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

        # Assign handler for idle time.
        self.waiting = False
        self.Bind(wx.EVT_IDLE, self.OnIdle)

        # Display the introductory banner information.
        self.showIntro(introText)

        # Assign some pseudo keywords to the interpreter's namespace.
        self.setBuiltinKeywords()

        self.prompt()

        wx.CallAfter(self.ScrollToLine, 0)
コード例 #8
0
    def __init__(self,
                 parent,
                 id=-1,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.CLIP_CHILDREN,
                 introText='',
                 locals=None,
                 InterpClass=None,
                 startupScript=None,
                 execStartupScript=True,
                 *args,
                 **kwds):
        """ Create Shell instance.
        """
        editwindow.EditWindow.__init__(self, parent, id, pos, size, style)

        # Set the shell to automatically wrap lines instead of scrolling when
        # lines are wider than the shell width.
        self.wrap()

        # We want all the variables available in __main__ within our local
        # dict. (
        # fixme: Do we really want this?  Is this something handled by
        #        IPython?
        if locals is None:
            import __main__
            locals = __main__.__dict__

        self._ipython_interpreter = IPythonInterpreter(namespace=locals)

        self.ip_readline = IPReadline(interpreter=self._ipython_interpreter)

        # Set up the buffer.
        # fixme: What is this?
        self.buffer = Buffer()

        # Find out for which keycodes the interpreter will autocomplete.
        self.autoCompleteKeys = []  #self.interp.getAutoCompleteKeys()

        # Keep track of the last non-continuation prompt positions.
        self.promptPosStart = 0
        self.promptPosEnd = 0

        # Keep track of multi-line commands.
        self.more = False

        # Create the command history.  Commands are added into the
        # front of the list (ie. at index 0) as they are entered.
        # self.historyIndex is the current position in the history; it
        # gets incremented as you retrieve the previous command,
        # decremented as you retrieve the next, and reset when you hit
        # Enter.  self.historyIndex == -1 means you're on the current
        # command, not in the history.
        self.history = []
        self.historyIndex = -1

        #seb add mode for "free edit"
        self.noteMode = 0
        self.MarkerDefine(0, stc.STC_MARK_ROUNDRECT)  # marker for hidden
        self.searchTxt = ""

        # Assign handlers for keyboard events.
        self.Bind(wx.EVT_CHAR, self.OnChar)
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

        # Assign handler for idle time.
        self.waiting = False
        self.Bind(wx.EVT_IDLE, self.OnIdle)

        # Display the introductory banner information.
        self.showIntro(introText)

        # Assign some pseudo keywords to the interpreter's namespace.
        self.setBuiltinKeywords()

        # Do this last so the user has complete control over their
        # environment.  They can override anything they want.
        if execStartupScript:
            if startupScript is None:
                startupScript = os.environ.get('PYTHONSTARTUP')
            self.execStartupScript(startupScript)
        self.prompt()

        wx.CallAfter(self.ScrollToLine, 0)