# HG changeset patch
# User lbessard
# Date 1220793940 -7200
# Node ID cc5377a296ea8b2aaf1c979275e283aa6fb4055a
# Parent  e6b58eafef1a6ea556ce747395cf702f06c408fb
Fix bug in popup menu and function block types in Variable Panel

diff -r e6b58eafef1a -r cc5377a296ea Dialogs.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:
diff -r e6b58eafef1a -r cc5377a296ea plcopen/plcopen.py
--- 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)