Example #1
0
 def _build_search(self, widget):
     """Builds the search bar."""
     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()
     self.search_entry.set_tooltip_text(
         _("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")
     butn.set_tooltip_text(_("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")
     butp.set_tooltip_text(_("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
Example #2
0
    def _initToolBox(self, withManual, withFuzzy, withCompare, withAudit):
        # Buttons

        # This import needs to be here in order to avoid an import loop
        from w3af.core.ui.gui.tools.fuzzy_requests import FuzzyRequests
        from w3af.core.ui.gui.tools.manual_requests import ManualRequests

        hbox = gtk.HBox()
        if withManual or withFuzzy or withCompare:

            if withManual:
                b = SemiStockButton("", gtk.STOCK_INDEX,
                                    _("Send Request to Manual Editor"))
                b.connect("clicked", self._send_request, 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._send_request, 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._send_request, 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.draw_area = helpers.DrawingAreaStringRepresentation()
        hbox.pack_end(self.draw_area, False, False)

        self.pack_start(hbox, False, False, padding=5)
        hbox.show()
Example #3
0
    def _initToolBox(self, withManual, withFuzzy, withCompare, withAudit):
        # Buttons

        # This import needs to be here in order to avoid an import loop
        from w3af.core.ui.gui.tools.fuzzy_requests import FuzzyRequests
        from w3af.core.ui.gui.tools.manual_requests import ManualRequests

        hbox = gtk.HBox()
        if withManual or withFuzzy or withCompare:

            if withManual:
                b = SemiStockButton("", gtk.STOCK_INDEX, _("Send Request to Manual Editor"))
                b.connect("clicked", self._send_request, 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._send_request, 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._send_request, 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.draw_area = helpers.DrawingAreaStringRepresentation()
        hbox.pack_end(self.draw_area, False, False)

        self.pack_start(hbox, False, False, padding=5)
        hbox.show()
Example #4
0
 def _build_search(self, widget):
     """Builds the search bar."""
     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()
     self.search_entry.set_tooltip_text(
         _("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")
     butn.set_tooltip_text(_("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")
     butp.set_tooltip_text(_("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