Bug on transition connection fixed
authorlbessard
Mon, 13 Aug 2007 18:04:19 +0200
changeset 69 8fbff50141f8
parent 68 66308e07402c
child 70 0e48629c1e6d
Bug on transition connection fixed
plcopen/plcopen.py
--- a/plcopen/plcopen.py	Fri Aug 10 16:14:33 2007 +0200
+++ b/plcopen/plcopen.py	Mon Aug 13 18:04:19 2007 +0200
@@ -849,6 +849,8 @@
             condition = PLCOpenClasses["condition_inline"]()
             condition.setContent("ST", PLCOpenClasses["formattedText"]())
             condition.setText(value)
+        elif type == "connection":
+            condition = []
         self.condition.setContent(type, condition)
     setattr(cls, "setConditionContent", setConditionContent)
         
@@ -875,14 +877,12 @@
     setattr(cls, "updateElementName", updateElementName)
 
     def addConnection(self):
-        print "addConnection"
-        if not self.condition:
-            self.addCondition()
-        content = self.condition.getContent()
-        if content["name"] != "connection":
-            self.condition.setContent("connection", [])
+        if self.condition:
             content = self.condition.getContent()
-        content["value"].append(PLCOpenClasses["connection"]())
+            if content["name"] != "connection":
+                self.condition.setContent("connection", [])
+                content = self.condition.getContent()
+            content["value"].append(PLCOpenClasses["connection"]())
     setattr(cls, "addConnection", addConnection)
     
     def removeConnection(self, idx):
@@ -902,7 +902,6 @@
     def getConnections(self):
         if self.condition:
             content = self.condition.getContent()
-            print "getConnections", content
             if content["name"] == "connection":
                 return content["value"]
     setattr(cls, "getConnections", getConnections)
@@ -912,7 +911,6 @@
             content = self.condition.getContent()
             if content["name"] == "connection":
                 content["value"][idx].setRefLocalId(id)
-            print "SetId", content
     setattr(cls, "setConnectionId", setConnectionId)
     
     def getConnectionId(self, idx):
@@ -928,7 +926,6 @@
             content = self.condition.getContent()
             if content["name"] == "connection":
                 content["value"][idx].setPoints(points)
-            print "SetPoints", content
     setattr(cls, "setConnectionPoints", setConnectionPoints)
 
     def getConnectionPoints(self, idx):
@@ -944,7 +941,6 @@
             content = self.condition.getContent()
             if content["name"] == "connection":
                 content["value"][idx].setFormalParameter(parameter)
-            print "SetParameter", content
     setattr(cls, "setConnectionParameter", setConnectionParameter)
     
     def getConnectionParameter(self, idx):