Fixed bug in test if block type is used by current edited pou
authorLaurent Bessard
Thu, 07 Nov 2013 00:16:00 +0100
changeset 1372 ef26fcb7f5d4
parent 1371 3c55c99b10ab
child 1373 4278d5c1e414
Fixed bug in test if block type is used by current edited pou
PLCControler.py
--- a/PLCControler.py	Fri Oct 25 09:57:36 2013 +0200
+++ b/PLCControler.py	Thu Nov 07 00:16:00 2013 +0100
@@ -1622,7 +1622,7 @@
                 "list": [pou.getblockInfos()
                          for pou in project.getpous(name, filter)
                          if (name is None or 
-                             len(self.GetInstanceList(pou, name, debug)) > 0)]})
+                             len(self.GetInstanceList(pou, name, debug)) == 0)]})
             return blocktypes
         return self.TotalTypes
 
@@ -1642,7 +1642,7 @@
             blocktypes.extend([pou.getname()
                 for pou in project.getpous(name, ["functionBlock"])
                 if (name is None or 
-                    len(self.GetInstanceList(pou, name, debug)) > 0)])
+                    len(self.GetInstanceList(pou, name, debug)) == 0)])
         return blocktypes
 
     # Return Block types checking for recursion
@@ -1676,7 +1676,7 @@
                 for datatype in project.getdataTypes(name)
                 if (not only_locatables or self.IsLocatableDataType(datatype, debug))
                     and (name is None or 
-                         len(self.GetInstanceList(datatype, name, debug)) > 0)])
+                         len(self.GetInstanceList(datatype, name, debug)) == 0)])
         if confnodetypes:
             for category in self.GetConfNodeDataTypes(name, only_locatables):
                 datatypes.extend(category["list"])