PLCControler.py
changeset 1284 abf63a310532
parent 1283 f3cfe1ff917e
child 1290 13ee5f4ab612
equal deleted inserted replaced
1283:f3cfe1ff917e 1284:abf63a310532
   210         self.NextCompiledProject = None
   210         self.NextCompiledProject = None
   211         self.CurrentCompiledProject = None
   211         self.CurrentCompiledProject = None
   212         self.ConfNodeTypes = []
   212         self.ConfNodeTypes = []
   213         self.TotalTypesDict = StdBlckDct.copy()
   213         self.TotalTypesDict = StdBlckDct.copy()
   214         self.TotalTypes = StdBlckLst[:]
   214         self.TotalTypes = StdBlckLst[:]
   215         
   215         self.ProgramFilePath = ""
       
   216             
   216     def GetQualifierTypes(self):
   217     def GetQualifierTypes(self):
   217         return plcopen.QualifierList
   218         return plcopen.QualifierList
   218 
   219 
   219     def GetProject(self, debug = False):
   220     def GetProject(self, debug = False):
   220         if debug and self.CurrentCompiledProject is not None:
   221         if debug and self.CurrentCompiledProject is not None:
  1630         typename = None
  1631         typename = None
  1631         words = tagname.split("::")
  1632         words = tagname.split("::")
  1632         name = None
  1633         name = None
  1633         project = self.GetProject(debug)
  1634         project = self.GetProject(debug)
  1634         if project is not None:
  1635         if project is not None:
  1635             blocktypes = []
  1636             pou_type = None
  1636             if words[0] in ["P","T","A"]:
  1637             if words[0] in ["P","T","A"]:
       
  1638                 blocktypes = []
  1637                 name = words[1]
  1639                 name = words[1]
  1638                 typename = self.GetPouType(name, debug)
  1640                 pou_type = self.GetPouType(name, debug)
  1639                 if typename == "function":
  1641             if pou_type == "function":
  1640                     for category in self.TotalTypes:
  1642                 for category in self.TotalTypes:
  1641                         cat = {"name" : category["name"], "list" : []}
  1643                     cat = {"name" : category["name"], "list" : []}
  1642                         for block in category["list"]:
  1644                     for block in category["list"]:
  1643                             if block["type"] == "function":
  1645                         if block["type"] == "function":
  1644                                 cat["list"].append(block)
  1646                             cat["list"].append(block)
  1645                         if len(cat["list"]) > 0:
  1647                     if len(cat["list"]) > 0:
  1646                             blocktypes.append(cat)
  1648                         blocktypes.append(cat)
  1647                     blocktypes.append({"name" : USER_DEFINED_POUS, 
  1649             else:
  1648                         "list": project.GetCustomBlockTypes(name, 
  1650                 blocktypes = [category for category in self.TotalTypes]
  1649                             typename == "function" or words[0] == "T")})
  1651             blocktypes.append({"name" : USER_DEFINED_POUS, 
  1650                     return blocktypes
  1652                 "list": project.GetCustomBlockTypes(name, 
       
  1653                     pou_type == "function" or words[0] == "T")})
       
  1654             return blocktypes
  1651         return self.TotalTypes
  1655         return self.TotalTypes
  1652 
  1656 
  1653     # Return Function Block types checking for recursion
  1657     # Return Function Block types checking for recursion
  1654     def GetFunctionBlockTypes(self, tagname = "", debug = False):
  1658     def GetFunctionBlockTypes(self, tagname = "", debug = False):
  1655         blocktypes = []
  1659         blocktypes = []