PLCOpenEditor.py
changeset 171 e3d47b4bbd5d
parent 163 e4949f54c5d6
child 176 18af41faafd1
equal deleted inserted replaced
170:5068ba721506 171:e3d47b4bbd5d
   701         dialog = wx.FileDialog(self, "Choose a file", os.getcwd(), self.Controler.GetProgramFilePath(),  "ST files (*.st)|*.st|All files|*.*", wx.SAVE|wx.CHANGE_DIR)
   701         dialog = wx.FileDialog(self, "Choose a file", os.getcwd(), self.Controler.GetProgramFilePath(),  "ST files (*.st)|*.st|All files|*.*", wx.SAVE|wx.CHANGE_DIR)
   702         if dialog.ShowModal() == wx.ID_OK:
   702         if dialog.ShowModal() == wx.ID_OK:
   703             filepath = dialog.GetPath()
   703             filepath = dialog.GetPath()
   704             if os.path.isdir(os.path.dirname(filepath)):
   704             if os.path.isdir(os.path.dirname(filepath)):
   705                 result = self.Controler.GenerateProgram(filepath)
   705                 result = self.Controler.GenerateProgram(filepath)
   706                 if not result:
   706                 if result is not None:
   707                     message = wx.MessageDialog(self, "Can't generate program to file %s!"%filepath, "Error", wx.OK|wx.ICON_ERROR)
   707                     message = wx.MessageDialog(self, "Can't generate program to file %s :\n%s"%(filepath, result), "Error", wx.OK|wx.ICON_ERROR)
   708                     message.ShowModal()
   708                     message.ShowModal()
   709                     message.Destroy()
   709                     message.Destroy()
   710                 else:
   710                 else:
   711                     message = wx.MessageDialog(self, "Program was successfully generated!", "Done", wx.OK|wx.ICON_INFORMATION)
   711                     message = wx.MessageDialog(self, "Program was successfully generated!", "Done", wx.OK|wx.ICON_INFORMATION)
   712                     message.ShowModal()
   712                     message.ShowModal()