Fix bug in resource search result highlighting
authorLaurent Bessard
Wed, 19 Dec 2012 13:29:38 +0100
changeset 899 64aa66d481c5
parent 898 6b2958f04f30
child 900 3e78925125e1
Fix bug in resource search result highlighting
controls/SearchResultPanel.py
editors/ResourceEditor.py
--- a/controls/SearchResultPanel.py	Tue Dec 11 01:19:42 2012 +0100
+++ b/controls/SearchResultPanel.py	Wed Dec 19 13:29:38 2012 +0100
@@ -230,6 +230,21 @@
                             _element_infos["matches"] += len(children)
                             _element_infos["children"].append(element_infos)
                             break
+                    if element_type == ITEM_RESOURCE:
+                        search_results_tree_children.append(element_infos)
+                    else:
+                        _tagname = self.ParentWindow.Controler.ComputePouName(words[1])
+                        _element_type = self.ParentWindow.Controler.GetPouType(words[1])
+                    
+                        _element_infos = {"name": words[1],
+                                          "type": _element_type,
+                                          "data": _tagname,
+                                          "text": None,
+                                          "matches": 1,
+                                          "children": [element_infos]}
+                    
+                        search_results_tree_children.append(_element_infos)
+                
                 else:
                     search_results_tree_children.append(element_infos)
             
--- a/editors/ResourceEditor.py	Tue Dec 11 01:19:42 2012 +0100
+++ b/editors/ResourceEditor.py	Wed Dec 19 13:29:38 2012 +0100
@@ -458,6 +458,8 @@
         event.Skip()
     
     def AddHighlight(self, infos, start, end, highlight_type):
+        EditorPanel.AddHighlight(self, infos, start, end, highlight_type)
+        
         if infos[0] == "task":
             self.TasksTable.AddHighlight(infos[1:], highlight_type)
         elif infos[0] == "instance":