def _initToolBox(self, withManual, withFuzzy, withCompare, withAudit): # Buttons hbox = gtk.HBox() if withManual or withFuzzy or withCompare: from .craftedRequests import ManualRequests, FuzzyRequests if withManual: b = SemiStockButton("", gtk.STOCK_INDEX, _("Send Request to Manual Editor")) b.connect("clicked", self._sendRequest, ManualRequests) self.request.childButtons.append(b) b.show() hbox.pack_start(b, False, False, padding=2) if withFuzzy: b = SemiStockButton("", gtk.STOCK_PROPERTIES, _("Send Request to Fuzzy Editor")) b.connect("clicked", self._sendRequest, FuzzyRequests) self.request.childButtons.append(b) b.show() hbox.pack_start(b, False, False, padding=2) if withCompare: b = SemiStockButton("", gtk.STOCK_ZOOM_100, _("Send Request and Response to Compare Tool")) b.connect("clicked", self._sendReqResp) self.response.childButtons.append(b) b.show() hbox.pack_start(b, False, False, padding=2) # I always can export requests b = SemiStockButton("", gtk.STOCK_COPY, _("Export Request")) b.connect("clicked", self._sendRequest, export_request) self.request.childButtons.append(b) b.show() hbox.pack_start(b, False, False, padding=2) self.pack_start(hbox, False, False, padding=5) hbox.show() if withAudit: # Add everything I need for the audit request thing: # The button that shows the menu b = SemiStockButton("", gtk.STOCK_EXECUTE, _("Audit Request with...")) b.connect("button-release-event", self._popupMenu) self.request.childButtons.append(b) b.show() hbox.pack_start(b, False, False, padding=2) # The throbber (hidden!) self.throbber = helpers.Throbber() hbox.pack_start(self.throbber, True, True) self.pack_start(hbox, False, False, padding=5) hbox.show()
def _build_search(self, widget): '''Builds the search bar.''' tooltips = gtk.Tooltips() self.srchtab = gtk.HBox() # close button close = gtk.Image() close.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU) eventbox = gtk.EventBox() eventbox.add(close) eventbox.connect("button-release-event", self._close) self.srchtab.pack_start(eventbox, expand=False, fill=False, padding=3) # label label = gtk.Label("Find:") self.srchtab.pack_start(label, expand=False, fill=False, padding=3) # entry self.search_entry = gtk.Entry() tooltips.set_tip(self.search_entry, _("Type here the phrase you want to find")) self.search_entry.connect("activate", self._find, "next") self.search_entry.connect("changed", self._find, "find") self.srchtab.pack_start(self.search_entry, expand=False, fill=False, padding=3) # find next button if self.small: but_text = '' else: but_text = 'Next' butn = SemiStockButton(but_text, gtk.STOCK_GO_DOWN) butn.connect("clicked", self._find, "next") tooltips.set_tip(butn, _("Find the next ocurrence of the phrase")) self.srchtab.pack_start(butn, expand=False, fill=False, padding=3) # find previous button if self.small: but_text = '' else: but_text = ('Previous') butp = SemiStockButton(but_text, gtk.STOCK_GO_UP) butp.connect("clicked", self._find, "previous") tooltips.set_tip(butp, _("Find the previous ocurrence of the phrase")) self.srchtab.pack_start(butp, expand=False, fill=False, padding=3) # make last two buttons equally width wn,hn = butn.size_request() wp,hp = butp.size_request() newwidth = max(wn, wp) butn.set_size_request(newwidth, hn) butp.set_size_request(newwidth, hp) # Match case CheckButton butCase = gtk.CheckButton(_('Match case')) butCase.set_active(self._matchCaseValue) butCase.connect("clicked", self._matchCase) # FIXME # current version of gtk.TextIter doesn't support SEARCH_CASE_INSENSITIVE #butCase.show() #self.srchtab.pack_start(butCase, expand=False, fill=False, padding=3) self.pack_start(self.srchtab, expand=False, fill=False) # Results self._resultsLabel = gtk.Label("") self.srchtab.pack_start(self._resultsLabel, expand=False, fill=False, padding=3) self.searching = False