145 from editors.ResourceEditor import ConfigurationEditor, ResourceEditor |
145 from editors.ResourceEditor import ConfigurationEditor, ResourceEditor |
146 from editors.DataTypeEditor import DataTypeEditor |
146 from editors.DataTypeEditor import DataTypeEditor |
147 from util.MiniTextControler import MiniTextControler |
147 from util.MiniTextControler import MiniTextControler |
148 from util.ProcessLogger import ProcessLogger |
148 from util.ProcessLogger import ProcessLogger |
149 from controls.LogViewer import LogViewer |
149 from controls.LogViewer import LogViewer |
|
150 from controls.CustomStyledTextCtrl import CustomStyledTextCtrl |
150 |
151 |
151 from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY, ITEM_PROJECT, ITEM_RESOURCE |
152 from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY, ITEM_PROJECT, ITEM_RESOURCE |
152 from ProjectController import ProjectController, MATIEC_ERROR_MODEL, ITEM_CONFNODE |
153 from ProjectController import ProjectController, MATIEC_ERROR_MODEL, ITEM_CONFNODE |
153 |
154 |
154 |
155 |
253 for s, style in self.stack: |
254 for s, style in self.stack: |
254 if style is None : style=self.black_white |
255 if style is None : style=self.black_white |
255 if style != self.black_white: |
256 if style != self.black_white: |
256 self.output.StartStyling(self.output.GetLength(), 0xff) |
257 self.output.StartStyling(self.output.GetLength(), 0xff) |
257 |
258 |
258 # Temporary deactivate read only mode on StyledTextCtrl for adding text |
259 # Temporary deactivate read only mode on StyledTextCtrl for |
259 # It seems that text modifications, even programmatically, are disabled |
260 # adding text. It seems that text modifications, even |
260 # in StyledTextCtrl when read only is active |
261 # programmatically, are disabled in StyledTextCtrl when read |
|
262 # only is active |
261 self.output.SetReadOnly(False) |
263 self.output.SetReadOnly(False) |
262 self.output.AddText(s) |
264 self.output.AppendText(s) |
263 self.output.SetReadOnly(True) |
265 self.output.SetReadOnly(True) |
264 |
266 |
265 if style != self.black_white: |
267 if style != self.black_white: |
266 self.output.SetStyling(len(s), style) |
268 self.output.SetStyling(len(s), style) |
267 self.stack = [] |
269 self.stack = [] |
268 self.lock.release() |
270 self.lock.release() |
269 self.output.ScrollToLine(self.output.GetLineCount()) |
|
270 self.output.Thaw() |
271 self.output.Thaw() |
271 self.LastRefreshTime = gettime() |
272 self.LastRefreshTime = gettime() |
272 try: |
273 try: |
273 self.RefreshLock.release() |
274 self.RefreshLock.release() |
274 except: |
275 except: |
287 def writeyield(self, s): |
288 def writeyield(self, s): |
288 self.write(s) |
289 self.write(s) |
289 wx.GetApp().Yield() |
290 wx.GetApp().Yield() |
290 |
291 |
291 def flush(self): |
292 def flush(self): |
292 # Temporary deactivate read only mode on StyledTextCtrl for clearing text |
293 # Temporary deactivate read only mode on StyledTextCtrl for clearing |
293 # It seems that text modifications, even programmatically, are disabled |
294 # text. It seems that text modifications, even programmatically, are |
294 # in StyledTextCtrl when read only is active |
295 # disabled in StyledTextCtrl when read only is active |
295 self.output.SetReadOnly(False) |
296 self.output.SetReadOnly(False) |
296 self.output.SetText("") |
297 self.output.SetText("") |
297 self.output.SetReadOnly(True) |
298 self.output.SetReadOnly(True) |
298 |
299 |
299 def isatty(self): |
300 def isatty(self): |
410 self.Bind(wx.EVT_MENU, OnMethodGen(self,method), id=newid) |
411 self.Bind(wx.EVT_MENU, OnMethodGen(self,method), id=newid) |
411 accels += [wx.AcceleratorEntry(wx.ACCEL_NORMAL, shortcut,newid)] |
412 accels += [wx.AcceleratorEntry(wx.ACCEL_NORMAL, shortcut,newid)] |
412 |
413 |
413 self.SetAcceleratorTable(wx.AcceleratorTable(accels)) |
414 self.SetAcceleratorTable(wx.AcceleratorTable(accels)) |
414 |
415 |
415 self.LogConsole = wx.stc.StyledTextCtrl(id=ID_BEREMIZLOGCONSOLE, |
416 self.LogConsole = CustomStyledTextCtrl(id=ID_BEREMIZLOGCONSOLE, |
416 name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0), |
417 name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0), |
417 size=wx.Size(0, 0)) |
418 size=wx.Size(0, 0)) |
418 self.LogConsole.Bind(wx.EVT_SET_FOCUS, self.OnLogConsoleFocusChanged) |
419 self.LogConsole.Bind(wx.EVT_SET_FOCUS, self.OnLogConsoleFocusChanged) |
419 self.LogConsole.Bind(wx.EVT_KILL_FOCUS, self.OnLogConsoleFocusChanged) |
420 self.LogConsole.Bind(wx.EVT_KILL_FOCUS, self.OnLogConsoleFocusChanged) |
420 self.LogConsole.Bind(wx.stc.EVT_STC_UPDATEUI, self.OnLogConsoleUpdateUI) |
421 self.LogConsole.Bind(wx.stc.EVT_STC_UPDATEUI, self.OnLogConsoleUpdateUI) |