PLCControler.py
changeset 1372 ef26fcb7f5d4
parent 1368 e567e4bee11f
child 1373 4278d5c1e414
equal deleted inserted replaced
1371:3c55c99b10ab 1372:ef26fcb7f5d4
  1620                 for category in self.TotalTypes]
  1620                 for category in self.TotalTypes]
  1621             blocktypes.append({"name" : USER_DEFINED_POUS, 
  1621             blocktypes.append({"name" : USER_DEFINED_POUS, 
  1622                 "list": [pou.getblockInfos()
  1622                 "list": [pou.getblockInfos()
  1623                          for pou in project.getpous(name, filter)
  1623                          for pou in project.getpous(name, filter)
  1624                          if (name is None or 
  1624                          if (name is None or 
  1625                              len(self.GetInstanceList(pou, name, debug)) > 0)]})
  1625                              len(self.GetInstanceList(pou, name, debug)) == 0)]})
  1626             return blocktypes
  1626             return blocktypes
  1627         return self.TotalTypes
  1627         return self.TotalTypes
  1628 
  1628 
  1629     # Return Function Block types checking for recursion
  1629     # Return Function Block types checking for recursion
  1630     def GetFunctionBlockTypes(self, tagname = "", debug = False):
  1630     def GetFunctionBlockTypes(self, tagname = "", debug = False):
  1640                     blocktypes.append(block["name"])
  1640                     blocktypes.append(block["name"])
  1641         if project is not None:
  1641         if project is not None:
  1642             blocktypes.extend([pou.getname()
  1642             blocktypes.extend([pou.getname()
  1643                 for pou in project.getpous(name, ["functionBlock"])
  1643                 for pou in project.getpous(name, ["functionBlock"])
  1644                 if (name is None or 
  1644                 if (name is None or 
  1645                     len(self.GetInstanceList(pou, name, debug)) > 0)])
  1645                     len(self.GetInstanceList(pou, name, debug)) == 0)])
  1646         return blocktypes
  1646         return blocktypes
  1647 
  1647 
  1648     # Return Block types checking for recursion
  1648     # Return Block types checking for recursion
  1649     def GetBlockResource(self, debug = False):
  1649     def GetBlockResource(self, debug = False):
  1650         blocktypes = []
  1650         blocktypes = []
  1674             datatypes.extend([
  1674             datatypes.extend([
  1675                 datatype.getname() 
  1675                 datatype.getname() 
  1676                 for datatype in project.getdataTypes(name)
  1676                 for datatype in project.getdataTypes(name)
  1677                 if (not only_locatables or self.IsLocatableDataType(datatype, debug))
  1677                 if (not only_locatables or self.IsLocatableDataType(datatype, debug))
  1678                     and (name is None or 
  1678                     and (name is None or 
  1679                          len(self.GetInstanceList(datatype, name, debug)) > 0)])
  1679                          len(self.GetInstanceList(datatype, name, debug)) == 0)])
  1680         if confnodetypes:
  1680         if confnodetypes:
  1681             for category in self.GetConfNodeDataTypes(name, only_locatables):
  1681             for category in self.GetConfNodeDataTypes(name, only_locatables):
  1682                 datatypes.extend(category["list"])
  1682                 datatypes.extend(category["list"])
  1683         return datatypes
  1683         return datatypes
  1684 
  1684