109 self.LastRefreshTime = gettime() |
109 self.LastRefreshTime = gettime() |
110 self.LastRefreshTimer = None |
110 self.LastRefreshTimer = None |
111 |
111 |
112 def write(self, s, style = None): |
112 def write(self, s, style = None): |
113 if self.lock.acquire(): |
113 if self.lock.acquire(): |
114 self.stack.append((s,style)) |
114 self.stack.append((s, style)) |
115 self.lock.release() |
115 self.lock.release() |
116 current_time = gettime() |
116 current_time = gettime() |
117 self.TimerAccessLock.acquire() |
117 self.TimerAccessLock.acquire() |
118 if self.LastRefreshTimer: |
118 if self.LastRefreshTimer: |
119 self.LastRefreshTimer.cancel() |
119 self.LastRefreshTimer.cancel() |
178 if newtime - self.rising_timer > 1: |
178 if newtime - self.rising_timer > 1: |
179 self.risecall(self.output) |
179 self.risecall(self.output) |
180 self.rising_timer = newtime |
180 self.rising_timer = newtime |
181 |
181 |
182 def write_warning(self, s): |
182 def write_warning(self, s): |
183 self.write(s,self.red_white) |
183 self.write(s, self.red_white) |
184 |
184 |
185 def write_error(self, s): |
185 def write_error(self, s): |
186 self.write(s,self.red_yellow) |
186 self.write(s, self.red_yellow) |
187 |
187 |
188 def writeyield(self, s): |
188 def writeyield(self, s): |
189 self.write(s) |
189 self.write(s) |
190 wx.GetApp().Yield() |
190 wx.GetApp().Yield() |
191 |
191 |
317 |
317 |
318 keyID = wx.NewId() |
318 keyID = wx.NewId() |
319 self.Bind(wx.EVT_MENU, self.SwitchFullScrMode, id=keyID) |
319 self.Bind(wx.EVT_MENU, self.SwitchFullScrMode, id=keyID) |
320 accels += [wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F12, keyID)] |
320 accels += [wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F12, keyID)] |
321 |
321 |
322 for method,shortcut in [("Stop", wx.WXK_F4), |
322 for method, shortcut in [("Stop", wx.WXK_F4), |
323 ("Run", wx.WXK_F5), |
323 ("Run", wx.WXK_F5), |
324 ("Transfer", wx.WXK_F6), |
324 ("Transfer", wx.WXK_F6), |
325 ("Connect", wx.WXK_F7), |
325 ("Connect", wx.WXK_F7), |
326 ("Build", wx.WXK_F11)]: |
326 ("Build", wx.WXK_F11)]: |
327 def OnMethodGen(obj,meth): |
327 def OnMethodGen(obj, meth): |
328 def OnMethod(evt): |
328 def OnMethod(evt): |
329 if obj.CTR is not None: |
329 if obj.CTR is not None: |
330 obj.CTR.CallMethod('_'+meth) |
330 obj.CTR.CallMethod('_'+meth) |
331 wx.CallAfter(self.RefreshStatusToolBar) |
331 wx.CallAfter(self.RefreshStatusToolBar) |
332 return OnMethod |
332 return OnMethod |
333 newid = wx.NewId() |
333 newid = wx.NewId() |
334 self.Bind(wx.EVT_MENU, OnMethodGen(self,method), id=newid) |
334 self.Bind(wx.EVT_MENU, OnMethodGen(self, method), id=newid) |
335 accels += [wx.AcceleratorEntry(wx.ACCEL_NORMAL, shortcut,newid)] |
335 accels += [wx.AcceleratorEntry(wx.ACCEL_NORMAL, shortcut, newid)] |
336 |
336 |
337 self.SetAcceleratorTable(wx.AcceleratorTable(accels)) |
337 self.SetAcceleratorTable(wx.AcceleratorTable(accels)) |
338 |
338 |
339 self.LogConsole = CustomStyledTextCtrl( |
339 self.LogConsole = CustomStyledTextCtrl( |
340 name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0), |
340 name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0), |
403 # Add beremiz's icon in top left corner of the frame |
403 # Add beremiz's icon in top left corner of the frame |
404 self.icon = wx.Icon(Bpath("images", "brz.ico"), wx.BITMAP_TYPE_ICO) |
404 self.icon = wx.Icon(Bpath("images", "brz.ico"), wx.BITMAP_TYPE_ICO) |
405 self.__init_execute_path() |
405 self.__init_execute_path() |
406 |
406 |
407 IDEFrame.__init__(self, parent, debug) |
407 IDEFrame.__init__(self, parent, debug) |
408 self.Log = LogPseudoFile(self.LogConsole,self.SelectTab) |
408 self.Log = LogPseudoFile(self.LogConsole, self.SelectTab) |
409 |
409 |
410 self.local_runtime = None |
410 self.local_runtime = None |
411 self.runtime_port = None |
411 self.runtime_port = None |
412 self.local_runtime_tmpdir = None |
412 self.local_runtime_tmpdir = None |
413 |
413 |
485 self.local_runtime = ProcessLogger(self.Log, |
485 self.local_runtime = ProcessLogger(self.Log, |
486 "\"%s\" \"%s\" -p %s -i localhost %s %s" % ( |
486 "\"%s\" \"%s\" -p %s -i localhost %s %s" % ( |
487 sys.executable, |
487 sys.executable, |
488 Bpath("Beremiz_service.py"), |
488 Bpath("Beremiz_service.py"), |
489 self.runtime_port, |
489 self.runtime_port, |
490 {False: "-x 0", True:"-x 1"}[taskbaricon], |
490 {False: "-x 0", True: "-x 1"}[taskbaricon], |
491 self.local_runtime_tmpdir), |
491 self.local_runtime_tmpdir), |
492 no_gui=False, |
492 no_gui=False, |
493 timeout=500, keyword = self.local_runtime_tmpdir, |
493 timeout=500, keyword = self.local_runtime_tmpdir, |
494 cwd = self.local_runtime_tmpdir) |
494 cwd = self.local_runtime_tmpdir) |
495 self.local_runtime.spin() |
495 self.local_runtime.spin() |
727 StatusToolBar.ClearTools() |
727 StatusToolBar.ClearTools() |
728 |
728 |
729 if self.CTR is not None: |
729 if self.CTR is not None: |
730 |
730 |
731 for confnode_method in self.CTR.StatusMethods: |
731 for confnode_method in self.CTR.StatusMethods: |
732 if "method" in confnode_method and confnode_method.get("shown",True): |
732 if "method" in confnode_method and confnode_method.get("shown", True): |
733 id = wx.NewId() |
733 id = wx.NewId() |
734 StatusToolBar.AddSimpleTool(id, |
734 StatusToolBar.AddSimpleTool(id, |
735 GetBitmap(confnode_method.get("bitmap", "Unknown")), |
735 GetBitmap(confnode_method.get("bitmap", "Unknown")), |
736 confnode_method["tooltip"]) |
736 confnode_method["tooltip"]) |
737 self.Bind(wx.EVT_MENU, self.GetMenuCallBackFunction(confnode_method["method"]), id=id) |
737 self.Bind(wx.EVT_MENU, self.GetMenuCallBackFunction(confnode_method["method"]), id=id) |
1091 Max_Traceback_List_Size = 20 |
1091 Max_Traceback_List_Size = 20 |
1092 |
1092 |
1093 |
1093 |
1094 def Display_Exception_Dialog(e_type, e_value, e_tb, bug_report_path): |
1094 def Display_Exception_Dialog(e_type, e_value, e_tb, bug_report_path): |
1095 trcbck_lst = [] |
1095 trcbck_lst = [] |
1096 for i,line in enumerate(traceback.extract_tb(e_tb)): |
1096 for i, line in enumerate(traceback.extract_tb(e_tb)): |
1097 trcbck = " " + str(i+1) + ". " |
1097 trcbck = " " + str(i+1) + ". " |
1098 if line[0].find(os.getcwd()) == -1: |
1098 if line[0].find(os.getcwd()) == -1: |
1099 trcbck += "file : " + str(line[0]) + ", " |
1099 trcbck += "file : " + str(line[0]) + ", " |
1100 else: |
1100 else: |
1101 trcbck += "file : " + str(line[0][len(os.getcwd()):]) + ", " |
1101 trcbck += "file : " + str(line[0][len(os.getcwd()):]) + ", " |
1143 ignored_exceptions = [] # a problem with a line in a module is only reported once per session |
1143 ignored_exceptions = [] # a problem with a line in a module is only reported once per session |
1144 |
1144 |
1145 |
1145 |
1146 def AddExceptHook(path, app_version='[No version]'): #, ignored_exceptions=[]): |
1146 def AddExceptHook(path, app_version='[No version]'): #, ignored_exceptions=[]): |
1147 |
1147 |
1148 def save_bug_report(e_type, e_value, e_traceback, bug_report_path,date): |
1148 def save_bug_report(e_type, e_value, e_traceback, bug_report_path, date): |
1149 info = { |
1149 info = { |
1150 'app-title': wx.GetApp().GetAppName(), # app_title |
1150 'app-title': wx.GetApp().GetAppName(), # app_title |
1151 'app-version': app_version, |
1151 'app-version': app_version, |
1152 'wx-version': wx.VERSION_STRING, |
1152 'wx-version': wx.VERSION_STRING, |
1153 'wx-platform': wx.Platform, |
1153 'wx-platform': wx.Platform, |