equal
deleted
inserted
replaced
334 |
334 |
335 def OnSaveProjectAsMenu(self, event): |
335 def OnSaveProjectAsMenu(self, event): |
336 self.SaveProjectAs() |
336 self.SaveProjectAs() |
337 |
337 |
338 def OnGenerateProgramMenu(self, event): |
338 def OnGenerateProgramMenu(self, event): |
339 dialog = wx.FileDialog(self, _("Choose a file"), os.getcwd(), self.Controler.GetProgramFilePath(), _("ST files (*.st)|*.st|All files|*.*"), wx.SAVE|wx.CHANGE_DIR) |
339 dialog = wx.FileDialog(self, _("Choose a file"), os.getcwd(), self.Controler.GetProgramFilePath(), _("ST files (*.st)|*.st|All files|*.*"), wx.SAVE | wx.CHANGE_DIR) |
340 if dialog.ShowModal() == wx.ID_OK: |
340 if dialog.ShowModal() == wx.ID_OK: |
341 filepath = dialog.GetPath() |
341 filepath = dialog.GetPath() |
342 message_text = "" |
342 message_text = "" |
343 header, icon = _("Done"), wx.ICON_INFORMATION |
343 header, icon = _("Done"), wx.ICON_INFORMATION |
344 if os.path.isdir(os.path.dirname(filepath)): |
344 if os.path.isdir(os.path.dirname(filepath)): |
351 else: |
351 else: |
352 message_text += _("Program was successfully generated!") |
352 message_text += _("Program was successfully generated!") |
353 else: |
353 else: |
354 message_text += _("\"%s\" is not a valid folder!") % os.path.dirname(filepath) |
354 message_text += _("\"%s\" is not a valid folder!") % os.path.dirname(filepath) |
355 header, icon = _("Error"), wx.ICON_ERROR |
355 header, icon = _("Error"), wx.ICON_ERROR |
356 message = wx.MessageDialog(self, message_text, header, wx.OK|icon) |
356 message = wx.MessageDialog(self, message_text, header, wx.OK | icon) |
357 message.ShowModal() |
357 message.ShowModal() |
358 message.Destroy() |
358 message.Destroy() |
359 dialog.Destroy() |
359 dialog.Destroy() |
360 |
360 |
361 def OnPLCOpenEditorMenu(self, event): |
361 def OnPLCOpenEditorMenu(self, event): |
383 filepath = self.Controler.GetFilePath() |
383 filepath = self.Controler.GetFilePath() |
384 if filepath != "": |
384 if filepath != "": |
385 directory, filename = os.path.split(filepath) |
385 directory, filename = os.path.split(filepath) |
386 else: |
386 else: |
387 directory, filename = os.getcwd(), "%(projectName)s.xml" % self.Controler.GetProjectProperties() |
387 directory, filename = os.getcwd(), "%(projectName)s.xml" % self.Controler.GetProjectProperties() |
388 dialog = wx.FileDialog(self, _("Choose a file"), directory, filename, _("PLCOpen files (*.xml)|*.xml|All files|*.*"), wx.SAVE|wx.OVERWRITE_PROMPT) |
388 dialog = wx.FileDialog(self, _("Choose a file"), directory, filename, _("PLCOpen files (*.xml)|*.xml|All files|*.*"), wx.SAVE | wx.OVERWRITE_PROMPT) |
389 if dialog.ShowModal() == wx.ID_OK: |
389 if dialog.ShowModal() == wx.ID_OK: |
390 filepath = dialog.GetPath() |
390 filepath = dialog.GetPath() |
391 if os.path.isdir(os.path.dirname(filepath)): |
391 if os.path.isdir(os.path.dirname(filepath)): |
392 result = self.Controler.SaveXMLFile(filepath) |
392 result = self.Controler.SaveXMLFile(filepath) |
393 if not result: |
393 if not result: |
442 |
442 |
443 return res |
443 return res |
444 |
444 |
445 |
445 |
446 def Display_Error_Dialog(e_value): |
446 def Display_Error_Dialog(e_value): |
447 message = wx.MessageDialog(None, str(e_value), _("Error"), wx.OK|wx.ICON_ERROR) |
447 message = wx.MessageDialog(None, str(e_value), _("Error"), wx.OK | wx.ICON_ERROR) |
448 message.ShowModal() |
448 message.ShowModal() |
449 message.Destroy() |
449 message.Destroy() |
450 |
450 |
451 |
451 |
452 def get_last_traceback(tb): |
452 def get_last_traceback(tb): |