Added search engines

This commit is contained in:
Clement Lefebvre 2010-09-06 21:56:27 +01:00
parent e8380e8584
commit cef9eec7cd
12 changed files with 307 additions and 74 deletions

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
mintmenu (5.0.1) julia; urgency=low
* Added search engines to mintMenu
-- Clement Lefebvre <root@linuxmint.com> Mon, 06 Sep 2010 21:55:00 +0000
mintmenu (5.0.0) julia; urgency=low mintmenu (5.0.0) julia; urgency=low
* Filtering now uses APT to fetch results and apturl to install packages * Filtering now uses APT to fetch results and apturl to install packages

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-04-27 08:37+0100\n" "POT-Creation-Date: 2010-09-06 21:55+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -142,7 +142,7 @@ msgid "Options"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:64 #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:64
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:244 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:262
msgid "Applications" msgid "Applications"
msgstr "" msgstr ""
@ -151,8 +151,8 @@ msgid "Colors"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:67 #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:67
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:230 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:248
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:235 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:253
msgid "Favorites" msgid "Favorites"
msgstr "" msgstr ""
@ -214,27 +214,27 @@ msgid "Toggle Default Places:"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:88 #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:88
#: usr/lib/linuxmint/mintMenu/plugins/places.py:144 #: usr/lib/linuxmint/mintMenu/plugins/places.py:145
msgid "Computer" msgid "Computer"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:89 #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:89
#: usr/lib/linuxmint/mintMenu/plugins/places.py:151 #: usr/lib/linuxmint/mintMenu/plugins/places.py:152
msgid "Home Folder" msgid "Home Folder"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:90 #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:90
#: usr/lib/linuxmint/mintMenu/plugins/places.py:158 #: usr/lib/linuxmint/mintMenu/plugins/places.py:159
msgid "Network" msgid "Network"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:91 #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:91
#: usr/lib/linuxmint/mintMenu/plugins/places.py:178 #: usr/lib/linuxmint/mintMenu/plugins/places.py:179
msgid "Desktop" msgid "Desktop"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:92 #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:92
#: usr/lib/linuxmint/mintMenu/plugins/places.py:185 #: usr/lib/linuxmint/mintMenu/plugins/places.py:186
msgid "Trash" msgid "Trash"
msgstr "" msgstr ""
@ -323,105 +323,143 @@ msgstr ""
msgid "Recent documents" msgid "Recent documents"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:228 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:246
msgid "Filter:" msgid "Search:"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:232 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:250
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:233 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:251
msgid "All applications" msgid "All applications"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:632 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:605
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:633
#, python-format #, python-format
msgid "Search portal for '%s'" msgid "Search Google for %s"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:636 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:612
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:637
#, python-format #, python-format
msgid "Search repositories for '%s'" msgid "Search Wikipedia for %s"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:640 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:627
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:641
#, python-format #, python-format
msgid "Show package '%s'" msgid "Lookup %s in Dictionary"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:644 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:634
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:645 #, python-format
msgid "Search Computer for %s"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:679
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:697
#, python-format #, python-format
msgid "Install package '%s'" msgid "Install package '%s'"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:697 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:765
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:762 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:830
msgid "Add to desktop" msgid "Add to desktop"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:698 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:766
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:763 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:831
msgid "Add to panel" msgid "Add to panel"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:700 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:768
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:745 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:813
msgid "Insert space" msgid "Insert space"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:701 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:769
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:746 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:814
msgid "Insert separator" msgid "Insert separator"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:703 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:771
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:766 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:834
msgid "Launch when I log in" msgid "Launch when I log in"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:705 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:773
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:768 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:836
msgid "Launch" msgid "Launch"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:706 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:774
msgid "Remove from favorites" msgid "Remove from favorites"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:708 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:776
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:772 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:840
msgid "Edit properties" msgid "Edit properties"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:744 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:812
msgid "Remove" msgid "Remove"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:765 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:833
msgid "Show in my favorites" msgid "Show in my favorites"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:769 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:837
msgid "Uninstall" msgid "Uninstall"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:770 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:838
msgid "Delete from menu" msgid "Delete from menu"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:1225 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:890
msgid "Search Google"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:897
msgid "Search Wikipedia"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:907
msgid "Lookup Dictionnary"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:914
msgid "Search Computer"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:924
msgid "Find Software"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:931
msgid "Find Tutorials"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:938
msgid "Find Hardware"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:945
msgid "Find Ideas"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:952
msgid "Find Users"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:1425
msgid "" msgid ""
"Couldn't save favorites. Check if you have write access to ~/.linuxmint/" "Couldn't save favorites. Check if you have write access to ~/.linuxmint/"
"mintMenu" "mintMenu"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:1408 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:1608
msgid "All" msgid "All"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:1408 #: usr/lib/linuxmint/mintMenu/plugins/applications.py:1608
msgid "Show all applications" msgid "Show all applications"
msgstr "" msgstr ""
@ -457,27 +495,27 @@ msgstr ""
msgid "Shutdown, restart, suspend or hibernate" msgid "Shutdown, restart, suspend or hibernate"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/places.py:148 #: usr/lib/linuxmint/mintMenu/plugins/places.py:149
msgid "" msgid ""
"Browse all local and remote disks and folders accessible from this computer" "Browse all local and remote disks and folders accessible from this computer"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/places.py:155 #: usr/lib/linuxmint/mintMenu/plugins/places.py:156
msgid "Open your personal folder" msgid "Open your personal folder"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/places.py:162 #: usr/lib/linuxmint/mintMenu/plugins/places.py:163
msgid "Browse bookmarked and local network locations" msgid "Browse bookmarked and local network locations"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/places.py:182 #: usr/lib/linuxmint/mintMenu/plugins/places.py:183
msgid "Browse items placed on the desktop" msgid "Browse items placed on the desktop"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/places.py:191 #: usr/lib/linuxmint/mintMenu/plugins/places.py:192
msgid "Browse deleted files" msgid "Browse deleted files"
msgstr "" msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/places.py:204 #: usr/lib/linuxmint/mintMenu/plugins/places.py:207
msgid "Empty trash" msgid "Empty trash"
msgstr "" msgstr ""

View File

@ -318,10 +318,12 @@
<child> <child>
<widget class="GtkButton" id="searchButton"> <widget class="GtkButton" id="searchButton">
<property name="width_request">28</property> <property name="width_request">28</property>
<property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="has_default">True</property> <property name="has_default">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="relief">none</property>
<property name="focus_on_click">False</property> <property name="focus_on_click">False</property>
<signal name="clicked" handler="on_button17_clicked"/> <signal name="clicked" handler="on_button17_clicked"/>
<child> <child>

View File

@ -164,11 +164,7 @@ class Menu:
class SuggestionButton ( gtk.Button ): class SuggestionButton ( gtk.Button ):
def __init__( self, iconName, iconSize, label ): def __init__( self, iconName, iconSize, label ):
gtk.Button.__init__( self ) gtk.Button.__init__( self )
iconSize = self.get_icon_size(iconSize) iconSize = self.get_icon_size(iconSize)
self.iconName = iconName self.iconName = iconName
self.set_relief( gtk.RELIEF_NONE ) self.set_relief( gtk.RELIEF_NONE )
@ -193,10 +189,8 @@ class SuggestionButton ( gtk.Button ):
self.add( Align1 ) self.add( Align1 )
self.show() self.show()
def set_image(self, path):
self.image.set_from_file(path)
def get_icon_size (self, iconSize): def get_icon_size (self, iconSize):
if isinstance(iconSize, int): if isinstance(iconSize, int):
@ -249,7 +243,7 @@ class pluginclass( object ):
self.applicationsScrolledWindow = self.wTree.get_widget( "applicationsScrolledWindow" ) self.applicationsScrolledWindow = self.wTree.get_widget( "applicationsScrolledWindow" )
#i18n #i18n
self.wTree.get_widget("searchLabel").set_text("<span weight='bold'>" + _("Filter:") + "</span>") self.wTree.get_widget("searchLabel").set_text("<span weight='bold'>" + _("Search:") + "</span>")
self.wTree.get_widget("searchLabel").set_use_markup(True) self.wTree.get_widget("searchLabel").set_use_markup(True)
self.wTree.get_widget("label6").set_text("<span weight='bold'>" + _("Favorites") + "</span>") self.wTree.get_widget("label6").set_text("<span weight='bold'>" + _("Favorites") + "</span>")
self.wTree.get_widget("label6").set_use_markup(True) self.wTree.get_widget("label6").set_use_markup(True)
@ -284,7 +278,7 @@ class pluginclass( object ):
self.showFavoritesButton.connect( "drag_data_received", self.ReceiveCallback ) self.showFavoritesButton.connect( "drag_data_received", self.ReceiveCallback )
self.showFavoritesButton.drag_dest_set( gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, self.toButton, gtk.gdk.ACTION_COPY ) self.showFavoritesButton.drag_dest_set( gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, self.toButton, gtk.gdk.ACTION_COPY )
self.searchButton.connect( "button_release_event", self.SearchWithButton ) # self.searchButton.connect( "button_release_event", self.SearchWithButton )
self.gconfHandlers = [] self.gconfHandlers = []
# Gconf stuff # Gconf stuff
@ -350,6 +344,8 @@ class pluginclass( object ):
self.current_suggestion = None self.current_suggestion = None
self.get_panel() self.get_panel()
self.wTree.get_widget("searchButton").connect( "button-release-event", self.searchPopup )
def get_panel(self): def get_panel(self):
self.panel = None self.panel = None
self.panel_position = 0 self.panel_position = 0
@ -600,6 +596,53 @@ class pluginclass( object ):
gobject.source_remove( self.filterTimer ) gobject.source_remove( self.filterTimer )
self.filterTimer = None self.filterTimer = None
def add_search_suggestions(self, text):
text = "<b>%s</b>" % text
suggestionButton = SuggestionButton(gtk.STOCK_ADD, self.iconSize, "")
suggestionButton.connect("clicked", self.search_google)
suggestionButton.set_text(_("Search Google for %s") % text)
suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/google.ico")
self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton)
suggestionButton = SuggestionButton(gtk.STOCK_ADD, self.iconSize, "")
suggestionButton.connect("clicked", self.search_wikipedia)
suggestionButton.set_text(_("Search Wikipedia for %s") % text)
suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico")
self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton)
separator = gtk.EventBox()
separator.add(gtk.HSeparator())
separator.set_size_request(-1, 20)
separator.type = "separator"
separator.show_all()
self.applicationsBox.add(separator)
self.suggestions.append(separator)
suggestionButton = SuggestionButton(gtk.STOCK_ADD, self.iconSize, "")
suggestionButton.connect("clicked", self.search_dictionary)
suggestionButton.set_text(_("Lookup %s in Dictionary") % text)
suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/dictionary.png")
self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton)
suggestionButton = SuggestionButton(gtk.STOCK_FIND, self.iconSize, "")
suggestionButton.connect("clicked", self.Search)
suggestionButton.set_text(_("Search Computer for %s") % text)
self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton)
self.last_separator = gtk.EventBox()
self.last_separator.add(gtk.HSeparator())
self.last_separator.set_size_request(-1, 20)
self.last_separator.type = "separator"
self.last_separator.show_all()
self.applicationsBox.add(self.last_separator)
self.suggestions.append(self.last_separator)
def Filter( self, widget, category = None ): def Filter( self, widget, category = None ):
self.filterTimer = None self.filterTimer = None
@ -625,29 +668,41 @@ class pluginclass( object ):
if len(text) >= 3: if len(text) >= 3:
if self.current_suggestion is not None and self.current_suggestion in text: if self.current_suggestion is not None and self.current_suggestion in text:
# We're restricting our search... # We're restricting our search...
self.add_search_suggestions(text)
found_packages = 0
for pkg in self.current_results: for pkg in self.current_results:
if text in pkg.name: if text in pkg.name:
found_packages+=1
name = pkg.name.replace(text, "<b>%s</b>" % text); name = pkg.name.replace(text, "<b>%s</b>" % text);
suggestionButton = SuggestionButton(gtk.STOCK_ADD, self.iconSize, "") suggestionButton = SuggestionButton(gtk.STOCK_ADD, self.iconSize, "")
suggestionButton.connect("clicked", self.apturl_install, pkg.name) suggestionButton.connect("clicked", self.apturl_install, pkg.name)
suggestionButton.set_text(_("Install package '%s'") % name) suggestionButton.set_text(_("Install package '%s'") % name)
suggestionButton.set_tooltip_text(_("%s\n\n%s\n\n\n%s") % (pkg.name, pkg.summary.capitalize(), pkg.description)) suggestionButton.set_tooltip_text("%s\n\n%s\n\n\n%s" % (pkg.name, pkg.summary.capitalize(), pkg.description))
suggestionButton.set_icon_size(self.iconSize) suggestionButton.set_icon_size(self.iconSize)
self.applicationsBox.add(suggestionButton) self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton) self.suggestions.append(suggestionButton)
if found_packages == 0:
self.applicationsBox.remove(self.last_separator)
self.suggestions.remove(self.last_separator)
else: else:
self.current_results = [] self.current_results = []
self.add_search_suggestions(text)
found_packages = 0
for pkg in self.apt_cache: for pkg in self.apt_cache:
if text in pkg.name: if text in pkg.name:
found_packages+=1
name = pkg.name.replace(text, "<b>%s</b>" % text); name = pkg.name.replace(text, "<b>%s</b>" % text);
suggestionButton = SuggestionButton(gtk.STOCK_ADD, self.iconSize, "") suggestionButton = SuggestionButton(gtk.STOCK_ADD, self.iconSize, "")
suggestionButton.connect("clicked", self.apturl_install, pkg.name) suggestionButton.connect("clicked", self.apturl_install, pkg.name)
suggestionButton.set_text(_("Install package '%s'") % name) suggestionButton.set_text(_("Install package '%s'") % name)
suggestionButton.set_tooltip_text(_("%s\n\n%s\n\n%s") % (pkg.name, pkg.summary.capitalize(), pkg.description)) suggestionButton.set_tooltip_text("%s\n\n%s\n\n%s" % (pkg.name, pkg.summary.capitalize(), pkg.description))
suggestionButton.set_icon_size(self.iconSize) suggestionButton.set_icon_size(self.iconSize)
self.applicationsBox.add(suggestionButton) self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton) self.suggestions.append(suggestionButton)
self.current_results.append(pkg) self.current_results.append(pkg)
if found_packages == 0:
self.applicationsBox.remove(self.last_separator)
self.suggestions.remove(self.last_separator)
self.current_suggestion = text self.current_suggestion = text
else: else:
@ -829,6 +884,139 @@ class pluginclass( object ):
mTree.get_widget( "applicationsMenu" ).popup( None, None, None, event.button, event.time ) mTree.get_widget( "applicationsMenu" ).popup( None, None, None, event.button, event.time )
def searchPopup( self, widget=None, event=None ):
menu = gtk.Menu()
menuItem = gtk.ImageMenuItem(_("Search Google"))
img = gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/google.ico')
menuItem.set_image(img)
menuItem.connect("activate", self.search_google)
menu.append(menuItem)
menuItem = gtk.ImageMenuItem(_("Search Wikipedia"))
img = gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico')
menuItem.set_image(img)
menuItem.connect("activate", self.search_wikipedia)
menu.append(menuItem)
menuItem = gtk.SeparatorMenuItem()
menu.append(menuItem)
menuItem = gtk.ImageMenuItem(_("Lookup Dictionnary"))
img = gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/dictionary.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_dictionary)
menu.append(menuItem)
menuItem = gtk.ImageMenuItem(_("Search Computer"))
img = gtk.Image()
img.set_from_stock(gtk.STOCK_FIND, self.iconSize)
menuItem.set_image(img)
menuItem.connect("activate", self.Search)
menu.append(menuItem)
menuItem = gtk.SeparatorMenuItem()
menu.append(menuItem)
menuItem = gtk.ImageMenuItem(_("Find Software"))
img = gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/software.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_mint_software)
menu.append(menuItem)
menuItem = gtk.ImageMenuItem(_("Find Tutorials"))
img = gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/tutorials.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_mint_tutorials)
menu.append(menuItem)
menuItem = gtk.ImageMenuItem(_("Find Hardware"))
img = gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/hardware.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_mint_hardware)
menu.append(menuItem)
menuItem = gtk.ImageMenuItem(_("Find Ideas"))
img = gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/ideas.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_mint_ideas)
menu.append(menuItem)
menuItem = gtk.ImageMenuItem(_("Find Users"))
img = gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/users.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_mint_users)
menu.append(menuItem)
menu.show_all()
#menu.popup( None, None, self.pos_func, 3, 0)
menu.popup( None, None, None, 3, 0)
#menu.attach_to_widget(self.searchButton, None)
#menu.reposition()
#menu.reposition()
def pos_func(self, menu=None):
rect = self.searchButton.get_allocation()
x = rect.x + rect.width
y = rect.y + rect.height
return (x, y, False)
def search_google(self, widget):
text = self.searchEntry.get_text()
text = text.replace(" ", "+")
os.system("xdg-open \"http://www.google.com/cse?cx=002683415331144861350%3Atsq8didf9x0&ie=utf-8&sa=Search&q=" + text + "\" &")
self.mintMenuWin.hide()
def search_wikipedia(self, widget):
text = self.searchEntry.get_text()
text = text.replace(" ", "+")
os.system("xdg-open \"http://en.wikipedia.org/wiki/Special:Search?search=" + text + "\" &")
self.mintMenuWin.hide()
def search_dictionary(self, widget):
text = self.searchEntry.get_text()
os.system("gnome-dictionary \"" + text + "\" &")
self.mintMenuWin.hide()
def search_mint_tutorials(self, widget):
text = self.searchEntry.get_text()
text = text.replace(" ", "%20")
os.system("xdg-open \"http://community.linuxmint.com/index.php/tutorial/search/0/" + text + "\" &")
self.mintMenuWin.hide()
def search_mint_ideas(self, widget):
text = self.searchEntry.get_text()
text = text.replace(" ", "%20")
os.system("xdg-open \"http://community.linuxmint.com/index.php/idea/search/0/" + text + "\" &")
self.mintMenuWin.hide()
def search_mint_users(self, widget):
text = self.searchEntry.get_text()
text = text.replace(" ", "%20")
os.system("xdg-open \"http://community.linuxmint.com/index.php/user/search/0/" + text + "\" &")
self.mintMenuWin.hide()
def search_mint_hardware(self, widget):
text = self.searchEntry.get_text()
text = text.replace(" ", "%20")
os.system("xdg-open \"http://community.linuxmint.com/index.php/hardware/search/0/" + text + "\" &")
self.mintMenuWin.hide()
def search_mint_software(self, widget):
text = self.searchEntry.get_text()
text = text.replace(" ", "%20")
os.system("xdg-open \"http://community.linuxmint.com/index.php/software/search/0/" + text + "\" &")
self.mintMenuWin.hide()
def add_to_desktop(self, widget, desktopEntry): def add_to_desktop(self, widget, desktopEntry):
try: try:
# Determine where the Desktop folder is (could be localized) # Determine where the Desktop folder is (could be localized)
@ -986,7 +1174,6 @@ class pluginclass( object ):
def Search( self, widget ): def Search( self, widget ):
text = self.searchEntry.get_text().strip() text = self.searchEntry.get_text().strip()
if text != "": if text != "":
self.searchEntry.set_text( "" )
self.mintMenuWin.hide() self.mintMenuWin.hide()
fullstring = self.searchtool.replace( "%s", text ) fullstring = self.searchtool.replace( "%s", text )
newstring = fullstring.split() newstring = fullstring.split()

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B