# HG changeset patch # User etisserant # Date 1187101680 -7200 # Node ID bc29b3bf2a5a89fd2f97a80b75239fcab9863915 # Parent 56bae4ff53c4d41bba2f97e7d44f0eecad42e140 Improved error report diff -r 56bae4ff53c4 -r bc29b3bf2a5a Beremiz.py --- a/Beremiz.py Tue Aug 14 15:11:27 2007 +0200 +++ b/Beremiz.py Tue Aug 14 16:28:00 2007 +0200 @@ -36,6 +36,8 @@ ieclib_path = os.path.join(base_folder, "matiec", "lib") from PLCOpenEditor import PLCOpenEditor, ProjectDialog +from TextViewer import * +from plcopen.structures import IEC_KEYWORDS from PLCControler import PLCControler from networkedit import networkedit @@ -681,15 +683,21 @@ self.Log.flush() #sys.stdout = self.Log try: - self.Log.write("Building ST Program...\n") + self.Log.write("Generating IEC-61131 code...\n") plc_file = os.path.join(self.TargetDir, "plc.st") result = self.PLCManager.GenerateProgram(plc_file) if not result: - raise Exception, "ST/IL/SFC code generator returned %d"%result + raise Exception, "Error : ST/IL/SFC code generator returned %d"%result self.Log.write("Compiling ST Program in to C Program...\n") status, result, err_result = self.LogCommand("%s %s -I %s %s"%(iec2cc_path, plc_file, ieclib_path, self.TargetDir)) if status: - raise Exception, "IEC2C compiler returned %d"%status + new_dialog = wx.Frame(None) + ST_viewer = TextViewer(new_dialog, None, None) + #ST_viewer.Enable(False) + ST_viewer.SetKeywords(IEC_KEYWORDS) + ST_viewer.SetText(file(plc_file).read()) + new_dialog.Show() + raise Exception, "Error : IEC to C compiler returned %d"%status self.Log.write("Extracting Located Variables...\n") location_file = open(os.path.join(self.TargetDir,"LOCATED_VARIABLES.h")) locations = []