Fixed bug when generating new name for configuration and resource variable in VariablePanel
authorLaurent Bessard
Mon, 13 May 2013 23:07:24 +0200
changeset 1127 5315f26642e0
parent 1126 26baa0ae9fd7
child 1128 86527a6f06fb
Fixed bug when generating new name for configuration and resource variable in VariablePanel
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: