Bug when drag and drop tree variables fixed
authorlaurent
Tue, 06 Oct 2009 09:26:05 +0200
changeset 441 b7511a0b261c
parent 440 e183bffc05f0
child 442 a756b58699b8
Bug when drag and drop tree variables fixed
Viewer.py
--- a/Viewer.py	Fri Oct 02 18:14:43 2009 +0200
+++ b/Viewer.py	Tue Oct 06 09:26:05 2009 +0200
@@ -271,9 +271,7 @@
                 if len(values) > 2 and pou_type == "program":
                     var_name = values[3]
                     if var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]:
-                        message = _("\"%s\" pou already exists!")%blockname
-                    elif var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
-                        message = _("\"%s\" element for this pou already exists!")%blockname
+                        message = _("\"%s\" pou already exists!")%var_name
                     else:
                         if values[0][1] == "Q":
                             var_class = OUTPUT
@@ -294,7 +292,8 @@
                         variable.SetPosition(x, y)
                         variable.SetSize(width, height)
                         self.ParentWindow.AddBlock(variable)
-                        self.ParentWindow.Controler.AddEditedElementPouVar(tagname, var_type, var_name, values[0], values[4])
+                        if not var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
+                            self.ParentWindow.Controler.AddEditedElementPouVar(tagname, var_type, var_name, values[0], values[4])
                         self.ParentWindow.Controler.AddEditedElementVariable(tagname, id, var_class)
                         self.ParentWindow.RefreshVariableModel(variable)
                         self.ParentWindow.RefreshBuffer()