fix bug with recent projects menu, remove path to the project from menu, if project directory doesn't exist
--- a/Beremiz.py Tue Dec 13 17:40:03 2016 +0300
+++ b/Beremiz.py Tue Dec 13 17:47:34 2016 +0300
@@ -973,12 +973,11 @@
if os.path.isdir(projectpath):
self.Config.Write("lastopenedfolder",
EncodeFileSystemPath(os.path.dirname(projectpath)))
- err = False
self.Config.Flush()
self.ResetView()
self.CTR = ProjectController(self, self.Log)
self.Controler = self.CTR
- result = self.CTR.LoadProject(projectpath)
+ result, err = self.CTR.LoadProject(projectpath)
if not result:
self.LibraryPanel.SetController(self.Controler)
self.ProjectTree.Enable(True)
--- a/ProjectController.py Tue Dec 13 17:40:03 2016 +0300
+++ b/ProjectController.py Tue Dec 13 17:47:34 2016 +0300
@@ -355,7 +355,7 @@
# Verify that project contains a PLCOpen program
plc_file = os.path.join(ProjectPath, "plc.xml")
if not os.path.isfile(plc_file):
- return _("Chosen folder doesn't contain a program. It's not a valid project!")
+ return _("Chosen folder doesn't contain a program. It's not a valid project!"), True
# Load PLCOpen file
error = self.OpenXMLFile(plc_file)
if error is not None:
@@ -363,7 +363,7 @@
(fname_err, lnum, src) = (("PLC",) + error)
self.logger.write_warning(XSDSchemaErrorMessage.format(a1 = fname_err, a2 = lnum, a3 = src))
else:
- return error
+ return error, False
if len(self.GetProjectConfigNames()) == 0:
self.AddProjectDefaultConfiguration()
# Change XSD into class members
@@ -377,12 +377,12 @@
#Load the confnode.xml file into parameters members
result = self.LoadXMLParams()
if result:
- return result
+ return result, False
#Load and init all the children
self.LoadChildren()
self.RefreshConfNodesBlockLists()
self.UpdateButtons()
- return None
+ return None, False
def RecursiveConfNodeInfos(self, confnode):
values = []