Beremiz.py
changeset 1015 50bb7cc12a84
parent 1007 025ac12cd0d2
child 1019 e5686874eaef
equal deleted inserted replaced
1012:deb0fcab0c64 1015:50bb7cc12a84
   252             self.lock.acquire()
   252             self.lock.acquire()
   253             for s, style in self.stack:
   253             for s, style in self.stack:
   254                 if style is None : style=self.black_white
   254                 if style is None : style=self.black_white
   255                 if style != self.black_white:
   255                 if style != self.black_white:
   256                     self.output.StartStyling(self.output.GetLength(), 0xff)
   256                     self.output.StartStyling(self.output.GetLength(), 0xff)
       
   257                 self.output.SetReadOnly(False)
   257                 self.output.AddText(s)
   258                 self.output.AddText(s)
       
   259                 self.output.SetReadOnly(True)
   258                 if style != self.black_white:
   260                 if style != self.black_white:
   259                     self.output.SetStyling(len(s), style)
   261                     self.output.SetStyling(len(s), style)
   260             self.stack = []
   262             self.stack = []
   261             self.lock.release()
   263             self.lock.release()
   262             self.output.ScrollToLine(self.output.GetLineCount())
   264             self.output.ScrollToLine(self.output.GetLineCount())
   398         self.SetAcceleratorTable(wx.AcceleratorTable(accels))
   400         self.SetAcceleratorTable(wx.AcceleratorTable(accels))
   399         
   401         
   400         self.LogConsole = wx.stc.StyledTextCtrl(id=ID_BEREMIZLOGCONSOLE,
   402         self.LogConsole = wx.stc.StyledTextCtrl(id=ID_BEREMIZLOGCONSOLE,
   401                   name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0),
   403                   name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0),
   402                   size=wx.Size(0, 0))
   404                   size=wx.Size(0, 0))
       
   405         self.LogConsole.Bind(wx.EVT_SET_FOCUS, self.OnLogConsoleFocusChanged)
       
   406         self.LogConsole.Bind(wx.EVT_KILL_FOCUS, self.OnLogConsoleFocusChanged)
       
   407         self.LogConsole.Bind(wx.stc.EVT_STC_UPDATEUI, self.OnLogConsoleUpdateUI)
       
   408         self.LogConsole.SetReadOnly(True)
   403         self.LogConsole.SetWrapMode(wx.stc.STC_WRAP_CHAR)
   409         self.LogConsole.SetWrapMode(wx.stc.STC_WRAP_CHAR)
   404         
   410         
   405         # Define Log Console styles
   411         # Define Log Console styles
   406         self.LogConsole.StyleSetSpec(wx.stc.STC_STYLE_DEFAULT, "face:%(mono)s,size:%(size)d" % faces)
   412         self.LogConsole.StyleSetSpec(wx.stc.STC_STYLE_DEFAULT, "face:%(mono)s,size:%(size)d" % faces)
   407         self.LogConsole.StyleClearAll()
   413         self.LogConsole.StyleClearAll()
   557         # one under the cursor, if any, or this frame.
   563         # one under the cursor, if any, or this frame.
   558         wnd = wx.FindWindowAtPointer()
   564         wnd = wx.FindWindowAtPointer()
   559         if not wnd:
   565         if not wnd:
   560             wnd = self
   566             wnd = self
   561         InspectionTool().Show(wnd, True)
   567         InspectionTool().Show(wnd, True)
       
   568 
       
   569     def OnLogConsoleFocusChanged(self, event):
       
   570         if self:
       
   571             self.RefreshEditMenu()
       
   572         event.Skip()
       
   573 
       
   574     def OnLogConsoleUpdateUI(self, event):
       
   575         self.SetCopyBuffer(self.LogConsole.GetSelectedText(), True)
       
   576         event.Skip()
   562 
   577 
   563     def OnLogConsoleMarginClick(self, event):
   578     def OnLogConsoleMarginClick(self, event):
   564         line_idx = self.LogConsole.LineFromPosition(event.GetPosition())
   579         line_idx = self.LogConsole.LineFromPosition(event.GetPosition())
   565         wx.CallAfter(self.SearchLineForError, self.LogConsole.GetLine(line_idx))
   580         wx.CallAfter(self.SearchLineForError, self.LogConsole.GetLine(line_idx))
   566         event.Skip()
   581         event.Skip()
   760         self.AUIManager.GetPane("StatusToolBar").Position(1)
   775         self.AUIManager.GetPane("StatusToolBar").Position(1)
   761         self.AUIManager.Update()
   776         self.AUIManager.Update()
   762     
   777     
   763     def RefreshEditMenu(self):
   778     def RefreshEditMenu(self):
   764         IDEFrame.RefreshEditMenu(self)
   779         IDEFrame.RefreshEditMenu(self)
       
   780         if self.FindFocus() == self.LogConsole:
       
   781             self.EditMenu.Enable(wx.ID_COPY, True)
       
   782             self.Panes["MenuToolBar"].EnableTool(wx.ID_COPY, True)
   765         
   783         
   766         if self.CTR is not None:
   784         if self.CTR is not None:
   767             selected = self.TabsOpened.GetSelection()
   785             selected = self.TabsOpened.GetSelection()
   768             if selected >= 0:
   786             if selected >= 0:
   769                 panel = self.TabsOpened.GetPage(selected)
   787                 panel = self.TabsOpened.GetPage(selected)