original_docstring: Add our menu item to the menu
docstring: Add our menu item to the menu
docstring_tokens: Add our menu item to the menu
code: def callback(self, menuitems, menu, terminal):
          """Add our menu item to the menu"""
          self.terminal = terminal
          item = gtk.ImageMenuItem(gtk.STOCK_FIND)
          item.connect('activate', self.do_search)
          if terminal.vte.get_has_selection():
              clip = gtk.clipboard_get(gtk.gdk.SELECTION_PRIMARY)
              self.searchstring = clip.wait_for_text().strip()
              self.searchstring = self.searchstring.replace("\n", " ")
              self.searchstring = self.searchstring.replace("\t", " ")
              self.searchstring = _spaces.sub(" ", self.searchstring)
          else:
              self.searchstring = None
          if self.searchstring:
              if len(self.searchstring) > 40:
                  displaystring = self.searchstring[:37] + "..."
              else:
                  displaystring = self.searchstring
              item.set_label("Search Wikipedia for \"%s\"" % displaystring)
              item.set_sensitive(True)
          else:
              item.set_label("Search Wikipedia")
              item.set_sensitive(False)
          # Avoid turning any underscores in selection into menu accelerators
          item.set_use_underline(False)
          menuitems.append(item)
code_tokens: def callback ( self , menuitems , menu , terminal ) : self . terminal = terminal item = gtk . ImageMenuItem ( gtk . STOCK_FIND ) item . connect ( 'activate' , self . do_search ) if terminal . vte . get_has_selection ( ) : clip = gtk . clipboard_get ( gtk . gdk . SELECTION_PRIMARY ) self . searchstring = clip . wait_for_text ( ) . strip ( ) self . searchstring = self . searchstring . replace ( "\n" , " " ) self . searchstring = self . searchstring . replace ( "\t" , " " ) self . searchstring = _spaces . sub ( " " , self . searchstring ) else : self . searchstring = None if self . searchstring : if len ( self . searchstring ) > 40 : displaystring = self . searchstring [ : 37 ] + "..." else : displaystring = self . searchstring item . set_label ( "Search Wikipedia for \"%s\"" % displaystring ) item . set_sensitive ( True ) else : item . set_label ( "Search Wikipedia" ) item . set_sensitive ( False ) item . set_use_underline ( False ) menuitems . append ( item )
short_docstring: Add our menu item to the menu
short_docstring_tokens: Add our menu item to the menu
comment: """Add our menu item to the menu"""$SEP$# Avoid turning any underscores in selection into menu accelerators