Fix bug in popup menu and function block types in Variable Panel
authorlbessard
Sun, 07 Sep 2008 15:25:40 +0200
changeset 251 cc5377a296ea
parent 250 e6b58eafef1a
child 252 166ee9d2e233
Fix bug in popup menu and function block types in Variable Panel
Dialogs.py
plcopen/plcopen.py
--- a/Dialogs.py	Sat Sep 06 16:30:57 2008 +0200
+++ b/Dialogs.py	Sun Sep 07 15:25:40 2008 +0200
@@ -522,8 +522,9 @@
         
         self._init_sizers()
 
-    def __init__(self, parent, controler):
+    def __init__(self, parent, controler, transition = ""):
         self._init_ctrls(parent, controler)
+        self.Transition = transition
         self.Variable = None
         self.VarList = []
         self.MinVariableSize = None
@@ -546,9 +547,11 @@
             elif var_type == "Input" and self.Class.GetStringSelection() == "Input":
                 self.VariableName.Append(name)
             elif var_type == "Output" and self.Class.GetStringSelection() == "Output":
-                self.VariableName.Append(name)
+                if transition != "" or name == transition:
+                    self.VariableName.Append(name)
             elif var_type == "InOut" and self.Class.GetStringSelection() == "InOut":
-                self.VariableName.Append(name)
+                if transition != "" or name == transition:
+                    self.VariableName.Append(name)
         if self.VariableName.FindString(selected) != wx.NOT_FOUND:
             self.VariableName.SetStringSelection(selected)
         else:
--- a/plcopen/plcopen.py	Sat Sep 06 16:30:57 2008 +0200
+++ b/plcopen/plcopen.py	Sun Sep 07 15:25:40 2008 +0200
@@ -493,7 +493,7 @@
     setattr(cls, "GetCustomBlockType", GetCustomBlockType)
 
     # Return Block types checking for recursion
-    def GetCustomBlockTypes(self, exclude = ""):
+    def GetCustomBlockTypes(self, exclude = "", onlyfunctions = False):
         type = None
         if exclude != "":
             pou = self.getpou(exclude)
@@ -501,20 +501,16 @@
                 type = pou.getpouType()
         customblocktypes = []
         for customblocktype in self.CustomBlockTypes:
-            if customblocktype["name"] != exclude and not self.ElementIsUsedBy(exclude, customblocktype["name"]) and not (type == "function" and customblocktype["type"] != "function"):
+            if customblocktype["name"] != exclude and not self.ElementIsUsedBy(exclude, customblocktype["name"]) and not (onlyfunctions and customblocktype["type"] != "function"):
                 customblocktypes.append(customblocktype)
         return customblocktypes
     setattr(cls, "GetCustomBlockTypes", GetCustomBlockTypes)
 
     # Return Function Block types checking for recursion
     def GetCustomFunctionBlockTypes(self, exclude = ""):
-        type = None
-        if exclude != "":
-            pou = self.getpou(exclude)
-            type = pou.getpouType()
         customblocktypes = []
         for customblocktype in self.CustomBlockTypes:
-            if customblocktype["name"] != exclude and not self.ElementIsUsedBy(exclude, customblocktype["name"]) and not (type == "function" and customblocktype["type"] != "function"):
+            if customblocktype["name"] != exclude and not self.ElementIsUsedBy(exclude, customblocktype["name"]):
                 customblocktypes.append(customblocktype["name"])
         return customblocktypes
     setattr(cls, "GetCustomFunctionBlockTypes", GetCustomFunctionBlockTypes)