Adding support for defining plugin library as a plcopen xml file in plugin folder
--- a/PLCControler.py Tue Dec 09 10:01:12 2008 +0100
+++ b/PLCControler.py Thu Dec 11 09:13:22 2008 +0100
@@ -498,17 +498,20 @@
return project.ElementIsUsedBy(name, reference)
return False
- def GenerateProgram(self, filepath):
+ def GenerateProgram(self, filepath=None):
if self.Project is not None:
try:
self.ProgramChunks = GenerateCurrentProgram(self, 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)
- programfile.close()
- self.ProgramFilePath = filepath
- return None
+ if filepath is not None:
+ programfile = open(filepath, "w")
+ programfile.write(program_text)
+ programfile.close()
+ self.ProgramFilePath = filepath
+ return None
+ else:
+ return program_text
except PLCGenException, e:
return e.message
return "No project opened"