controls/SearchResultPanel.py
branchpython3
changeset 3750 f62625418bff
parent 3303 0ffb41625592
child 3789 8def429216ca
equal deleted inserted replaced
3749:fda6c1a37662 3750:f62625418bff
    21 # You should have received a copy of the GNU General Public License
    21 # You should have received a copy of the GNU General Public License
    22 # along with this program; if not, write to the Free Software
    22 # along with this program; if not, write to the Free Software
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 
    24 
    25 
    25 
    26 from __future__ import absolute_import
    26 
    27 from functools import reduce
    27 from functools import reduce
    28 
    28 
    29 import wx
    29 import wx
    30 import wx.lib.buttons
    30 import wx.lib.buttons
    31 import wx.lib.agw.customtreectrl as CT
    31 import wx.lib.agw.customtreectrl as CT
   287         if infos["text"] is not None:
   287         if infos["text"] is not None:
   288             text = infos["text"]
   288             text = infos["text"]
   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, map(lambda x: len(x) + 1, 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"] > 1:
   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))