--- a/PLCOpenEditor.py Mon Jan 19 17:07:03 2009 +0100
+++ b/PLCOpenEditor.py Mon Jan 19 17:08:17 2009 +0100
@@ -883,20 +883,23 @@
dialog = wx.FileDialog(self, "Choose a file", os.getcwd(), self.Controler.GetProgramFilePath(), "ST files (*.st)|*.st|All files|*.*", wx.SAVE|wx.CHANGE_DIR)
if dialog.ShowModal() == wx.ID_OK:
filepath = dialog.GetPath()
+ message_text = ""
+ header, icon = "Done", wx.ICON_INFORMATION
if os.path.isdir(os.path.dirname(filepath)):
- result = self.Controler.GenerateProgram(filepath)
- if result is not None:
- message = wx.MessageDialog(self, "Can't generate program to file %s :\n%s"%(filepath, result), "Error", wx.OK|wx.ICON_ERROR)
- message.ShowModal()
- message.Destroy()
+ program, errors, warnings = self.Controler.GenerateProgram(filepath)
+ message_text += "".join(["warning: %s\n" for warning in warnings])
+ if len(errors) > 0:
+ message_text += "".join(["error: %s\n" for warning in warnings])
+ message_text += "Can't generate program to file %s!"%filepath
+ header, icon = "Error", wx.ICON_ERROR
else:
- message = wx.MessageDialog(self, "Program was successfully generated!", "Done", wx.OK|wx.ICON_INFORMATION)
- message.ShowModal()
- message.Destroy()
+ message_text += "Program was successfully generated!"
else:
- message = wx.MessageDialog(self, "%s is not a valid folder!"%os.path.dirname(filepath), "Error", wx.OK|wx.ICON_ERROR)
- message.ShowModal()
- message.Destroy()
+ message_text += "%s is not a valid folder!"%os.path.dirname(filepath)
+ header, icon = "Error", wx.ICON_ERROR
+ message = wx.MessageDialog(self, message_text, header, wx.OK|icon)
+ message.ShowModal()
+ message.Destroy()
dialog.Destroy()
event.Skip()