controls/SearchResultPanel.py
changeset 1768 691083b5682a
parent 1766 c1e5b9f19483
child 1773 38fde37c3766
equal deleted inserted replaced
1767:c74815729afd 1768:691083b5682a
    85 
    85 
    86         self.SetSizer(self.MainSizer)
    86         self.SetSizer(self.MainSizer)
    87 
    87 
    88     def _init_ctrls(self, prnt):
    88     def _init_ctrls(self, prnt):
    89         wx.Panel.__init__(self, id=ID_SEARCHRESULTPANEL,
    89         wx.Panel.__init__(self, id=ID_SEARCHRESULTPANEL,
    90               name='SearchResultPanel', parent=prnt, pos=wx.Point(0, 0),
    90                           name='SearchResultPanel', parent=prnt, pos=wx.Point(0, 0),
    91               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
    91                           size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
    92 
    92 
    93         self.HeaderLabel = wx.StaticText(id=ID_SEARCHRESULTPANELHEADERLABEL,
    93         self.HeaderLabel = wx.StaticText(id=ID_SEARCHRESULTPANELHEADERLABEL,
    94               name='HeaderLabel', parent=self,
    94                                          name='HeaderLabel', parent=self,
    95               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
    95                                          pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
    96 
    96 
    97         search_results_tree_style = CT.TR_HAS_BUTTONS | CT.TR_NO_LINES | CT.TR_HAS_VARIABLE_ROW_HEIGHT
    97         search_results_tree_style = CT.TR_HAS_BUTTONS | CT.TR_NO_LINES | CT.TR_HAS_VARIABLE_ROW_HEIGHT
    98         self.SearchResultsTree = CT.CustomTreeCtrl(id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE,
    98         self.SearchResultsTree = CT.CustomTreeCtrl(id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE,
    99               name="SearchResultsTree", parent=self,
    99                                                    name="SearchResultsTree", parent=self,
   100               pos=wx.Point(0, 0), style=search_results_tree_style)
   100                                                    pos=wx.Point(0, 0), style=search_results_tree_style)
   101         if wx.VERSION >= (2, 8, 11):
   101         if wx.VERSION >= (2, 8, 11):
   102             self.SearchResultsTree.SetAGWWindowStyleFlag(search_results_tree_style)
   102             self.SearchResultsTree.SetAGWWindowStyleFlag(search_results_tree_style)
   103         self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnSearchResultsTreeItemActivated,
   103         self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnSearchResultsTreeItemActivated,
   104               id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE)
   104                   id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE)
   105 
   105 
   106         self.ResetButton = wx.lib.buttons.GenBitmapButton(self,
   106         self.ResetButton = wx.lib.buttons.GenBitmapButton(
   107               bitmap=GetBitmap("reset"), size=wx.Size(28, 28), style=wx.NO_BORDER)
   107             self, bitmap=GetBitmap("reset"),
       
   108             size=wx.Size(28, 28), style=wx.NO_BORDER)
   108         self.ResetButton.SetToolTipString(_("Reset search result"))
   109         self.ResetButton.SetToolTipString(_("Reset search result"))
   109         self.Bind(wx.EVT_BUTTON, self.OnResetButton, self.ResetButton)
   110         self.Bind(wx.EVT_BUTTON, self.OnResetButton, self.ResetButton)
   110 
   111 
   111         self._init_sizers()
   112         self._init_sizers()
   112 
   113 
   298         if text is not None:
   299         if text is not None:
   299             text_ctrl_style = wx.BORDER_NONE | wx.TE_READONLY | wx.TE_RICH2
   300             text_ctrl_style = wx.BORDER_NONE | wx.TE_READONLY | wx.TE_RICH2
   300             if wx.Platform != '__WXMSW__' or len(text.splitlines()) > 1:
   301             if wx.Platform != '__WXMSW__' or len(text.splitlines()) > 1:
   301                 text_ctrl_style |= wx.TE_MULTILINE
   302                 text_ctrl_style |= wx.TE_MULTILINE
   302             text_ctrl = wx.TextCtrl(id=-1, parent=self.SearchResultsTree, pos=wx.Point(0, 0),
   303             text_ctrl = wx.TextCtrl(id=-1, parent=self.SearchResultsTree, pos=wx.Point(0, 0),
   303                     value=text, style=text_ctrl_style)
   304                                     value=text, style=text_ctrl_style)
   304             width, height = text_ctrl.GetTextExtent(text)
   305             width, height = text_ctrl.GetTextExtent(text)
   305             text_ctrl.SetClientSize(wx.Size(width + 1, height))
   306             text_ctrl.SetClientSize(wx.Size(width + 1, height))
   306             text_ctrl.SetBackgroundColour(self.SearchResultsTree.GetBackgroundColour())
   307             text_ctrl.SetBackgroundColour(self.SearchResultsTree.GetBackgroundColour())
   307             text_ctrl.Bind(wx.EVT_LEFT_DOWN, self.GetTextCtrlClickFunction(root))
   308             text_ctrl.Bind(wx.EVT_LEFT_DOWN, self.GetTextCtrlClickFunction(root))
   308             text_ctrl.Bind(wx.EVT_LEFT_DCLICK, self.GetTextCtrlDClickFunction(root))
   309             text_ctrl.Bind(wx.EVT_LEFT_DCLICK, self.GetTextCtrlDClickFunction(root))