equal
deleted
inserted
replaced
44 #------------------------------------------------------------------------------- |
44 #------------------------------------------------------------------------------- |
45 # Search Result Panel |
45 # Search Result Panel |
46 #------------------------------------------------------------------------------- |
46 #------------------------------------------------------------------------------- |
47 |
47 |
48 |
48 |
49 [ID_SEARCHRESULTPANEL, ID_SEARCHRESULTPANELHEADERLABEL, |
49 [ |
50 ID_SEARCHRESULTPANELSEARCHRESULTSTREE, ID_SEARCHRESULTPANELRESETBUTTON, |
50 ID_SEARCHRESULTPANEL, ID_SEARCHRESULTPANELHEADERLABEL, |
|
51 ID_SEARCHRESULTPANELSEARCHRESULTSTREE, ID_SEARCHRESULTPANELRESETBUTTON, |
51 ] = [wx.NewId() for _init_ctrls in range(4)] |
52 ] = [wx.NewId() for _init_ctrls in range(4)] |
52 |
53 |
53 |
54 |
54 class SearchResultPanel(wx.Panel): |
55 class SearchResultPanel(wx.Panel): |
55 |
56 |
172 if self.Criteria is None: |
173 if self.Criteria is None: |
173 self.HeaderLabel.SetLabel(_("No search results available.")) |
174 self.HeaderLabel.SetLabel(_("No search results available.")) |
174 self.ResetButton.Enable(False) |
175 self.ResetButton.Enable(False) |
175 else: |
176 else: |
176 matches_number = 0 |
177 matches_number = 0 |
177 search_results_tree_infos = {"name": _("Project '%s':") % self.ParentWindow.Controler.GetProjectName(), |
178 search_results_tree_infos = { |
178 "type": ITEM_PROJECT, |
179 "name": _("Project '%s':") % self.ParentWindow.Controler.GetProjectName(), |
179 "data": None, |
180 "type": ITEM_PROJECT, |
180 "text": None, |
181 "data": None, |
181 "matches": None, |
182 "text": None, |
182 } |
183 "matches": None, |
|
184 } |
183 search_results_tree_children = search_results_tree_infos.setdefault("children", []) |
185 search_results_tree_children = search_results_tree_infos.setdefault("children", []) |
184 for tagname in self.ElementsOrder: |
186 for tagname in self.ElementsOrder: |
185 results = self.SearchResults.get(tagname, []) |
187 results = self.SearchResults.get(tagname, []) |
186 matches_number += len(results) |
188 matches_number += len(results) |
187 |
189 |
217 child_type = self.ParentWindow.Controler.GetActionBodyType(words[1], words[2]) |
219 child_type = self.ParentWindow.Controler.GetActionBodyType(words[1], words[2]) |
218 else: |
220 else: |
219 child_type = self.ParentWindow.Controler.GetPouBodyType(words[1]) |
221 child_type = self.ParentWindow.Controler.GetPouBodyType(words[1]) |
220 else: |
222 else: |
221 child_name = GenerateName(infos[3:]) |
223 child_name = GenerateName(infos[3:]) |
222 child_infos = {"name": child_name, |
224 child_infos = { |
223 "type": child_type, |
225 "name": child_name, |
224 "data": (infos, start, end, None), |
226 "type": child_type, |
225 "text": text, |
227 "data": (infos, start, end, None), |
226 "matches": 1, |
228 "text": text, |
227 "children": [], |
229 "matches": 1, |
228 } |
230 "children": [], |
|
231 } |
229 children.append(child_infos) |
232 children.append(child_infos) |
230 |
233 |
231 if len(words) > 2: |
234 if len(words) > 2: |
232 for _element_infos in search_results_tree_children: |
235 for _element_infos in search_results_tree_children: |
233 if _element_infos["name"] == words[1]: |
236 if _element_infos["name"] == words[1]: |