PLCControler.py
changeset 57 9bf197698af0
parent 56 7187e1c00975
child 58 39cd981ff242
equal deleted inserted replaced
56:7187e1c00975 57:9bf197698af0
   850                 name = ""
   850                 name = ""
   851                 type = None
   851                 type = None
   852             if type == "function":
   852             if type == "function":
   853                 blocktypes = []
   853                 blocktypes = []
   854                 for category in BlockTypes[:-1]:
   854                 for category in BlockTypes[:-1]:
   855                     cat = {"name" : category["name"], "list" : []}
   855                     if category["name"] != "SVGUI function blocks":
   856                     for block in category["list"]:
   856                         cat = {"name" : category["name"], "list" : []}
   857                         if block["type"] == "function":
   857                         for block in category["list"]:
   858                             cat["list"].append(block)
   858                             if block["type"] == "function":
   859                     if len(cat["list"]) > 0:
   859                                 cat["list"].append(block)
   860                         blocktypes.append(cat)
   860                         if len(cat["list"]) > 0:
       
   861                             blocktypes.append(cat)
   861             else:
   862             else:
   862                 blocktypes = [category for category in BlockTypes[:-1]]
   863                 blocktypes = [category for category in BlockTypes[:-1] if category["name"] != "SVGUI function blocks"]
   863             if self.Project:
   864             if self.Project:
   864                 blocktypes.append({"name" : "User-defined POUs", "list": []})
   865                 blocktypes.append({"name" : "User-defined POUs", "list": []})
   865                 for blocktype in BlockTypes[-1]["list"]:
   866                 for blocktype in BlockTypes[-1]["list"]:
   866                     if blocktype["name"] != name and not self.PouIsUsedBy(name, blocktype["name"]) and not (type == "function" and blocktype["type"] != "function"):
   867                     if blocktype["name"] != name and not self.PouIsUsedBy(name, blocktype["name"]) and not (type == "function" and blocktype["type"] != "function"):
   867                         blocktypes[-1]["list"].append(blocktype)
   868                         blocktypes[-1]["list"].append(blocktype)