--- a/LPCProjectController.py Mon Feb 12 14:03:47 2018 +0100
+++ b/LPCProjectController.py Mon Feb 12 14:44:43 2018 +0100
@@ -108,51 +108,24 @@
- # TODO : use the original function
def LoadProject(self, ProjectPath, BuildPath=None):
- Load a project contained in a folder
- @param ProjectPath: path of the project folder
+ Create plcopen project if plc.xml not found, + so that original LoadProject doesn't make errors. + After regular load, add CanOpen nodes if not already there, + and eventualy save project again. + TargetType is forced to MC9. - if os.path.basename(ProjectPath) == "":
- ProjectPath = os.path.dirname(ProjectPath)
- # Verify that project contains a PLCOpen program
plc_file = os.path.join(ProjectPath, "plc.xml")
- if os.path.isfile(plc_file):
- result = self.OpenXMLFile(plc_file)
+ if not os.path.isfile(plc_file): self.CreateNewProject({"companyName": "",
- if len(self.GetProjectConfigNames()) == 0:
- self.AddProjectDefaultConfiguration()
- # Change XSD into class members
- self._AddParamsMembers()
- # Keep track of the root confnode (i.e. project path)
- self.ProjectPath = ProjectPath
- self.BuildPath = self._getBuildPath()
- if self.OrigBuildPath is not None:
- mycopytree(self.OrigBuildPath, self.BuildPath)
- # If dir have already be made, and file exist
- if os.path.isdir(self.CTNPath()) and os.path.isfile(self.ConfNodeXmlFilePath()):
- # Load the confnode.xml file into parameters members
- result = self.LoadXMLParams()
- # Load and init all the children
+ ProjectController.LoadProject(self, ProjectPath, BuildPath=None): canopen_child = self.GetChildByName("CanOpen")
if canopen_child is None:
@@ -163,11 +136,9 @@
if self.CTNTestModified():
- if wx.GetApp() is None:
- self.RefreshConfNodesBlockLists()
- wx.CallAfter(self.RefreshConfNodesBlockLists)
+ self.RefreshConfNodesBlockLists() if self.arch in PLC_module:
self.SetParamsAttribute('BeremizRoot.TargetType', 'MC9')