PLCControler.py
changeset 274 047e36c63736
parent 269 34eff05909b0
child 275 acf474a94136
equal deleted inserted replaced
273:5b18d98aa4f9 274:047e36c63736
   557             # Add the pou to project
   557             # Add the pou to project
   558             self.Project.appendpou(pou_name, pou_type, body_type)
   558             self.Project.appendpou(pou_name, pou_type, body_type)
   559             if pou_type == "function":
   559             if pou_type == "function":
   560                 self.SetPouInterfaceReturnType(pou_name, "BOOL")
   560                 self.SetPouInterfaceReturnType(pou_name, "BOOL")
   561             self.BufferProject()
   561             self.BufferProject()
       
   562     
       
   563     def ProjectCreatePouFrom(self, name, from_name):
       
   564         if self.Project is not None:
       
   565             pou = self.Project.getpou(from_name)
       
   566             if pou is not None:
       
   567                 new_pou = self.Copy(pou)
       
   568                 new_pou.setname(name)
       
   569                 self.Project.insertpou(-1, new_pou)
       
   570                 self.BufferProject()
   562     
   571     
   563     # Remove a Pou from project
   572     # Remove a Pou from project
   564     def ProjectRemovePou(self, pou_name):
   573     def ProjectRemovePou(self, pou_name):
   565         if self.Project is not None:
   574         if self.Project is not None:
   566             self.Project.removepou(pou_name)
   575             self.Project.removepou(pou_name)
  2574             
  2583             
  2575             text = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
  2584             text = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
  2576             extras = {"xmlns" : "http://www.plcopen.org/xml/tc6.xsd",
  2585             extras = {"xmlns" : "http://www.plcopen.org/xml/tc6.xsd",
  2577                       "xmlns:xhtml" : "http://www.w3.org/1999/xhtml",
  2586                       "xmlns:xhtml" : "http://www.w3.org/1999/xhtml",
  2578                       "xmlns:xsi" : "http://www.w3.org/2001/XMLSchema-instance",
  2587                       "xmlns:xsi" : "http://www.w3.org/2001/XMLSchema-instance",
  2579                       "xsi:schemaLocation" : "http://www.plcopen.org/xml/tc6.xsd http://www.plcopen.org/xml/tc6.xsd"}
  2588                       "xsi:schemaLocation" : "http://www.plcopen.org/xml/tc6.xsd"}
  2580             text += self.Project.generateXMLText("project", 0, extras)
  2589             text += self.Project.generateXMLText("project", 0, extras)
  2581             
  2590             
  2582             if filepath:
  2591             if filepath:
  2583                 xmlfile = open(filepath,"w")
  2592                 xmlfile = open(filepath,"w")
  2584             else:
  2593             else: