# HG changeset patch # User Laurent Bessard # Date 1368114771 -7200 # Node ID f0e5b475a0740e3cbab292b5c4231fe1cd5338cf # Parent 017cd95bc07ec1c8c340133de5e86e7679c86635 Fixed bug when modifying ConfTreeNode IEC Channel diff -r 017cd95bc07e -r f0e5b475a074 IDEFrame.py --- a/IDEFrame.py Thu May 09 12:50:51 2013 +0200 +++ b/IDEFrame.py Thu May 09 17:52:51 2013 +0200 @@ -1419,12 +1419,35 @@ #------------------------------------------------------------------------------- def RefreshProjectTree(self): + # Disconnect event when selection in treectrl changed + self.Unbind(wx.EVT_TREE_SEL_CHANGED, + id=ID_PLCOPENEDITORPROJECTTREE) + + # Extract current selected item tagname + selected = self.ProjectTree.GetSelection() + if selected is not None and selected.IsOk(): + item_infos = self.ProjectTree.GetPyData(selected) + tagname = item_infos.get("tagname", None) + else: + tagname = None + + # Refresh treectrl items according to project infos infos = self.Controler.GetProjectInfos() root = self.ProjectTree.GetRootItem() if not root.IsOk(): root = self.ProjectTree.AddRoot(infos["name"]) self.GenerateProjectTreeBranch(root, infos) self.ProjectTree.Expand(root) + + # Select new item corresponding to previous selected item + if tagname is not None: + wx.CallAfter(self.SelectProjectTreeItem, tagname) + + # Reconnect event when selection in treectrl changed + wx.CallAfter(self.Bind, + wx.EVT_TREE_SEL_CHANGED, + self.OnProjectTreeItemSelected, + id=ID_PLCOPENEDITORPROJECTTREE) def ResetSelectedItem(self): self.SelectedItem = None diff -r 017cd95bc07e -r f0e5b475a074 ProjectController.py --- a/ProjectController.py Thu May 09 12:50:51 2013 +0200 +++ b/ProjectController.py Thu May 09 17:52:51 2013 +0200 @@ -330,6 +330,7 @@ values.append( {"name": "%s: %s" % (CTNChild.GetFullIEC_Channel(), CTNChild.CTNName()), + "tagname": CTNChild.CTNFullName(), "type": ITEM_CONFNODE, "confnode": CTNChild, "icon": CTNChild.GetIconName(), diff -r 017cd95bc07e -r f0e5b475a074 editors/ConfTreeNodeEditor.py --- a/editors/ConfTreeNodeEditor.py Thu May 09 12:50:51 2013 +0200 +++ b/editors/ConfTreeNodeEditor.py Thu May 09 17:52:51 2013 +0200 @@ -506,7 +506,6 @@ res = self.SetConfNodeParamsAttribute("BaseParams.IEC_Channel", confnode_IECChannel + dir) wx.CallAfter(self.RefreshIECChannelControlsState) wx.CallAfter(self.ParentWindow._Refresh, TITLE, FILEMENU, PROJECTTREE) - wx.CallAfter(self.ParentWindow.SelectProjectTreeItem, self.GetTagName()) event.Skip() return OnConfNodeTreeItemChannelChanged