controls/SearchResultPanel.py
changeset 3971 f1c673cddc1f
parent 3789 8def429216ca
equal deleted inserted replaced
3970:d73a477237ef 3971:f1c673cddc1f
   170             search_results_tree_infos = {
   170             search_results_tree_infos = {
   171                 "name": _("Project '%s':") % self.ParentWindow.Controler.GetProjectName(),
   171                 "name": _("Project '%s':") % self.ParentWindow.Controler.GetProjectName(),
   172                 "type": ITEM_PROJECT,
   172                 "type": ITEM_PROJECT,
   173                 "data": None,
   173                 "data": None,
   174                 "text": None,
   174                 "text": None,
   175                 "matches": None,
   175                 "matches": 0,
   176             }
   176             }
   177             search_results_tree_children = search_results_tree_infos.setdefault("children", [])
   177             search_results_tree_children = search_results_tree_infos.setdefault("children", [])
   178             for tagname in self.ElementsOrder:
   178             for tagname in self.ElementsOrder:
   179                 results = self.SearchResults.get(tagname, [])
   179                 results = self.SearchResults.get(tagname, [])
   180                 matches_number += len(results)
   180                 matches_number += len(results)
   289             start, end = infos["data"][1:3]
   289             start, end = infos["data"][1:3]
   290             text_lines = infos["text"].splitlines()
   290             text_lines = infos["text"].splitlines()
   291             start_idx = start[1]
   291             start_idx = start[1]
   292             end_idx = reduce(lambda x, y: x + y, [len(x) + 1 for x in text_lines[:end[0] - start[0]]], end[1] + 1)
   292             end_idx = reduce(lambda x, y: x + y, [len(x) + 1 for x in text_lines[:end[0] - start[0]]], end[1] + 1)
   293             style = wx.TextAttr(wx.BLACK, wx.Colour(206, 204, 247))
   293             style = wx.TextAttr(wx.BLACK, wx.Colour(206, 204, 247))
   294         elif infos["type"] is not None and infos["matches"] > 1:
   294         elif infos["type"] is not None and infos["matches"] > 0:
   295             text = _("(%d matches)") % infos["matches"]
   295             text = _("(%d matches)") % infos["matches"]
   296             start_idx, end_idx = 0, len(text)
   296             start_idx, end_idx = 0, len(text)
   297             style = wx.TextAttr(wx.Colour(0, 127, 174))
   297             style = wx.TextAttr(wx.Colour(0, 127, 174))
   298 
   298 
   299         if text is not None:
   299         if text is not None: