PLCControler.py
changeset 70 0e48629c1e6d
parent 68 66308e07402c
child 71 0578bc212c20
--- a/PLCControler.py	Mon Aug 13 18:04:19 2007 +0200
+++ b/PLCControler.py	Mon Aug 13 18:06:50 2007 +0200
@@ -208,11 +208,10 @@
         for pou in self.Project.getPous():
             if not pou_name or pou_name == pou.getName():
                 variables.extend([var["Name"] for var in self.GetPouInterfaceVars(pou)])
-                if pou.getBodyType() == "SFC":
-                    for transition in pou.getTransitionList():
-                        variables.append(transition.getName())
-                    for action in pou.getActionList():
-                        variables.append(action.getName())
+                for transition in pou.getTransitionList():
+                    variables.append(transition.getName())
+                for action in pou.getActionList():
+                    variables.append(action.getName())
         return variables
     
     # Return if project is saved
@@ -1159,6 +1158,17 @@
                 return actions
         return []
 
+    # Return the names of the pou elements
+    def GetCurrentElementEditingVariables(self):
+        if self.CurrentElementEditing != None:
+            current_name = self.ElementsOpened[self.CurrentElementEditing]
+            words = current_name.split("::")
+            if len(words) == 1:
+                return self.GetProjectPouVariables(current_name)
+            else:
+                return self.GetProjectPouVariables(words[1])
+        return []
+
     # Return the current pou editing informations
     def GetCurrentElementEditingInstanceInfos(self, id = None, exclude = []):
         infos = {}
@@ -1339,7 +1349,6 @@
                     infos["connectors"]["connection"] = {}
                     infos["connectors"]["connection"]["links"] = []
                     connections = instance.getConnections()
-                    print connections
                     if connections:
                         for link in connections:
                             dic = {"refLocalId":link.getRefLocalId(),"points":link.getPoints(),"formalParameter":link.getFormalParameter()}
@@ -1794,7 +1803,7 @@
     def SetCurrentElementEditingTransitionInfos(self, id, infos):
         transition = self.GetCurrentElementEditing().getInstance(id)
         for param, value in infos.items():
-            if param == "type" and infos.get("condition", None):
+            if param == "type" and value != "connection":
                 transition.setConditionContent(value, infos["condition"])
             elif param == "height":
                 transition.setHeight(value)
@@ -1815,6 +1824,7 @@
                 transition.addConnectionPointOut()
                 transition.connectionPointOut.setRelPosition(position.x, position.y)
                 if infos.get("type", None) == "connection":
+                    transition.setConditionContent("connection", None)
                     connection_connector = value["connection"]
                     self.SetConnectionWires(transition, connection_connector)