PLCControler.py
changeset 826 098f822ef308
parent 823 c6ed7b933617
child 827 a2ce084fb598
equal deleted inserted replaced
825:0623820aa14a 826:098f822ef308
   452                                 var_class = ITEM_VAR_LOCAL
   452                                 var_class = ITEM_VAR_LOCAL
   453                             for variable in varlist.getvariable():
   453                             for variable in varlist.getvariable():
   454                                 var_infos = self.GetPouVariableInfos(project, variable, var_class, debug)
   454                                 var_infos = self.GetPouVariableInfos(project, variable, var_class, debug)
   455                                 if var_infos is not None:
   455                                 if var_infos is not None:
   456                                     vars.append(var_infos)
   456                                     vars.append(var_infos)
       
   457                         if pou.getbodyType() == "SFC":
       
   458                             for transition in pou.gettransitionList():
       
   459                                 vars.append({
       
   460                                     "name": transition.getname(),
       
   461                                     "type": None, 
       
   462                                     "class": ITEM_TRANSITION,
       
   463                                     "edit": True,
       
   464                                     "debug": True})
       
   465                             for action in pou.getactionList():
       
   466                                 vars.append({
       
   467                                     "name": action.getname(),
       
   468                                     "type": None, 
       
   469                                     "class": ITEM_ACTION,
       
   470                                     "edit": True,
       
   471                                     "debug": True})
   457                         return {"class": POU_TYPES[pou_type],
   472                         return {"class": POU_TYPES[pou_type],
   458                                 "type": words[1],
   473                                 "type": words[1],
   459                                 "variables": vars,
   474                                 "variables": vars,
   460                                 "edit": True,
   475                                 "edit": True,
   461                                 "debug": True}
   476                                 "debug": True}
   478                         return {"class": POU_TYPES[block_infos["type"]],
   493                         return {"class": POU_TYPES[block_infos["type"]],
   479                                 "type": None,
   494                                 "type": None,
   480                                 "variables": vars,
   495                                 "variables": vars,
   481                                 "edit": False,
   496                                 "edit": False,
   482                                 "debug": False}
   497                                 "debug": False}
       
   498             elif words[0] in ['A', 'T']:
       
   499                 pou_vars = self.GetPouVariables(self.ComputePouName(words[1]), debug)
       
   500                 if pou_vars is not None:
       
   501                     if words[0] == 'A':
       
   502                         element_type = ITEM_ACTION
       
   503                     elif words[0] == 'T':
       
   504                         element_type = ITEM_TRANSITION
       
   505                     return {"class": element_type,
       
   506                             "type": None,
       
   507                             "variables": [var for var in pou_vars["variables"] 
       
   508                                           if var["class"] not in [ITEM_ACTION, ITEM_TRANSITION]],
       
   509                             "edit": True,
       
   510                             "debug": True}
   483             elif words[0] in ['C', 'R']:
   511             elif words[0] in ['C', 'R']:
   484                 if words[0] == 'C':
   512                 if words[0] == 'C':
   485                     element_type = ITEM_CONFIGURATION
   513                     element_type = ITEM_CONFIGURATION
   486                     element = project.getconfiguration(words[1])
   514                     element = project.getconfiguration(words[1])
   487                     if element is not None:
   515                     if element is not None:
   577                 return instances
   605                 return instances
   578             elif words[0] == 'C':
   606             elif words[0] == 'C':
   579                 return [words[1]]
   607                 return [words[1]]
   580             elif words[0] == 'R':
   608             elif words[0] == 'R':
   581                 return ["%s.%s" % (words[1], words[2])]
   609                 return ["%s.%s" % (words[1], words[2])]
       
   610             elif words[0] in ['T', 'A']:
       
   611                 return ["%s.%s" % (instance, words[2])
       
   612                         for instance in self.SearchPouInstances(
       
   613                             self.ComputePouName(words[1]), debug)]
   582         return []
   614         return []
   583     
   615     
   584     def RecursiveGetPouInstanceTagName(self, project, pou_type, parts):
   616     def RecursiveGetPouInstanceTagName(self, project, pou_type, parts):
   585         pou = project.getpou(pou_type)
   617         pou = project.getpou(pou_type)
   586         if pou is not None:
   618         if pou is not None: