diff -r cc5377a296ea -r 166ee9d2e233 PLCControler.py --- a/PLCControler.py Sun Sep 07 15:25:40 2008 +0200 +++ b/PLCControler.py Sun Sep 07 15:27:53 2008 +0200 @@ -182,6 +182,7 @@ self.FilePath = "" self.FileName = "" self.ProgramChunks = [] + self.NextCompiledProject = None self.CurrentCompiledProject = None self.PluginTypes = [] self.ProgramFilePath = "" @@ -214,6 +215,7 @@ # Initialize the project buffer self.ProjectBuffer = UndoBuffer(self.Copy(self.Project), False) self.ProgramChunks = [] + self.NextCompiledProject = self.Copy(self.Project) self.CurrentCompiledProject = None self.Buffering = False @@ -500,7 +502,7 @@ if self.Project is not None: try: self.ProgramChunks = GenerateCurrentProgram(self, self.Project) - self.CurrentCompiledProject = self.Copy(self.Project) + self.NextCompiledProject = self.Copy(self.Project) program_text = "".join([item[0] for item in self.ProgramChunks]) programfile = open(filepath, "w") programfile.write(program_text) @@ -511,6 +513,9 @@ return e.message return "No project opened" + def ProgramTransferred(self): + self.CurrentCompiledProject = self.NextCompiledProject + def GetChunkInfos(self, from_location, to_location): row = col = 1 infos = [] @@ -1086,13 +1091,13 @@ # Return Block types checking for recursion def GetBlockTypes(self, tagname = "", debug = False): type = None + words = tagname.split("::") if self.Project: name = "" - words = tagname.split("::") if words[0] in ["P","T","A"]: name = words[1] type = self.GetPouType(name, debug) - if type == "function": + if type == "function" or words[0] == "T": blocktypes = [] for category in BlockTypes + self.PluginTypes: cat = {"name" : category["name"], "list" : []} @@ -1105,7 +1110,7 @@ blocktypes = [category for category in BlockTypes + self.PluginTypes] project = self.GetProject(debug) if project is not None: - blocktypes.append({"name" : "User-defined POUs", "list": project.GetCustomBlockTypes(name)}) + blocktypes.append({"name" : "User-defined POUs", "list": project.GetCustomBlockTypes(name, type == "function" or words[0] == "T")}) return blocktypes # Return Function Block types checking for recursion @@ -2535,6 +2540,7 @@ self.Project.RefreshCustomBlockTypes() self.ProjectBuffer = UndoBuffer(self.Copy(self.Project), True) self.ProgramChunks = [] + self.NextCompiledProject = self.Copy(self.Project) self.CurrentCompiledProject = None self.Buffering = False self.CurrentElementEditing = None