# HG changeset patch
# User Laurent Bessard
# Date 1368479244 -7200
# Node ID 5315f26642e0ecfc10fe576f05bcbe405f32bc8b
# Parent  26baa0ae9fd7b0128cccae16e4c4c0bd3fca6a75
Fixed bug when generating new name for configuration and resource variable in VariablePanel

diff -r 26baa0ae9fd7 -r 5315f26642e0 PLCControler.py
--- a/PLCControler.py	Mon May 13 16:38:53 2013 +0200
+++ b/PLCControler.py	Mon May 13 23:07:24 2013 +0200
@@ -2105,13 +2105,15 @@
         if tagname is not None:
             names.update(dict([(varname.upper(), True) 
                                for varname in self.GetEditedElementVariables(tagname, debug)]))
-            element = self.GetEditedElement(tagname, debug)
-            if element is not None and element.getbodyType() not in ["ST", "IL"]:
-                for instance in element.getinstances():
-                    if isinstance(instance, (plcopen.sfcObjects_step, 
-                                             plcopen.commonObjects_connector, 
-                                             plcopen.commonObjects_continuation)):
-                        names[instance.getname().upper()] = True
+            words = tagname.split("::")
+            if words[0] in ["P","T","A"]:
+                element = self.GetEditedElement(tagname, debug)
+                if element is not None and element.getbodyType() not in ["ST", "IL"]:
+                    for instance in element.getinstances():
+                        if isinstance(instance, (plcopen.sfcObjects_step, 
+                                                 plcopen.commonObjects_connector, 
+                                                 plcopen.commonObjects_continuation)):
+                            names[instance.getname().upper()] = True
         else:
             project = self.GetProject(debug)
             if project is not None: