PLCControler.py
changeset 1739 ec153828ded2
parent 1736 7e61baa047f0
child 1740 b789b695b5c6
equal deleted inserted replaced
1738:d2e979738700 1739:ec153828ded2
  1643             blocktypes = [
  1643             blocktypes = [
  1644                 {"name": category["name"],
  1644                 {"name": category["name"],
  1645                  "list": [block for block in category["list"]
  1645                  "list": [block for block in category["list"]
  1646                           if block["type"] in filter]}
  1646                           if block["type"] in filter]}
  1647                 for category in self.TotalTypes]
  1647                 for category in self.TotalTypes]
  1648             blocktypes.append({"name" : USER_DEFINED_POUS,
  1648             blocktypes.append({"name": USER_DEFINED_POUS,
  1649                 "list": [pou.getblockInfos()
  1649                 "list": [pou.getblockInfos()
  1650                          for pou in project.getpous(name, filter)
  1650                          for pou in project.getpous(name, filter)
  1651                          if (name is None or
  1651                          if (name is None or
  1652                              len(self.GetInstanceList(pou, name, debug)) == 0)]})
  1652                              len(self.GetInstanceList(pou, name, debug)) == 0)]})
  1653             return blocktypes
  1653             return blocktypes
  1934     def ComputeConfigurationResourceName(self, config, resource):
  1934     def ComputeConfigurationResourceName(self, config, resource):
  1935         return "R::%s::%s" % (config, resource)
  1935         return "R::%s::%s" % (config, resource)
  1936 
  1936 
  1937     def GetElementType(self, tagname):
  1937     def GetElementType(self, tagname):
  1938         words = tagname.split("::")
  1938         words = tagname.split("::")
  1939         return {"D" : ITEM_DATATYPE, "P" : ITEM_POU,
  1939         return {
  1940                 "T" : ITEM_TRANSITION, "A" : ITEM_ACTION,
  1940             "D": ITEM_DATATYPE,
  1941                 "C" : ITEM_CONFIGURATION, "R" : ITEM_RESOURCE}[words[0]]
  1941             "P": ITEM_POU,
       
  1942             "T": ITEM_TRANSITION,
       
  1943             "A": ITEM_ACTION,
       
  1944             "C": ITEM_CONFIGURATION,
       
  1945             "R": ITEM_RESOURCE
       
  1946         }[words[0]]
  1942 
  1947 
  1943 #-------------------------------------------------------------------------------
  1948 #-------------------------------------------------------------------------------
  1944 #                    Project opened Data types management functions
  1949 #                    Project opened Data types management functions
  1945 #-------------------------------------------------------------------------------
  1950 #-------------------------------------------------------------------------------
  1946 
  1951