diff -r 8137a7face88 -r 52689bda4686 PLCOpenEditor.py --- a/PLCOpenEditor.py Wed Dec 16 15:20:56 2009 +0100 +++ b/PLCOpenEditor.py Tue Jun 01 12:41:14 2010 +0200 @@ -2504,12 +2504,15 @@ def __init__(self, parent, fileOpen = None): IDEFrame.__init__(self, parent) + result = None + # Open the filepath if defined if fileOpen is not None and os.path.isfile(fileOpen): # Create a new controller self.Controler = PLCControler() - self.Controler.OpenXMLFile(fileOpen) - self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE) + result = self.Controler.OpenXMLFile(fileOpen) + if result is None: + self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE) # Define PLCOpenEditor icon self.SetIcon(wx.Icon(os.path.join(CWD,"Images", "poe.ico"),wx.BITMAP_TYPE_ICO)) @@ -2517,6 +2520,9 @@ self.Bind(wx.EVT_CLOSE, self.OnCloseFrame) self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU) + + if result is not None: + self.ShowErrorMessage(result) def OnCloseFrame(self, event): if self.Controler is None or self.CheckSaveBeforeClosing(_("Close Application")): @@ -2595,16 +2601,23 @@ directory = os.path.dirname(filepath) else: directory = os.getcwd() + + result = None + dialog = wx.FileDialog(self, _("Choose a file"), directory, "", _("PLCOpen files (*.xml)|*.xml|All files|*.*"), wx.OPEN) if dialog.ShowModal() == wx.ID_OK: filepath = dialog.GetPath() if os.path.isfile(filepath): self.ResetView() self.Controler = PLCControler() - self.Controler.OpenXMLFile(filepath) - self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE) + result = self.Controler.OpenXMLFile(filepath) + if result is None: + self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE) self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU) dialog.Destroy() + + if result is not None: + self.ShowErrorMessage(result) def OnCloseProjectMenu(self, event): if not self.CheckSaveBeforeClosing():