Bug with item selection on InstancesTree fixed
authorlbessard
Mon, 08 Sep 2008 13:56:34 +0200
changeset 262 3b92f0b96d31
parent 261 6fe3ee00f9a0
child 263 549c413cefce
Bug with item selection on InstancesTree fixed
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Mon Sep 08 10:32:41 2008 +0200
+++ b/PLCOpenEditor.py	Mon Sep 08 13:56:34 2008 +0200
@@ -1790,20 +1790,20 @@
     def SelectInstancesTreeItem(self, root, instancepath):
         found = False
         if self.InstancesTree is not None:
-            paths = instancepath.split(".")
+            paths = instancepath.split(".", 1)
             if wx.VERSION >= (2, 6, 0):
                 item, root_cookie = self.InstancesTree.GetFirstChild(root)
             else:
                 item, root_cookie = self.InstancesTree.GetFirstChild(root, 0)
             while item.IsOk() and not found:
-                if self.InstancesTree.GetItemText(item) == paths[0]:
+                name = self.InstancesTree.GetItemText(item).split(" (")[0]
+                if name == paths[0]:
                     if len(paths) == 1:
                         self.InstancesTree.SelectItem(item)
                         return True
                     else:
-                        found = self.SelectInstancesTreeItem(item, paths[1:])
-                else:
-                    item, root_cookie = self.InstancesTree.GetNextChild(root, root_cookie)
+                        found = self.SelectInstancesTreeItem(item, paths[1])
+                item, root_cookie = self.InstancesTree.GetNextChild(root, root_cookie)
         return found
 
 #-------------------------------------------------------------------------------