Bug on transition connection fixed
authorlbessard
Wed, 30 Jan 2008 18:48:49 +0100
changeset 166 de1845119cdd
parent 165 e464a4e4e06d
child 167 893ff98ab3be
Bug on transition connection fixed
plcopen/plcopen.py
--- a/plcopen/plcopen.py	Wed Jan 30 18:48:05 2008 +0100
+++ b/plcopen/plcopen.py	Wed Jan 30 18:48:49 2008 +0100
@@ -24,7 +24,7 @@
 
 from xmlclass import *
 from types import *
-import os
+import os, re
 
 """
 Dictionary that makes the relation between var names in plcopen and displayed values
@@ -993,7 +993,7 @@
             condition.setcontent({"name" : "ST", "value" : PLCOpenClasses["formattedText"]()})
             condition.settext(value)
         elif type == "connection":
-            condition = []
+            condition = [PLCOpenClasses["connection"]()]
         self.condition.setcontent({"name" : type, "value" : condition})
     setattr(cls, "setconditionContent", setconditionContent)
         
@@ -1023,9 +1023,10 @@
         if self.condition:
             content = self.condition.getcontent()
             if content["name"] != "connection":
-                self.condition.setcontent({"name" : "connection", "value" : []})
+                self.condition.setcontent({"name" : "connection", "value" : [PLCOpenClasses["connection"]()]})
                 content = self.condition.getcontent()
-            content["value"].append(PLCOpenClasses["connection"]())
+            else:
+                content["value"].append(PLCOpenClasses["connection"]())
     setattr(cls, "addconnection", addconnection)
     
     def removeconnection(self, idx):
@@ -1039,7 +1040,7 @@
         if self.condition:
             content = self.condition.getcontent()
             if content["name"] == "connection":
-                content["value"] = []
+                content["value"] = [PLCOpenClasses["connection"]()]
     setattr(cls, "removeconnections", removeconnections)
     
     def getconnections(self):