PLCControler.py
changeset 555 b6f9d08fd69f
parent 552 a387f258814a
child 560 3757f0de0d07
equal deleted inserted replaced
554:08c26c62f5a7 555:b6f9d08fd69f
   572     def ProjectAddDataType(self, datatype_name):
   572     def ProjectAddDataType(self, datatype_name):
   573         if self.Project is not None:
   573         if self.Project is not None:
   574             # Add the datatype to project
   574             # Add the datatype to project
   575             self.Project.appenddataType(datatype_name)
   575             self.Project.appenddataType(datatype_name)
   576             self.BufferProject()
   576             self.BufferProject()
       
   577             return self.ComputeDataTypeName(datatype_name)
       
   578         return None
   577         
   579         
   578     # Remove a Data Type from project
   580     # Remove a Data Type from project
   579     def ProjectRemoveDataType(self, datatype_name):
   581     def ProjectRemoveDataType(self, datatype_name):
   580         if self.Project is not None:
   582         if self.Project is not None:
   581             self.Project.removedataType(datatype_name)
   583             self.Project.removedataType(datatype_name)
   587             # Add the pou to project
   589             # Add the pou to project
   588             self.Project.appendpou(pou_name, pou_type, body_type)
   590             self.Project.appendpou(pou_name, pou_type, body_type)
   589             if pou_type == "function":
   591             if pou_type == "function":
   590                 self.SetPouInterfaceReturnType(pou_name, "BOOL")
   592                 self.SetPouInterfaceReturnType(pou_name, "BOOL")
   591             self.BufferProject()
   593             self.BufferProject()
       
   594             return self.ComputePouName(pou_name)
       
   595         return None
   592     
   596     
   593     def ProjectChangePouType(self, name, pou_type):
   597     def ProjectChangePouType(self, name, pou_type):
   594         if self.Project is not None:
   598         if self.Project is not None:
   595             pou = self.Project.getpou(name)
   599             pou = self.Project.getpou(name)
   596             if pou is not None:
   600             if pou is not None:
   656     # Add a configuration to Project
   660     # Add a configuration to Project
   657     def ProjectAddConfiguration(self, config_name):
   661     def ProjectAddConfiguration(self, config_name):
   658         if self.Project is not None:
   662         if self.Project is not None:
   659             self.Project.addconfiguration(config_name)
   663             self.Project.addconfiguration(config_name)
   660             self.BufferProject()
   664             self.BufferProject()
       
   665             return self.ComputeConfigurationName(config_name)
       
   666         return None
   661     
   667     
   662     # Remove a configuration from project
   668     # Remove a configuration from project
   663     def ProjectRemoveConfiguration(self, config_name):
   669     def ProjectRemoveConfiguration(self, config_name):
   664         if self.Project is not None:
   670         if self.Project is not None:
   665             self.Project.removeconfiguration(config_name)
   671             self.Project.removeconfiguration(config_name)
   668     # Add a resource to a configuration of the Project
   674     # Add a resource to a configuration of the Project
   669     def ProjectAddConfigurationResource(self, config_name, resource_name):
   675     def ProjectAddConfigurationResource(self, config_name, resource_name):
   670         if self.Project is not None:
   676         if self.Project is not None:
   671             self.Project.addconfigurationResource(config_name, resource_name)
   677             self.Project.addconfigurationResource(config_name, resource_name)
   672             self.BufferProject()
   678             self.BufferProject()
       
   679             return self.ComputeConfigurationResourceName(config_name, resource_name)
       
   680         return None
   673     
   681     
   674     # Remove a resource from a configuration of the project
   682     # Remove a resource from a configuration of the project
   675     def ProjectRemoveConfigurationResource(self, config_name, resource_name):
   683     def ProjectRemoveConfigurationResource(self, config_name, resource_name):
   676         if self.Project is not None:
   684         if self.Project is not None:
   677             self.Project.removeconfigurationResource(config_name, resource_name)
   685             self.Project.removeconfigurationResource(config_name, resource_name)
   682         if self.Project is not None:
   690         if self.Project is not None:
   683             pou = self.Project.getpou(pou_name)
   691             pou = self.Project.getpou(pou_name)
   684             if pou is not None:
   692             if pou is not None:
   685                 pou.addtransition(transition_name, transition_type)
   693                 pou.addtransition(transition_name, transition_type)
   686                 self.BufferProject()
   694                 self.BufferProject()
       
   695                 return self.ComputePouTransitionName(pou_name, transition_name)
       
   696         return None
   687     
   697     
   688     # Remove a Transition from a Project Pou
   698     # Remove a Transition from a Project Pou
   689     def ProjectRemovePouTransition(self, pou_name, transition_name):
   699     def ProjectRemovePouTransition(self, pou_name, transition_name):
   690         # Search if the pou removed is currently opened
   700         # Search if the pou removed is currently opened
   691         if self.Project is not None:
   701         if self.Project is not None:
   699         if self.Project is not None:
   709         if self.Project is not None:
   700             pou = self.Project.getpou(pou_name)
   710             pou = self.Project.getpou(pou_name)
   701             if pou is not None:
   711             if pou is not None:
   702                 pou.addaction(action_name, action_type)
   712                 pou.addaction(action_name, action_type)
   703                 self.BufferProject()
   713                 self.BufferProject()
       
   714                 return self.ComputePouActionName(pou_name, action_name)
       
   715         return None
   704     
   716     
   705     # Remove an Action from a Project Pou
   717     # Remove an Action from a Project Pou
   706     def ProjectRemovePouAction(self, pou_name, action_name):
   718     def ProjectRemovePouAction(self, pou_name, action_name):
   707         # Search if the pou removed is currently opened
   719         # Search if the pou removed is currently opened
   708         if self.Project is not None:
   720         if self.Project is not None: