plcopen/plcopen.py
changeset 461 649a8465148d
parent 435 893d04aff708
child 470 cc64bbb1d654
equal deleted inserted replaced
460:2ddf7bbd1f74 461:649a8465148d
    44 """
    44 """
    45 QualifierList = {"N" : False, "R" : False, "S" : False, "L" : True, "D" : True, 
    45 QualifierList = {"N" : False, "R" : False, "S" : False, "L" : True, "D" : True, 
    46     "P" : False, "P0" : False, "P1" : False, "SD" : True, "DS" : True, "SL" : True}
    46     "P" : False, "P0" : False, "P1" : False, "SD" : True, "DS" : True, "SL" : True}
    47 
    47 
    48 
    48 
       
    49 FILTER_ADDRESS_MODEL = "(%%[IQM](?:[XBWDL])?)(%s)((?:\.[0-9]+)*)" 
       
    50 
       
    51 def update_address(address, address_model, new_leading):
       
    52     result = address_model.match(address)
       
    53     if result is None:
       
    54         return address
       
    55     groups = result.groups()
       
    56     return groups[0] + new_leading + groups[2]
       
    57 
    49 def _init_and_compare(function, v1, v2):
    58 def _init_and_compare(function, v1, v2):
    50     if v1 is None:
    59     if v1 is None:
    51         return v2
    60         return v2
    52     if v2 is not None:
    61     if v2 is not None:
    53         return function(v1, v2)
    62         return function(v1, v2)
   104                 index = self.text.find(old_name, index + len(old_name))
   113                 index = self.text.find(old_name, index + len(old_name))
   105             else:
   114             else:
   106                 self.text = self.text[:index] + new_name + self.text[index + len(old_name):]
   115                 self.text = self.text[:index] + new_name + self.text[index + len(old_name):]
   107                 index = self.text.find(old_name, index + len(new_name))
   116                 index = self.text.find(old_name, index + len(new_name))
   108     setattr(cls, "updateElementName", updateElementName)
   117     setattr(cls, "updateElementName", updateElementName)
       
   118     
       
   119     def updateElementAddress(self, address_model, new_leading):
       
   120         startpos = 0
       
   121         result = address_model.search(self.text, startpos)
       
   122         while result is not None:
       
   123             groups = result.groups()
       
   124             new_address = groups[0] + new_leading + groups[2]
       
   125             self.text = self.text[:result.start()] + new_address + self.text[result.end():]
       
   126             startpos = result.start() + len(new_address)
       
   127             result = address_model.search(self.text, startpos)
       
   128     setattr(cls, "updateElementAddress", updateElementAddress)
   109     
   129     
   110 cls = PLCOpenClasses.get("project", None)
   130 cls = PLCOpenClasses.get("project", None)
   111 if cls:
   131 if cls:
   112     cls.singleLineAttributes = False
   132     cls.singleLineAttributes = False
   113     cls.EnumeratedDataTypeValues = {}
   133     cls.EnumeratedDataTypeValues = {}
   320         for pou in self.types.getpouElements():
   340         for pou in self.types.getpouElements():
   321             pou.updateElementName(old_name, new_name)
   341             pou.updateElementName(old_name, new_name)
   322         for configuration in self.instances.configurations.getconfiguration():
   342         for configuration in self.instances.configurations.getconfiguration():
   323             configuration.updateElementName(old_name, new_name)
   343             configuration.updateElementName(old_name, new_name)
   324     setattr(cls, "updateElementName", updateElementName)
   344     setattr(cls, "updateElementName", updateElementName)
       
   345 
       
   346     def updateElementAddress(self, old_leading, new_leading):
       
   347         address_model = re.compile(FILTER_ADDRESS_MODEL % old_leading)
       
   348         for pou in self.types.getpouElements():
       
   349             pou.updateElementAddress(address_model, new_leading)
       
   350         for configuration in self.instances.configurations.getconfiguration():
       
   351             configuration.updateElementAddress(address_model, new_leading)
       
   352     setattr(cls, "updateElementAddress", updateElementAddress)
       
   353 
       
   354     def removeVariableByAddress(self, address):
       
   355         for pou in self.types.getpouElements():
       
   356             pou.removeVariableByAddress(address)
       
   357         for configuration in self.instances.configurations.getconfiguration():
       
   358             configuration.removeVariableByAddress(address)
       
   359     setattr(cls, "removeVariableByAddress", removeVariableByAddress)
       
   360 
       
   361     def removeVariableByFilter(self, leading):
       
   362         address_model = re.compile(FILTER_ADDRESS_MODEL % leading)
       
   363         for pou in self.types.getpouElements():
       
   364             pou.removeVariableByFilter(address_model)
       
   365         for configuration in self.instances.configurations.getconfiguration():
       
   366             configuration.removeVariableByFilter(address_model)
       
   367     setattr(cls, "removeVariableByFilter", removeVariableByFilter)
   325 
   368 
   326     def RefreshDataTypeHierarchy(self):
   369     def RefreshDataTypeHierarchy(self):
   327         self.EnumeratedDataTypeValues = {}
   370         self.EnumeratedDataTypeValues = {}
   328         self.CustomDataTypeRange = {}
   371         self.CustomDataTypeRange = {}
   329         self.CustomTypeHierarchy = {}
   372         self.CustomTypeHierarchy = {}
   685     setattr(cls, "getscaling", getscaling)
   728     setattr(cls, "getscaling", getscaling)
   686 
   729 
   687 cls = PLCOpenClasses.get("configurations_configuration", None)
   730 cls = PLCOpenClasses.get("configurations_configuration", None)
   688 if cls:
   731 if cls:
   689     def updateElementName(self, old_name, new_name):
   732     def updateElementName(self, old_name, new_name):
       
   733         for varlist in self.getglobalVars():
       
   734             for var in varlist.getvariable():
       
   735                 var_address = var.getaddress()
       
   736                 if var_address is not None:
       
   737                     if var_address == oldname:
       
   738                         var.setaddress(new_name)
       
   739                     if var.getname() == old_name:
       
   740                         var.setname(new_name)
   690         for resource in self.getresource():
   741         for resource in self.getresource():
   691             resource.updateElementName(old_name, new_name)
   742             resource.updateElementName(old_name, new_name)
   692     setattr(cls, "updateElementName", updateElementName)
   743     setattr(cls, "updateElementName", updateElementName)
   693 
   744 
       
   745     def updateElementAddress(self, address_model, new_leading):
       
   746         for varlist in self.getglobalVars():
       
   747             for var in varlist.getvariable():
       
   748                 var_address = var.getaddress()
       
   749                 if var_address is not None:
       
   750                     var.setaddress(update_address(var_address, address_model, new_leading))
       
   751         for resource in self.getresource():
       
   752             resource.updateElementAddress(address_model, new_leading)
       
   753     setattr(cls, "updateElementAddress", updateElementAddress)
       
   754 
       
   755     def removeVariableByAddress(self, address):
       
   756         for varlist in self.getglobalVars():
       
   757             variables = varlist.getvariable()
       
   758             for i in xrange(len(variables)-1, -1, -1):
       
   759                 if variables[i].getaddress() == address:
       
   760                     variables.pop(i)
       
   761     setattr(cls, "removeVariableByAddress", removeVariableByAddress)
       
   762 
       
   763     def removeVariableByFilter(self, address_model):
       
   764         for varlist in self.getglobalVars():
       
   765             variables = varlist.getvariable()
       
   766             for i in xrange(len(variables)-1, -1, -1):
       
   767                 var_address = variables[i].getaddress()
       
   768                 if var_address is not None:
       
   769                     result = address_model.match(var_address)
       
   770                     if result is not None:
       
   771                         variables.pop(i)
       
   772     setattr(cls, "removeVariableByFilter", removeVariableByFilter)
   694 
   773 
   695 cls = PLCOpenClasses.get("configuration_resource", None)
   774 cls = PLCOpenClasses.get("configuration_resource", None)
   696 if cls:
   775 if cls:
   697     def updateElementName(self, old_name, new_name):
   776     def updateElementName(self, old_name, new_name):
       
   777         for varlist in self.getglobalVars():
       
   778             for var in varlist.getvariable():
       
   779                 var_address = var.getaddress()
       
   780                 if var_address is not None:
       
   781                     if var_address == oldname:
       
   782                         var.setaddress(new_name)
       
   783                     if var.getname() == old_name:
       
   784                         var.setname(new_name)
   698         for instance in self.getpouInstance():
   785         for instance in self.getpouInstance():
   699             instance.updateElementName(old_name, new_name)
   786             instance.updateElementName(old_name, new_name)
   700         for task in self.gettask():
   787         for task in self.gettask():
   701             task.updateElementName(old_name, new_name)
   788             task.updateElementName(old_name, new_name)
   702     setattr(cls, "updateElementName", updateElementName)
   789     setattr(cls, "updateElementName", updateElementName)
       
   790 
       
   791     def updateElementAddress(self, address_model, new_leading):
       
   792         for varlist in self.getglobalVars():
       
   793             for var in varlist.getvariable():
       
   794                 var_address = var.getaddress()
       
   795                 if var_address is not None:
       
   796                     var.setaddress(update_address(var_address, address_model, new_leading))
       
   797         for task in self.gettask():
       
   798             task.updateElementAddress(address_model, new_leading)
       
   799     setattr(cls, "updateElementAddress", updateElementAddress)
       
   800 
       
   801     def removeVariableByAddress(self, address):
       
   802         for varlist in self.getglobalVars():
       
   803             variables = varlist.getvariable()
       
   804             for i in xrange(len(variables)-1, -1, -1):
       
   805                 if variables[i].getaddress() == address:
       
   806                     variables.pop(i)
       
   807     setattr(cls, "removeVariableByAddress", removeVariableByAddress)
       
   808 
       
   809     def removeVariableByFilter(self, address_model):
       
   810         for varlist in self.getglobalVars():
       
   811             variables = varlist.getvariable()
       
   812             for i in xrange(len(variables)-1, -1, -1):
       
   813                 var_address = variables[i].getaddress()
       
   814                 if var_address is not None:
       
   815                     result = address_model.match(var_address)
       
   816                     if result is not None:
       
   817                         variables.pop(i)
       
   818     setattr(cls, "removeVariableByFilter", removeVariableByFilter)
   703 
   819 
   704 cls = PLCOpenClasses.get("resource_task", None)
   820 cls = PLCOpenClasses.get("resource_task", None)
   705 if cls:
   821 if cls:
   706     def compatibility(self, tree):
   822     def compatibility(self, tree):
   707         if tree.hasAttribute("interval"):
   823         if tree.hasAttribute("interval"):
   728     setattr(cls, "compatibility", compatibility)
   844     setattr(cls, "compatibility", compatibility)
   729     
   845     
   730     def updateElementName(self, old_name, new_name):
   846     def updateElementName(self, old_name, new_name):
   731         if self.single == old_name:
   847         if self.single == old_name:
   732             self.single = new_name
   848             self.single = new_name
       
   849         if self.interval == old_name:
       
   850             self.interval = new_name
   733         for instance in self.getpouInstance():
   851         for instance in self.getpouInstance():
   734             instance.updateElementName(old_name, new_name)
   852             instance.updateElementName(old_name, new_name)
   735     setattr(cls, "updateElementName", updateElementName)
   853     setattr(cls, "updateElementName", updateElementName)
       
   854 
       
   855     def updateElementAddress(self, address_model, new_leading):
       
   856         if self.single is not None:
       
   857             self.single = update_address(self.single, address_model, new_leading)
       
   858         if self.interval is not None:
       
   859             self.interval = update_address(self.interval, address_model, new_leading)
       
   860     setattr(cls, "updateElementAddress", updateElementAddress)
   736 
   861 
   737 cls = PLCOpenClasses.get("pouInstance", None)
   862 cls = PLCOpenClasses.get("pouInstance", None)
   738 if cls:
   863 if cls:
   739     def compatibility(self, tree):
   864     def compatibility(self, tree):
   740         if tree.hasAttribute("type"):
   865         if tree.hasAttribute("type"):
  1090 
  1215 
  1091     def updateElementName(self, old_name, new_name):
  1216     def updateElementName(self, old_name, new_name):
  1092         if self.interface:
  1217         if self.interface:
  1093             for content in self.interface.getcontent():
  1218             for content in self.interface.getcontent():
  1094                 for var in content["value"].getvariable():
  1219                 for var in content["value"].getvariable():
       
  1220                     var_address = var.getaddress()
       
  1221                     if var_address is not None:
       
  1222                         if var_address == oldname:
       
  1223                             var.setaddress(new_name)
       
  1224                         if var.getname() == old_name:
       
  1225                             var.setname(new_name)
  1095                     var_type_content = var.gettype().getcontent()
  1226                     var_type_content = var.gettype().getcontent()
  1096                     if var_type_content["name"] == "derived":
  1227                     if var_type_content["name"] == "derived":
  1097                         if var_type_content["value"].getname() == old_name:
  1228                         if var_type_content["value"].getname() == old_name:
  1098                             var_type_content["value"].setname(new_name)
  1229                             var_type_content["value"].setname(new_name)
  1099         self.body[0].updateElementName(old_name, new_name)
  1230         self.body[0].updateElementName(old_name, new_name)
  1100         for action in self.getactionList():
  1231         for action in self.getactionList():
  1101             action.updateElementName(old_name, new_name)
  1232             action.updateElementName(old_name, new_name)
  1102         for transition in self.gettransitionList():
  1233         for transition in self.gettransitionList():
  1103             transition.updateElementName(old_name, new_name)
  1234             transition.updateElementName(old_name, new_name)
  1104     setattr(cls, "updateElementName", updateElementName)
  1235     setattr(cls, "updateElementName", updateElementName)
       
  1236 
       
  1237     def updateElementAddress(self, address_model, new_leading):
       
  1238         if self.interface:
       
  1239             for content in self.interface.getcontent():
       
  1240                 for var in content["value"].getvariable():
       
  1241                     var_address = var.getaddress()
       
  1242                     if var_address is not None:
       
  1243                         var.setaddress(update_address(var_address, address_model, new_leading))
       
  1244         self.body[0].updateElementAddress(address_model, new_leading)
       
  1245         for action in self.getactionList():
       
  1246             action.updateElementAddress(address_model, new_leading)
       
  1247         for transition in self.gettransitionList():
       
  1248             transition.updateElementAddress(address_model, new_leading)
       
  1249     setattr(cls, "updateElementAddress", updateElementAddress)
       
  1250 
       
  1251     def removeVariableByAddress(self, address):
       
  1252         if self.interface:
       
  1253             for content in self.interface.getcontent():
       
  1254                 variables = content["value"].getvariable()
       
  1255                 for i in xrange(len(variables)-1, -1, -1):
       
  1256                     if variables[i].getaddress() == address:
       
  1257                         variables.pop(i)
       
  1258     setattr(cls, "removeVariableByAddress", removeVariableByAddress)
       
  1259 
       
  1260     def removeVariableByFilter(self, address_model):
       
  1261         if self.interface:
       
  1262             for content in self.interface.getcontent():
       
  1263                 variables = content["value"].getvariable()
       
  1264                 for i in xrange(len(variables)-1, -1, -1):
       
  1265                     var_address = variables[i].getaddress()
       
  1266                     if var_address is not None:
       
  1267                         result = address_model.match(var_address)
       
  1268                         if result is not None:
       
  1269                             variables.pop(i)
       
  1270     setattr(cls, "removeVariableByFilter", removeVariableByFilter)
  1105 
  1271 
  1106 def setbodyType(self, type):
  1272 def setbodyType(self, type):
  1107     if type == "IL":
  1273     if type == "IL":
  1108         self.body.setcontent({"name" : "IL", "value" : PLCOpenClasses["formattedText"]()})
  1274         self.body.setcontent({"name" : "IL", "value" : PLCOpenClasses["formattedText"]()})
  1109     elif type == "ST":
  1275     elif type == "ST":
  1171 
  1337 
  1172     def updateElementName(self, old_name, new_name):
  1338     def updateElementName(self, old_name, new_name):
  1173         self.body.updateElementName(old_name, new_name)
  1339         self.body.updateElementName(old_name, new_name)
  1174     setattr(cls, "updateElementName", updateElementName)
  1340     setattr(cls, "updateElementName", updateElementName)
  1175 
  1341 
       
  1342     def updateElementAddress(self, address_model, new_leading):
       
  1343         self.body.updateElementAddress(address_model, new_leading)
       
  1344     setattr(cls, "updateElementAddress", updateElementAddress)
       
  1345 
  1176     def hasblock(self, name):
  1346     def hasblock(self, name):
  1177         if self.getbodyType() in ["FBD", "LD", "SFC"]:
  1347         if self.getbodyType() in ["FBD", "LD", "SFC"]:
  1178             for instance in self.getinstances():
  1348             for instance in self.getinstances():
  1179                 if isinstance(instance, PLCOpenClasses["fbdObjects_block"]) and instance.getinstanceName() == name:
  1349                 if isinstance(instance, PLCOpenClasses["fbdObjects_block"]) and instance.getinstanceName() == name:
  1180                     return True
  1350                     return True
  1198     setattr(cls, "gettext", gettext)
  1368     setattr(cls, "gettext", gettext)
  1199 
  1369 
  1200     def updateElementName(self, old_name, new_name):
  1370     def updateElementName(self, old_name, new_name):
  1201         self.body.updateElementName(old_name, new_name)
  1371         self.body.updateElementName(old_name, new_name)
  1202     setattr(cls, "updateElementName", updateElementName)
  1372     setattr(cls, "updateElementName", updateElementName)
       
  1373 
       
  1374     def updateElementAddress(self, address_model, new_leading):
       
  1375         self.body.updateElementAddress(address_model, new_leading)
       
  1376     setattr(cls, "updateElementAddress", updateElementAddress)
  1203 
  1377 
  1204     def hasblock(self, name):
  1378     def hasblock(self, name):
  1205         if self.getbodyType() in ["FBD", "LD", "SFC"]:
  1379         if self.getbodyType() in ["FBD", "LD", "SFC"]:
  1206             for instance in self.getinstances():
  1380             for instance in self.getinstances():
  1207                 if isinstance(instance, PLCOpenClasses["fbdObjects_block"]) and instance.getinstanceName() == name:
  1381                 if isinstance(instance, PLCOpenClasses["fbdObjects_block"]) and instance.getinstanceName() == name:
  1366         else:
  1540         else:
  1367             for element in self.content["value"].getcontent():
  1541             for element in self.content["value"].getcontent():
  1368                 element["value"].updateElementName(old_name, new_name)
  1542                 element["value"].updateElementName(old_name, new_name)
  1369     setattr(cls, "updateElementName", updateElementName)
  1543     setattr(cls, "updateElementName", updateElementName)
  1370 
  1544 
       
  1545     def updateElementAddress(self, address_model, new_leading):
       
  1546         if self.content["name"] in ["IL", "ST"]:
       
  1547             self.content["value"].updateElementAddress(address_model, new_leading)
       
  1548         else:
       
  1549             for element in self.content["value"].getcontent():
       
  1550                 element["value"].updateElementAddress(address_model, new_leading)
       
  1551     setattr(cls, "updateElementAddress", updateElementAddress)
       
  1552 
  1371 def getx(self):
  1553 def getx(self):
  1372     return self.position.getx()
  1554     return self.position.getx()
  1373 
  1555 
  1374 def gety(self):
  1556 def gety(self):
  1375     return self.position.gety()
  1557     return self.position.gety()
  1473     _translate(self, dx, dy)
  1655     _translate(self, dx, dy)
  1474     for connectionPointIn in self.getconnectionPointIn():
  1656     for connectionPointIn in self.getconnectionPointIn():
  1475         _translateConnections(connectionPointIn, dx, dy)
  1657         _translateConnections(connectionPointIn, dx, dy)
  1476 
  1658 
  1477 def _updateElementName(self, old_name, new_name):
  1659 def _updateElementName(self, old_name, new_name):
       
  1660     pass
       
  1661 
       
  1662 def _updateElementAddress(self, address_model, new_leading):
  1478     pass
  1663     pass
  1479 
  1664 
  1480 _connectionsFunctions = {
  1665 _connectionsFunctions = {
  1481     "bbox": {"none": _getBoundingBox,
  1666     "bbox": {"none": _getBoundingBox,
  1482              "single": _getBoundingBoxSingle,
  1667              "single": _getBoundingBoxSingle,
  1499         setattr(cls, "getx", getx)
  1684         setattr(cls, "getx", getx)
  1500         setattr(cls, "gety", gety)
  1685         setattr(cls, "gety", gety)
  1501         setattr(cls, "setx", setx)
  1686         setattr(cls, "setx", setx)
  1502         setattr(cls, "sety", sety)
  1687         setattr(cls, "sety", sety)
  1503         setattr(cls, "updateElementName", _updateElementName)
  1688         setattr(cls, "updateElementName", _updateElementName)
       
  1689         setattr(cls, "updateElementAddress", _updateElementAddress)
  1504         setattr(cls, "getBoundingBox", _connectionsFunctions["bbox"][connectionPointInType])
  1690         setattr(cls, "getBoundingBox", _connectionsFunctions["bbox"][connectionPointInType])
  1505         setattr(cls, "translate", _connectionsFunctions["translate"][connectionPointInType])
  1691         setattr(cls, "translate", _connectionsFunctions["translate"][connectionPointInType])
  1506         setattr(cls, "filterConnections", _connectionsFunctions["filter"][connectionPointInType])
  1692         setattr(cls, "filterConnections", _connectionsFunctions["filter"][connectionPointInType])
  1507         setattr(cls, "updateConnectionsId", _connectionsFunctions["update"][connectionPointInType])
  1693         setattr(cls, "updateConnectionsId", _connectionsFunctions["update"][connectionPointInType])
  1508     return cls
  1694     return cls
  1656     
  1842     
  1657     def updateElementName(self, old_name, new_name):
  1843     def updateElementName(self, old_name, new_name):
  1658         self.content.updateElementName(old_name, new_name)
  1844         self.content.updateElementName(old_name, new_name)
  1659     setattr(cls, "updateElementName", updateElementName)
  1845     setattr(cls, "updateElementName", updateElementName)
  1660 
  1846 
       
  1847     def updateElementAddress(self, address_model, new_leading):
       
  1848         self.content.updateElementAddress(address_model, new_leading)
       
  1849     setattr(cls, "updateElementAddress", updateElementAddress)
       
  1850 
  1661 cls = _initElementClass("block", "fbdObjects_block")
  1851 cls = _initElementClass("block", "fbdObjects_block")
  1662 if cls:
  1852 if cls:
  1663     def getBoundingBox(self):
  1853     def getBoundingBox(self):
  1664         bbox = _getBoundingBox(self)
  1854         bbox = _getBoundingBox(self)
  1665         for input in self.inputVariables.getvariable():
  1855         for input in self.inputVariables.getvariable():
  1718     def updateElementName(self, old_name, new_name):
  1908     def updateElementName(self, old_name, new_name):
  1719         if self.variable == old_name:
  1909         if self.variable == old_name:
  1720             self.variable = new_name
  1910             self.variable = new_name
  1721     setattr(cls, "updateElementName", updateElementName)
  1911     setattr(cls, "updateElementName", updateElementName)
  1722     
  1912     
       
  1913     def updateElementAddress(self, address_model, new_leading):
       
  1914         self.variable = update_address(self.variable, address_model, new_leading)
       
  1915     setattr(cls, "updateElementAddress", updateElementAddress)
       
  1916     
  1723 cls = _initElementClass("coil", "ldObjects_coil", "single")
  1917 cls = _initElementClass("coil", "ldObjects_coil", "single")
  1724 if cls:
  1918 if cls:
  1725     setattr(cls, "getinfos", _getldelementinfosFunction("coil"))
  1919     setattr(cls, "getinfos", _getldelementinfosFunction("coil"))
  1726     
  1920     
  1727     def updateElementName(self, old_name, new_name):
  1921     def updateElementName(self, old_name, new_name):
  1728         if self.variable == old_name:
  1922         if self.variable == old_name:
  1729             self.variable = new_name
  1923             self.variable = new_name
  1730     setattr(cls, "updateElementName", updateElementName)
  1924     setattr(cls, "updateElementName", updateElementName)
       
  1925 
       
  1926     def updateElementAddress(self, address_model, new_leading):
       
  1927         self.variable = update_address(self.variable, address_model, new_leading)
       
  1928     setattr(cls, "updateElementAddress", updateElementAddress)
  1731 
  1929 
  1732 cls = _initElementClass("step", "sfcObjects_step", "single")
  1930 cls = _initElementClass("step", "sfcObjects_step", "single")
  1733 if cls:
  1931 if cls:
  1734     def getinfos(self):
  1932     def getinfos(self):
  1735         infos = _getelementinfos(self)
  1933         infos = _getelementinfos(self)
  1823                     content["value"].setname(new_name)
  2021                     content["value"].setname(new_name)
  1824             elif content["name"] == "inline":
  2022             elif content["name"] == "inline":
  1825                 content["value"].updateElementName(old_name, new_name)
  2023                 content["value"].updateElementName(old_name, new_name)
  1826     setattr(cls, "updateElementName", updateElementName)
  2024     setattr(cls, "updateElementName", updateElementName)
  1827 
  2025 
       
  2026     def updateElementAddress(self, address_model, new_leading):
       
  2027         if self.condition:
       
  2028             content = self.condition.getcontent()
       
  2029             if content["name"] == "reference":
       
  2030                 content["value"].setname(update_address(content["value"].getname(), address_model, new_leading))
       
  2031             elif content["name"] == "inline":
       
  2032                 content["value"].updateElementAddress(address_model, new_leading)
       
  2033     setattr(cls, "updateElementAddress", updateElementAddress)
       
  2034 
  1828     def getconnections(self):
  2035     def getconnections(self):
  1829         if self.condition:
  2036         if self.condition:
  1830             content = self.condition.getcontent()
  2037             content = self.condition.getcontent()
  1831             if content["name"] == "connectionPointIn":
  2038             if content["name"] == "connectionPointIn":
  1832                 return content["value"].getconnections()
  2039                 return content["value"].getconnections()
  1898         if self.reference and self.reference.getname() == old_name:
  2105         if self.reference and self.reference.getname() == old_name:
  1899             self.reference.setname(new_name)
  2106             self.reference.setname(new_name)
  1900         if self.inline:
  2107         if self.inline:
  1901             self.inline.updateElementName(old_name, new_name)
  2108             self.inline.updateElementName(old_name, new_name)
  1902     setattr(cls, "updateElementName", updateElementName)
  2109     setattr(cls, "updateElementName", updateElementName)
       
  2110 
       
  2111     def updateElementAddress(self, address_model, new_leading):
       
  2112         if self.reference:
       
  2113             self.reference.setname(update_address(self.reference.getname(), address_model, new_leading))
       
  2114         if self.inline:
       
  2115             self.inline.updateElementAddress(address_model, new_leading)
       
  2116     setattr(cls, "updateElementAddress", updateElementAddress)
  1903 
  2117 
  1904 cls = _initElementClass("actionBlock", "commonObjects_actionBlock", "single")
  2118 cls = _initElementClass("actionBlock", "commonObjects_actionBlock", "single")
  1905 if cls:
  2119 if cls:
  1906     def compatibility(self, tree):
  2120     def compatibility(self, tree):
  1907         for child in tree.childNodes[:]:
  2121         for child in tree.childNodes[:]:
  1961     def updateElementName(self, old_name, new_name):
  2175     def updateElementName(self, old_name, new_name):
  1962         for action in self.action:
  2176         for action in self.action:
  1963             action.updateElementName(old_name, new_name)
  2177             action.updateElementName(old_name, new_name)
  1964     setattr(cls, "updateElementName", updateElementName)
  2178     setattr(cls, "updateElementName", updateElementName)
  1965 
  2179 
       
  2180     def updateElementAddress(self, address_model, new_leading):
       
  2181         for action in self.action:
       
  2182             action.updateElementAddress(address_model, new_leading)
       
  2183     setattr(cls, "updateElementAddress", updateElementAddress)
       
  2184 
  1966 cls = _initElementClass("inVariable", "fbdObjects_inVariable")
  2185 cls = _initElementClass("inVariable", "fbdObjects_inVariable")
  1967 if cls:
  2186 if cls:
  1968     setattr(cls, "getinfos", _getvariableinfosFunction("input", False, True))
  2187     setattr(cls, "getinfos", _getvariableinfosFunction("input", False, True))
  1969     
  2188     
  1970     def updateElementName(self, old_name, new_name):
  2189     def updateElementName(self, old_name, new_name):
  1971         if self.expression == old_name:
  2190         if self.expression == old_name:
  1972             self.expression = new_name
  2191             self.expression = new_name
  1973     setattr(cls, "updateElementName", updateElementName)
  2192     setattr(cls, "updateElementName", updateElementName)
  1974 
  2193 
       
  2194     def updateElementAddress(self, address_model, new_leading):
       
  2195         self.expression = update_address(self.expression, address_model, new_leading)
       
  2196     setattr(cls, "updateElementAddress", updateElementAddress)
       
  2197 
  1975 cls = _initElementClass("outVariable", "fbdObjects_outVariable", "single")
  2198 cls = _initElementClass("outVariable", "fbdObjects_outVariable", "single")
  1976 if cls:
  2199 if cls:
  1977     setattr(cls, "getinfos", _getvariableinfosFunction("output", True, False))
  2200     setattr(cls, "getinfos", _getvariableinfosFunction("output", True, False))
  1978     
  2201     
  1979     def updateElementName(self, old_name, new_name):
  2202     def updateElementName(self, old_name, new_name):
  1980         if self.expression == old_name:
  2203         if self.expression == old_name:
  1981             self.expression = new_name
  2204             self.expression = new_name
  1982     setattr(cls, "updateElementName", updateElementName)
  2205     setattr(cls, "updateElementName", updateElementName)
  1983 
  2206 
       
  2207     def updateElementAddress(self, address_model, new_leading):
       
  2208         self.expression = update_address(self.expression, address_model, new_leading)
       
  2209     setattr(cls, "updateElementAddress", updateElementAddress)
       
  2210 
  1984 cls = _initElementClass("inOutVariable", "fbdObjects_inOutVariable", "single")
  2211 cls = _initElementClass("inOutVariable", "fbdObjects_inOutVariable", "single")
  1985 if cls:
  2212 if cls:
  1986     setattr(cls, "getinfos", _getvariableinfosFunction("inout", True, True))
  2213     setattr(cls, "getinfos", _getvariableinfosFunction("inout", True, True))
  1987     
  2214     
  1988     def updateElementName(self, old_name, new_name):
  2215     def updateElementName(self, old_name, new_name):
  1989         if self.expression == old_name:
  2216         if self.expression == old_name:
  1990             self.expression = new_name
  2217             self.expression = new_name
  1991     setattr(cls, "updateElementName", updateElementName)
  2218     setattr(cls, "updateElementName", updateElementName)
       
  2219 
       
  2220     def updateElementAddress(self, address_model, new_leading):
       
  2221         self.expression = update_address(self.expression, address_model, new_leading)
       
  2222     setattr(cls, "updateElementAddress", updateElementAddress)
  1992 
  2223 
  1993 cls = _initElementClass("continuation", "commonObjects_continuation")
  2224 cls = _initElementClass("continuation", "commonObjects_continuation")
  1994 if cls:
  2225 if cls:
  1995     setattr(cls, "getinfos", _getconnectorinfosFunction("continuation"))
  2226     setattr(cls, "getinfos", _getconnectorinfosFunction("continuation"))
  1996 
  2227