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)
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()
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()
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()
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()
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()