def __init__(self, parent): wx.Panel.__init__(self, parent, -1) self.searchField = wx.SearchCtrl(self, -1, size=(200, -1), style=wx.TE_PROCESS_ENTER) self.searchField.ShowSearchButton(True) self.searchField.ShowCancelButton(True) self.InitHistory() iconSize = (16, 16) #self.downButton = wx.Button(self, -1, 'Next') downIcon = IconImages.getDownBitmap() self.downButton = wx.BitmapButton(self, -1, downIcon, iconSize, (26, 26)) self.downButton.SetToolTipString("Next") #self.upButton = wx.Button(self, -1, 'Prev') upIcon = IconImages.getUpBitmap() self.upButton = wx.BitmapButton(self, -1, upIcon, iconSize, (26, 26)) self.upButton.SetToolTipString("Prvious") self.caseCheck = wx.CheckBox(self, -1, "Match Case") self.caseCheck.SetToolTipString("Match Case") self.reCheck = wx.CheckBox(self, -1, "RE") self.reCheck.SetToolTipString("Use Regular Expression") sizer = wx.FlexGridSizer(cols=5, hgap=4, vgap=10) sizer.AddGrowableCol(4) sizer.Add(self.searchField, 1, wx.EXPAND) sizer.Add(self.downButton, 2, wx.ALIGN_CENTER_VERTICAL) sizer.Add(self.upButton, 3, wx.ALIGN_CENTER_VERTICAL) sizer.Add(self.caseCheck, 4, wx.ALIGN_CENTER_VERTICAL) sizer.Add(self.reCheck, 5, wx.ALIGN_CENTER_VERTICAL) self.SetSizer(sizer) # bindings self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnCallMenu, self.searchField) self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.OnCancel, self.searchField) self.Bind(wx.EVT_TEXT_ENTER, self.OnEnterSearch, self.searchField) self.Bind(wx.EVT_TEXT, self.OnIncrSearch, self.searchField) self.Bind(wx.EVT_MENU, self.OnUseHistory) self.Bind(wx.EVT_BUTTON, self.OnNext, self.downButton) self.Bind(wx.EVT_BUTTON, self.OnPrev, self.upButton)
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) self.searchField = wx.SearchCtrl(self, -1, size=(200,-1), style=wx.TE_PROCESS_ENTER) self.searchField.ShowSearchButton(True) self.searchField.ShowCancelButton(True) self.InitHistory() iconSize = (16, 16) #self.downButton = wx.Button(self, -1, 'Next') downIcon = IconImages.getDownBitmap() self.downButton = wx.BitmapButton(self, -1, downIcon, iconSize, (26, 26)) self.downButton.SetToolTipString("Next") #self.upButton = wx.Button(self, -1, 'Prev') upIcon = IconImages.getUpBitmap() self.upButton = wx.BitmapButton(self, -1, upIcon, iconSize, (26, 26)) self.upButton.SetToolTipString("Prvious") self.caseCheck = wx.CheckBox(self, -1, "Match Case") self.caseCheck.SetToolTipString("Match Case") self.reCheck = wx.CheckBox(self, -1, "RE") self.reCheck.SetToolTipString("Use Regular Expression") sizer = wx.FlexGridSizer(cols=5, hgap=4, vgap=10) sizer.AddGrowableCol(4) sizer.Add(self.searchField, 1, wx.EXPAND) sizer.Add(self.downButton, 2, wx.ALIGN_CENTER_VERTICAL) sizer.Add(self.upButton, 3, wx.ALIGN_CENTER_VERTICAL) sizer.Add(self.caseCheck, 4, wx.ALIGN_CENTER_VERTICAL) sizer.Add(self.reCheck, 5, wx.ALIGN_CENTER_VERTICAL) self.SetSizer(sizer) # bindings self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnCallMenu, self.searchField) self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.OnCancel, self.searchField) self.Bind(wx.EVT_TEXT_ENTER, self.OnEnterSearch, self.searchField) self.Bind(wx.EVT_TEXT, self.OnIncrSearch, self.searchField) self.Bind(wx.EVT_MENU, self.OnUseHistory) self.Bind(wx.EVT_BUTTON, self.OnNext, self.downButton) self.Bind(wx.EVT_BUTTON, self.OnPrev, self.upButton)