113 REFRESH_PERIOD = 0.1 |
113 REFRESH_PERIOD = 0.1 |
114 |
114 |
115 |
115 |
116 class LogPseudoFile(object): |
116 class LogPseudoFile(object): |
117 """ Base class for file like objects to facilitate StdOut for the Shell.""" |
117 """ Base class for file like objects to facilitate StdOut for the Shell.""" |
118 def __init__(self, output, risecall): |
118 def __init__(self, output, risecall, logf): |
119 self.red_white = 1 |
119 self.red_white = 1 |
120 self.red_yellow = 2 |
120 self.red_yellow = 2 |
121 self.black_white = wx.stc.STC_STYLE_DEFAULT |
121 self.black_white = wx.stc.STC_STYLE_DEFAULT |
122 self.output = output |
122 self.output = output |
123 self.risecall = risecall |
123 self.risecall = risecall |
129 self.TimerAccessLock = Lock() |
129 self.TimerAccessLock = Lock() |
130 self.stack = [] |
130 self.stack = [] |
131 self.LastRefreshTime = gettime() |
131 self.LastRefreshTime = gettime() |
132 self.LastRefreshTimer = None |
132 self.LastRefreshTimer = None |
133 self.refreshPending = False |
133 self.refreshPending = False |
|
134 self.logf = logf |
134 |
135 |
135 def write(self, s, style=None): |
136 def write(self, s, style=None): |
|
137 if self.logf is not None: |
|
138 self.logf.write(s) |
136 self.StackLock.acquire() |
139 self.StackLock.acquire() |
137 self.stack.append((s, style)) |
140 self.stack.append((s, style)) |
138 self.StackLock.release() |
141 self.StackLock.release() |
139 current_time = gettime() |
142 current_time = gettime() |
140 with self.TimerAccessLock: |
143 with self.TimerAccessLock: |
434 # then we prefix CWD to PATH in order to ensure that |
437 # then we prefix CWD to PATH in order to ensure that |
435 # commands invoked by build process by default are |
438 # commands invoked by build process by default are |
436 # found here. |
439 # found here. |
437 os.environ["PATH"] = os.getcwd()+';'+os.environ["PATH"] |
440 os.environ["PATH"] = os.getcwd()+';'+os.environ["PATH"] |
438 |
441 |
439 def __init__(self, parent, projectOpen=None, buildpath=None, ctr=None, debug=True): |
442 def __init__(self, parent, projectOpen=None, buildpath=None, ctr=None, debug=True, logf=None): |
440 # Add beremiz's icon in top left corner of the frame |
443 # Add beremiz's icon in top left corner of the frame |
441 self.icon = wx.Icon(Bpath("images", "brz.ico"), wx.BITMAP_TYPE_ICO) |
444 self.icon = wx.Icon(Bpath("images", "brz.ico"), wx.BITMAP_TYPE_ICO) |
442 self.__init_execute_path() |
445 self.__init_execute_path() |
443 |
446 |
444 IDEFrame.__init__(self, parent, debug) |
447 IDEFrame.__init__(self, parent, debug) |
445 self.Log = LogPseudoFile(self.LogConsole, self.SelectTab) |
448 self.Log = LogPseudoFile(self.LogConsole, self.SelectTab, logf) |
446 |
449 |
447 self.local_runtime = None |
450 self.local_runtime = None |
448 self.runtime_port = None |
451 self.runtime_port = None |
449 self.local_runtime_tmpdir = None |
452 self.local_runtime_tmpdir = None |
450 |
453 |