fix problem with SFC action/transition rename
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Tue, 20 Dec 2016 17:11:36 +0300
changeset 1610 31703a04789a
parent 1609 0d961dc6f58f
child 1611 5e64d552b25a
fix problem with SFC action/transition rename

Traceback (most recent call last):
File "/home/developer/WorkData/PLC/beremiz/beremiz/IDEFrame.py", line
1636, in OnProjectTreeItemEndEdit
elif new_name.upper() in [name.upper() for name in
self.Controler.GetProjectPouVariableNames(pou_name) if name !=
old_name]:
NameError: global name 'pou_name' is not defined
IDEFrame.py
--- a/IDEFrame.py	Tue Dec 20 14:41:10 2016 +0300
+++ b/IDEFrame.py	Tue Dec 20 17:11:36 2016 +0300
@@ -1622,6 +1622,8 @@
                         self.RefreshLibraryPanel()
                         self.RefreshPageTitles()
                 elif item_infos["type"] == ITEM_TRANSITION:
+                    pou_item = self.ProjectTree.GetItemParent(event.GetItem())
+                    pou_name = self.ProjectTree.GetItemText(pou_item)                    
                     if new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames()]:
                         message = _("A POU named \"%s\" already exists!")%new_name
                     elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariableNames(pou_name) if name != old_name]:
@@ -1633,6 +1635,8 @@
                                                 self.Controler.ComputePouTransitionName(words[1], new_name))
                         self.RefreshPageTitles()
                 elif item_infos["type"] == ITEM_ACTION:
+                    pou_item = self.ProjectTree.GetItemParent(event.GetItem())
+                    pou_name = self.ProjectTree.GetItemText(pou_item)
                     if new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames()]:
                         message = _("A POU named \"%s\" already exists!")%new_name
                     elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariableNames(pou_name) if name != old_name]: