1221 self.position.setx(x) |
1221 self.position.setx(x) |
1222 |
1222 |
1223 def sety(self, y): |
1223 def sety(self, y): |
1224 self.position.sety(y) |
1224 self.position.sety(y) |
1225 |
1225 |
1226 cls = PLCOpenClasses.get("commonObjects_comment", None) |
1226 def _updateElementName(self, old_name, new_name): |
1227 if cls: |
1227 pass |
1228 setattr(cls, "getx", getx) |
1228 |
1229 setattr(cls, "gety", gety) |
1229 def _initElementClass(name, classname, connectionPointInType="none"): |
1230 setattr(cls, "setx", setx) |
1230 cls = PLCOpenClasses.get(classname, None) |
1231 setattr(cls, "sety", sety) |
1231 if cls: |
1232 |
1232 setattr(cls, "getx", getx) |
|
1233 setattr(cls, "gety", gety) |
|
1234 setattr(cls, "setx", setx) |
|
1235 setattr(cls, "sety", sety) |
|
1236 setattr(cls, "updateElementName", _updateElementName) |
|
1237 return cls |
|
1238 |
|
1239 def _getexecutionOrder(instance, specific_values): |
|
1240 executionOrder = instance.getexecutionOrderId() |
|
1241 if executionOrder is None: |
|
1242 executionOrder = 0 |
|
1243 specific_values["executionOrder"] = executionOrder |
|
1244 |
|
1245 def _getdefaultmodifiers(instance, infos): |
|
1246 infos["negated"] = instance.getnegated() |
|
1247 infos["edge"] = instance.getedge() |
|
1248 |
|
1249 def _getinputmodifiers(instance, infos): |
|
1250 infos["negated"] = instance.getnegatedIn() |
|
1251 infos["edge"] = instance.getedgeIn() |
|
1252 |
|
1253 def _getoutputmodifiers(instance, infos): |
|
1254 infos["negated"] = instance.getnegatedOut() |
|
1255 infos["edge"] = instance.getedgeOut() |
|
1256 |
|
1257 MODIFIERS_FUNCTIONS = {"default": _getdefaultmodifiers, |
|
1258 "input": _getinputmodifiers, |
|
1259 "output": _getoutputmodifiers} |
|
1260 |
|
1261 def _getconnectioninfos(instance, connection, links=False, modifiers=None, parameter=False): |
|
1262 infos = {"position": connection.getrelPositionXY()} |
|
1263 if parameter: |
|
1264 infos["name"] = instance.getformalParameter() |
|
1265 MODIFIERS_FUNCTIONS.get(modifiers, lambda x, y: None)(instance, infos) |
|
1266 if links: |
|
1267 infos["links"] = [] |
|
1268 connections = connection.getconnections() |
|
1269 if connections is not None: |
|
1270 for link in connections: |
|
1271 dic = {"refLocalId": link.getrefLocalId(), |
|
1272 "points": link.getpoints(), |
|
1273 "formalParameter": link.getformalParameter()} |
|
1274 infos["links"].append(dic) |
|
1275 return infos |
|
1276 |
|
1277 def _getelementinfos(instance): |
|
1278 return {"id": instance.getlocalId(), |
|
1279 "x": instance.getx(), |
|
1280 "y": instance.gety(), |
|
1281 "height": instance.getheight(), |
|
1282 "width": instance.getwidth(), |
|
1283 "specific_values": {}, |
|
1284 "inputs": [], |
|
1285 "outputs": []} |
|
1286 |
|
1287 def _getvariableinfosFunction(type, input, output): |
|
1288 def getvariableinfos(self): |
|
1289 infos = _getelementinfos(self) |
|
1290 infos["type"] = type |
|
1291 specific_values = infos["specific_values"] |
|
1292 specific_values["name"] = self.getexpression() |
|
1293 _getexecutionOrder(self, specific_values) |
|
1294 if input and output: |
|
1295 infos["inputs"].append(_getconnectioninfos(self, self.connectionPointIn, True, "input")) |
|
1296 infos["outputs"].append(_getconnectioninfos(self, self.connectionPointOut, False, "output")) |
|
1297 elif input: |
|
1298 infos["inputs"].append(_getconnectioninfos(self, self.connectionPointIn, True, "default")) |
|
1299 elif output: |
|
1300 infos["outputs"].append(_getconnectioninfos(self, self.connectionPointOut, False, "default")) |
|
1301 return infos |
|
1302 return getvariableinfos |
|
1303 |
|
1304 def _getconnectorinfosFunction(type): |
|
1305 def getvariableinfos(self): |
|
1306 infos = _getelementinfos(self) |
|
1307 infos["type"] = type |
|
1308 infos["specific_values"]["name"] = self.getname() |
|
1309 if type == "connector": |
|
1310 infos["inputs"].append(_getconnectioninfos(self, self.connectionPointIn, True)) |
|
1311 elif type == "continuation": |
|
1312 infos["outputs"].append(_getconnectioninfos(self, self.connectionPointOut)) |
|
1313 return infos |
|
1314 return getvariableinfos |
|
1315 |
|
1316 def _getpowerrailinfosFunction(type): |
|
1317 def getpowerrailinfos(self): |
|
1318 infos = _getelementinfos(self) |
|
1319 infos["type"] = type |
|
1320 if type == "rightPowerRail": |
|
1321 for connectionPointIn in self.getconnectionPointIn(): |
|
1322 infos["inputs"].append(_getconnectioninfos(self, connectionPointIn, True)) |
|
1323 infos["specific_values"]["connectors"] = [True for input in infos["inputs"]] |
|
1324 elif type == "leftPowerRail": |
|
1325 for connectionPointOut in self.getconnectionPointOut(): |
|
1326 infos["outputs"].append(_getconnectioninfos(self, connectionPointOut)) |
|
1327 infos["specific_values"]["connectors"] = [True for output in infos["outputs"]] |
|
1328 return infos |
|
1329 return getpowerrailinfos |
|
1330 |
|
1331 def _getldelementinfosFunction(type): |
|
1332 def getldelementinfos(self): |
|
1333 infos = _getelementinfos(self) |
|
1334 infos["type"] = type |
|
1335 specific_values = infos["specific_values"] |
|
1336 specific_values["name"] = self.getvariable() |
|
1337 _getexecutionOrder(self, specific_values) |
|
1338 specific_values["negated"] = self.getnegated() |
|
1339 specific_values["edge"] = self.getedge() |
|
1340 if type == "coil": |
|
1341 specific_values["storage"] = self.getstorage() |
|
1342 infos["inputs"].append(_getconnectioninfos(self, self.connectionPointIn, True)) |
|
1343 infos["outputs"].append(_getconnectioninfos(self, self.connectionPointOut)) |
|
1344 return infos |
|
1345 return getldelementinfos |
|
1346 |
|
1347 DIVERGENCE_TYPES = {(True, True): "simultaneousDivergence", |
|
1348 (True, False): "selectionDivergence", |
|
1349 (False, True): "simultaneousConvergence", |
|
1350 (False, False): "selectionConvergence"} |
|
1351 |
|
1352 def _getdivergenceinfosFunction(divergence, simultaneous): |
|
1353 def getdivergenceinfos(self): |
|
1354 infos = _getelementinfos(self) |
|
1355 infos["type"] = DIVERGENCE_TYPES[(divergence, simultaneous)] |
|
1356 if divergence: |
|
1357 infos["inputs"].append(_getconnectioninfos(self, self.connectionPointIn, True)) |
|
1358 for connectionPointOut in self.getconnectionPointOut(): |
|
1359 infos["outputs"].append(_getconnectioninfos(self, connectionPointOut)) |
|
1360 infos["specific_values"]["connectors"] = len(infos["outputs"]) |
|
1361 else: |
|
1362 for connectionPointIn in self.getconnectionPointIn(): |
|
1363 infos["inputs"].append(_getconnectioninfos(self, connectionPointIn, True)) |
|
1364 infos["outputs"].append(_getconnectioninfos(self, self.connectionPointOut)) |
|
1365 infos["specific_values"]["connectors"] = len(infos["inputs"]) |
|
1366 return infos |
|
1367 return getdivergenceinfos |
|
1368 |
|
1369 cls = _initElementClass("comment", "commonObjects_comment") |
|
1370 if cls: |
|
1371 def getinfos(self): |
|
1372 infos = _getelementinfos(self) |
|
1373 infos["type"] = "comment" |
|
1374 infos["specific_values"]["content"] = self.getcontentText() |
|
1375 return infos |
|
1376 setattr(cls, "getinfos", getinfos) |
|
1377 |
1233 def setcontentText(self, text): |
1378 def setcontentText(self, text): |
1234 self.content.settext(text) |
1379 self.content.settext(text) |
1235 setattr(cls, "setcontentText", setcontentText) |
1380 setattr(cls, "setcontentText", setcontentText) |
1236 |
1381 |
1237 def getcontentText(self): |
1382 def getcontentText(self): |
1240 |
1385 |
1241 def updateElementName(self, old_name, new_name): |
1386 def updateElementName(self, old_name, new_name): |
1242 self.content.updateElementName(old_name, new_name) |
1387 self.content.updateElementName(old_name, new_name) |
1243 setattr(cls, "updateElementName", updateElementName) |
1388 setattr(cls, "updateElementName", updateElementName) |
1244 |
1389 |
1245 cls = PLCOpenClasses.get("fbdObjects_block", None) |
1390 cls = _initElementClass("block", "fbdObjects_block") |
1246 if cls: |
1391 if cls: |
1247 setattr(cls, "getx", getx) |
1392 def getBoundingBox(self): |
1248 setattr(cls, "gety", gety) |
1393 bbox = _getBoundingBox(self) |
1249 setattr(cls, "setx", setx) |
1394 for input in self.inputVariables.getvariable(): |
1250 setattr(cls, "sety", sety) |
1395 bbox.union(_getConnectionsBoundingBox(input.connectionPointIn)) |
|
1396 return bbox |
|
1397 setattr(cls, "getBoundingBox", getBoundingBox) |
|
1398 |
|
1399 def getinfos(self): |
|
1400 infos = _getelementinfos(self) |
|
1401 infos["type"] = self.gettypeName() |
|
1402 specific_values = infos["specific_values"] |
|
1403 specific_values["name"] = self.getinstanceName() |
|
1404 _getexecutionOrder(self, specific_values) |
|
1405 for variable in self.inputVariables.getvariable(): |
|
1406 infos["inputs"].append(_getconnectioninfos(variable, variable.connectionPointIn, True, "default", True)) |
|
1407 for variable in self.outputVariables.getvariable(): |
|
1408 infos["outputs"].append(_getconnectioninfos(variable, variable.connectionPointOut, False, "default", True)) |
|
1409 return infos |
|
1410 setattr(cls, "getinfos", getinfos) |
1251 |
1411 |
1252 def updateElementName(self, old_name, new_name): |
1412 def updateElementName(self, old_name, new_name): |
1253 if self.typeName == old_name: |
1413 if self.typeName == old_name: |
1254 self.typeName = new_name |
1414 self.typeName = new_name |
1255 setattr(cls, "updateElementName", updateElementName) |
1415 setattr(cls, "updateElementName", updateElementName) |
1256 |
1416 |
1257 cls = PLCOpenClasses.get("ldObjects_leftPowerRail", None) |
1417 cls = _initElementClass("leftPowerRail", "ldObjects_leftPowerRail") |
1258 if cls: |
1418 if cls: |
1259 setattr(cls, "getx", getx) |
1419 setattr(cls, "getinfos", _getpowerrailinfosFunction("leftPowerRail")) |
1260 setattr(cls, "gety", gety) |
1420 |
1261 setattr(cls, "setx", setx) |
1421 cls = _initElementClass("rightPowerRail", "ldObjects_rightPowerRail", "multiple") |
1262 setattr(cls, "sety", sety) |
1422 if cls: |
1263 |
1423 setattr(cls, "getinfos", _getpowerrailinfosFunction("rightPowerRail")) |
1264 def updateElementName(self, old_name, new_name): |
1424 |
1265 pass |
1425 cls = _initElementClass("contact", "ldObjects_contact", "single") |
1266 setattr(cls, "updateElementName", updateElementName) |
1426 if cls: |
1267 |
1427 setattr(cls, "getinfos", _getldelementinfosFunction("contact")) |
1268 cls = PLCOpenClasses.get("ldObjects_rightPowerRail", None) |
1428 |
1269 if cls: |
|
1270 setattr(cls, "getx", getx) |
|
1271 setattr(cls, "gety", gety) |
|
1272 setattr(cls, "setx", setx) |
|
1273 setattr(cls, "sety", sety) |
|
1274 |
|
1275 def updateElementName(self, old_name, new_name): |
|
1276 pass |
|
1277 setattr(cls, "updateElementName", updateElementName) |
|
1278 |
|
1279 cls = PLCOpenClasses.get("ldObjects_contact", None) |
|
1280 if cls: |
|
1281 setattr(cls, "getx", getx) |
|
1282 setattr(cls, "gety", gety) |
|
1283 setattr(cls, "setx", setx) |
|
1284 setattr(cls, "sety", sety) |
|
1285 |
|
1286 def updateElementName(self, old_name, new_name): |
1429 def updateElementName(self, old_name, new_name): |
1287 if self.variable == old_name: |
1430 if self.variable == old_name: |
1288 self.variable = new_name |
1431 self.variable = new_name |
1289 setattr(cls, "updateElementName", updateElementName) |
1432 setattr(cls, "updateElementName", updateElementName) |
1290 |
1433 |
1291 cls = PLCOpenClasses.get("ldObjects_coil", None) |
1434 cls = _initElementClass("coil", "ldObjects_coil", "single") |
1292 if cls: |
1435 if cls: |
1293 setattr(cls, "getx", getx) |
1436 setattr(cls, "getinfos", _getldelementinfosFunction("coil")) |
1294 setattr(cls, "gety", gety) |
1437 |
1295 setattr(cls, "setx", setx) |
|
1296 setattr(cls, "sety", sety) |
|
1297 |
|
1298 def updateElementName(self, old_name, new_name): |
1438 def updateElementName(self, old_name, new_name): |
1299 if self.variable == old_name: |
1439 if self.variable == old_name: |
1300 self.variable = new_name |
1440 self.variable = new_name |
1301 setattr(cls, "updateElementName", updateElementName) |
1441 setattr(cls, "updateElementName", updateElementName) |
1302 |
1442 |
1303 cls = PLCOpenClasses.get("sfcObjects_step", None) |
1443 cls = _initElementClass("step", "sfcObjects_step", "single") |
1304 if cls: |
1444 if cls: |
1305 setattr(cls, "getx", getx) |
1445 def getinfos(self): |
1306 setattr(cls, "gety", gety) |
1446 infos = _getelementinfos(self) |
1307 setattr(cls, "setx", setx) |
1447 infos["type"] = "step" |
1308 setattr(cls, "sety", sety) |
1448 specific_values = infos["specific_values"] |
1309 |
1449 specific_values["name"] = self.getname() |
1310 def updateElementName(self, old_name, new_name): |
1450 specific_values["initial"] = self.getinitialStep() |
1311 pass |
1451 if self.connectionPointIn: |
1312 setattr(cls, "updateElementName", updateElementName) |
1452 infos["inputs"].append(_getconnectioninfos(self, self.connectionPointIn, True)) |
1313 |
1453 if self.connectionPointOut: |
1314 cls = PLCOpenClasses.get("sfcObjects_transition", None) |
1454 infos["outputs"].append(_getconnectioninfos(self, self.connectionPointOut)) |
1315 if cls: |
1455 if self.connectionPointOutAction: |
1316 setattr(cls, "getx", getx) |
1456 specific_values["action"] = _getconnectioninfos(self, self.connectionPointOutAction) |
1317 setattr(cls, "gety", gety) |
1457 return infos |
1318 setattr(cls, "setx", setx) |
1458 setattr(cls, "getinfos", getinfos) |
1319 setattr(cls, "sety", sety) |
1459 |
|
1460 cls = _initElementClass("transition", "sfcObjects_transition", "single") |
|
1461 if cls: |
|
1462 def getinfos(self): |
|
1463 infos = _getelementinfos(self) |
|
1464 infos["type"] = "transition" |
|
1465 specific_values = infos["specific_values"] |
|
1466 priority = self.getpriority() |
|
1467 if priority is None: |
|
1468 priority = 0 |
|
1469 specific_values["priority"] = priority |
|
1470 condition = self.getconditionContent() |
|
1471 specific_values["condition_type"] = condition["type"] |
|
1472 if specific_values["condition_type"] == "connection": |
|
1473 |
|
1474 specific_values["connection"] = _getconnectioninfos(self, self, True) |
|
1475 else: |
|
1476 specific_values["condition"] = condition["value"] |
|
1477 infos["inputs"].append(_getconnectioninfos(self, self.connectionPointIn, True)) |
|
1478 infos["outputs"].append(_getconnectioninfos(self, self.connectionPointOut)) |
|
1479 return infos |
|
1480 setattr(cls, "getinfos", getinfos) |
1320 |
1481 |
1321 def setconditionContent(self, type, value): |
1482 def setconditionContent(self, type, value): |
1322 if not self.condition: |
1483 if not self.condition: |
1323 self.addcondition() |
1484 self.addcondition() |
1324 if type == "reference": |
1485 if type == "reference": |
1425 |
1594 |
1426 def getconnectionParameter(self, idx): |
1595 def getconnectionParameter(self, idx): |
1427 if self.condition: |
1596 if self.condition: |
1428 content = self.condition.getcontent() |
1597 content = self.condition.getcontent() |
1429 if content["name"] == "connection": |
1598 if content["name"] == "connection": |
1430 return content["value"][idx].getformalParameter() |
1599 content["value"][idx].getformalParameter() |
1431 return None |
1600 return None |
1432 setattr(cls, "getconnectionParameter", getconnectionParameter) |
1601 setattr(cls, "getconnectionParameter", getconnectionParameter) |
1433 |
1602 |
1434 cls = PLCOpenClasses.get("sfcObjects_selectionDivergence", None) |
1603 cls = _initElementClass("selectionDivergence", "sfcObjects_selectionDivergence", "single") |
1435 if cls: |
1604 if cls: |
1436 setattr(cls, "getx", getx) |
1605 setattr(cls, "getinfos", _getdivergenceinfosFunction(True, False)) |
1437 setattr(cls, "gety", gety) |
1606 |
1438 setattr(cls, "setx", setx) |
1607 cls = _initElementClass("selectionConvergence", "sfcObjects_selectionConvergence", "multiple") |
1439 setattr(cls, "sety", sety) |
1608 if cls: |
1440 |
1609 setattr(cls, "getinfos", _getdivergenceinfosFunction(False, False)) |
1441 def updateElementName(self, old_name, new_name): |
1610 |
1442 pass |
1611 cls = _initElementClass("simultaneousDivergence", "sfcObjects_simultaneousDivergence", "single") |
1443 setattr(cls, "updateElementName", updateElementName) |
1612 if cls: |
1444 |
1613 setattr(cls, "getinfos", _getdivergenceinfosFunction(True, True)) |
1445 cls = PLCOpenClasses.get("sfcObjects_selectionConvergence", None) |
1614 |
1446 if cls: |
1615 cls = _initElementClass("simultaneousConvergence", "sfcObjects_simultaneousConvergence", "multiple") |
1447 setattr(cls, "getx", getx) |
1616 if cls: |
1448 setattr(cls, "gety", gety) |
1617 setattr(cls, "getinfos", _getdivergenceinfosFunction(False, True)) |
1449 setattr(cls, "setx", setx) |
1618 |
1450 setattr(cls, "sety", sety) |
1619 cls = _initElementClass("jumpStep", "sfcObjects_jumpStep", "single") |
1451 |
1620 if cls: |
1452 def updateElementName(self, old_name, new_name): |
1621 def getinfos(self): |
1453 pass |
1622 infos = _getelementinfos(self) |
1454 setattr(cls, "updateElementName", updateElementName) |
1623 infos["type"] = "jump" |
1455 |
1624 infos["specific_values"]["target"] = self.gettargetName() |
1456 cls = PLCOpenClasses.get("sfcObjects_simultaneousDivergence", None) |
1625 infos["inputs"].append(_getconnectioninfos(self, self.connectionPointIn, True)) |
1457 if cls: |
1626 return infos |
1458 setattr(cls, "getx", getx) |
1627 setattr(cls, "getinfos", getinfos) |
1459 setattr(cls, "gety", gety) |
|
1460 setattr(cls, "setx", setx) |
|
1461 setattr(cls, "sety", sety) |
|
1462 |
|
1463 def updateElementName(self, old_name, new_name): |
|
1464 pass |
|
1465 setattr(cls, "updateElementName", updateElementName) |
|
1466 |
|
1467 cls = PLCOpenClasses.get("sfcObjects_simultaneousConvergence", None) |
|
1468 if cls: |
|
1469 setattr(cls, "getx", getx) |
|
1470 setattr(cls, "gety", gety) |
|
1471 setattr(cls, "setx", setx) |
|
1472 setattr(cls, "sety", sety) |
|
1473 |
|
1474 def updateElementName(self, old_name, new_name): |
|
1475 pass |
|
1476 setattr(cls, "updateElementName", updateElementName) |
|
1477 |
|
1478 cls = PLCOpenClasses.get("sfcObjects_jumpStep", None) |
|
1479 if cls: |
|
1480 setattr(cls, "getx", getx) |
|
1481 setattr(cls, "gety", gety) |
|
1482 setattr(cls, "setx", setx) |
|
1483 setattr(cls, "sety", sety) |
|
1484 |
|
1485 def updateElementName(self, old_name, new_name): |
|
1486 pass |
|
1487 setattr(cls, "updateElementName", updateElementName) |
|
1488 |
1628 |
1489 cls = PLCOpenClasses.get("actionBlock_action", None) |
1629 cls = PLCOpenClasses.get("actionBlock_action", None) |
1490 if cls: |
1630 if cls: |
1491 def setreferenceName(self, name): |
1631 def setreferenceName(self, name): |
1492 if self.reference: |
1632 if self.reference: |
1516 self.reference.setname(new_name) |
1656 self.reference.setname(new_name) |
1517 if self.inline: |
1657 if self.inline: |
1518 self.inline.updateElementName(old_name, new_name) |
1658 self.inline.updateElementName(old_name, new_name) |
1519 setattr(cls, "updateElementName", updateElementName) |
1659 setattr(cls, "updateElementName", updateElementName) |
1520 |
1660 |
1521 cls = PLCOpenClasses.get("commonObjects_actionBlock", None) |
1661 cls = _initElementClass("actionBlock", "commonObjects_actionBlock", "single") |
1522 if cls: |
1662 if cls: |
1523 setattr(cls, "getx", getx) |
1663 def compatibility(self, tree): |
1524 setattr(cls, "gety", gety) |
1664 for child in tree.childNodes[:]: |
1525 setattr(cls, "setx", setx) |
1665 if child.nodeName == "connectionPointOut": |
1526 setattr(cls, "sety", sety) |
1666 tree.childNodes.remove(child) |
1527 |
1667 setattr(cls, "compatibility", compatibility) |
|
1668 |
|
1669 def getinfos(self): |
|
1670 infos = _getelementinfos(self) |
|
1671 infos["type"] = "actionBlock" |
|
1672 infos["specific_values"]["actions"] = self.getactions() |
|
1673 infos["inputs"].append(_getconnectioninfos(self, self.connectionPointIn, True)) |
|
1674 return infos |
|
1675 setattr(cls, "getinfos", getinfos) |
|
1676 |
1528 def setactions(self, actions): |
1677 def setactions(self, actions): |
1529 self.action = [] |
1678 self.action = [] |
1530 for params in actions: |
1679 for params in actions: |
1531 action = PLCOpenClasses["actionBlock_action"]() |
1680 action = PLCOpenClasses["actionBlock_action"]() |
1532 action.setqualifier(params["qualifier"]) |
1681 action.setqualifier(params["qualifier"]) |
1569 def updateElementName(self, old_name, new_name): |
1718 def updateElementName(self, old_name, new_name): |
1570 for action in self.action: |
1719 for action in self.action: |
1571 action.updateElementName(old_name, new_name) |
1720 action.updateElementName(old_name, new_name) |
1572 setattr(cls, "updateElementName", updateElementName) |
1721 setattr(cls, "updateElementName", updateElementName) |
1573 |
1722 |
1574 cls = PLCOpenClasses.get("fbdObjects_inVariable", None) |
1723 cls = _initElementClass("inVariable", "fbdObjects_inVariable") |
1575 if cls: |
1724 if cls: |
1576 setattr(cls, "getx", getx) |
1725 setattr(cls, "getinfos", _getvariableinfosFunction("input", False, True)) |
1577 setattr(cls, "gety", gety) |
|
1578 setattr(cls, "setx", setx) |
|
1579 setattr(cls, "sety", sety) |
|
1580 |
1726 |
1581 def updateElementName(self, old_name, new_name): |
1727 def updateElementName(self, old_name, new_name): |
1582 if self.expression == old_name: |
1728 if self.expression == old_name: |
1583 self.expression = new_name |
1729 self.expression = new_name |
1584 setattr(cls, "updateElementName", updateElementName) |
1730 setattr(cls, "updateElementName", updateElementName) |
1585 |
1731 |
1586 cls = PLCOpenClasses.get("fbdObjects_outVariable", None) |
1732 cls = _initElementClass("outVariable", "fbdObjects_outVariable", "single") |
1587 if cls: |
1733 if cls: |
1588 setattr(cls, "getx", getx) |
1734 setattr(cls, "getinfos", _getvariableinfosFunction("output", True, False)) |
1589 setattr(cls, "gety", gety) |
1735 |
1590 setattr(cls, "setx", setx) |
|
1591 setattr(cls, "sety", sety) |
|
1592 |
|
1593 def updateElementName(self, old_name, new_name): |
1736 def updateElementName(self, old_name, new_name): |
1594 if self.expression == old_name: |
1737 if self.expression == old_name: |
1595 self.expression = new_name |
1738 self.expression = new_name |
1596 setattr(cls, "updateElementName", updateElementName) |
1739 setattr(cls, "updateElementName", updateElementName) |
1597 |
1740 |
1598 cls = PLCOpenClasses.get("fbdObjects_inOutVariable", None) |
1741 cls = _initElementClass("inOutVariable", "fbdObjects_inOutVariable", "single") |
1599 if cls: |
1742 if cls: |
1600 setattr(cls, "getx", getx) |
1743 setattr(cls, "getinfos", _getvariableinfosFunction("inout", True, True)) |
1601 setattr(cls, "gety", gety) |
1744 |
1602 setattr(cls, "setx", setx) |
|
1603 setattr(cls, "sety", sety) |
|
1604 |
|
1605 def updateElementName(self, old_name, new_name): |
1745 def updateElementName(self, old_name, new_name): |
1606 if self.expression == old_name: |
1746 if self.expression == old_name: |
1607 self.expression = new_name |
1747 self.expression = new_name |
1608 setattr(cls, "updateElementName", updateElementName) |
1748 setattr(cls, "updateElementName", updateElementName) |
1609 |
1749 |
1610 cls = PLCOpenClasses.get("commonObjects_continuation", None) |
1750 cls = _initElementClass("continuation", "commonObjects_continuation") |
1611 if cls: |
1751 if cls: |
1612 setattr(cls, "getx", getx) |
1752 setattr(cls, "getinfos", _getconnectorinfosFunction("continuation")) |
1613 setattr(cls, "gety", gety) |
1753 |
1614 setattr(cls, "setx", setx) |
1754 cls = _initElementClass("connector", "commonObjects_connector", "single") |
1615 setattr(cls, "sety", sety) |
1755 if cls: |
1616 |
1756 setattr(cls, "getinfos", _getconnectorinfosFunction("connector")) |
1617 def updateElementName(self, old_name, new_name): |
|
1618 pass |
|
1619 setattr(cls, "updateElementName", updateElementName) |
|
1620 |
|
1621 cls = PLCOpenClasses.get("commonObjects_connector", None) |
|
1622 if cls: |
|
1623 setattr(cls, "getx", getx) |
|
1624 setattr(cls, "gety", gety) |
|
1625 setattr(cls, "setx", setx) |
|
1626 setattr(cls, "sety", sety) |
|
1627 |
|
1628 def updateElementName(self, old_name, new_name): |
|
1629 pass |
|
1630 setattr(cls, "updateElementName", updateElementName) |
|
1631 |
1757 |
1632 cls = PLCOpenClasses.get("connection", None) |
1758 cls = PLCOpenClasses.get("connection", None) |
1633 if cls: |
1759 if cls: |
1634 def setpoints(self, points): |
1760 def setpoints(self, points): |
1635 self.position = [] |
1761 self.position = [] |