Web search right-click for note editor
svn: r15820
This commit is contained in:
parent
5b975f93cc
commit
3c151885ee
@ -148,6 +148,7 @@ register('behavior.startup', 0)
|
|||||||
register('behavior.surname-guessing', 0)
|
register('behavior.surname-guessing', 0)
|
||||||
register('behavior.use-tips', False)
|
register('behavior.use-tips', False)
|
||||||
register('behavior.welcome', 100)
|
register('behavior.welcome', 100)
|
||||||
|
register('behavior.web-search-url', 'http://google.com/#&q=%(text)s')
|
||||||
|
|
||||||
register('export.proxy-order', [
|
register('export.proxy-order', [
|
||||||
["privacy", 0],
|
["privacy", 0],
|
||||||
|
@ -58,6 +58,7 @@ from gui.widgets.toolcomboentry import ToolComboEntry
|
|||||||
from gui.widgets.springseparator import SpringSeparatorAction
|
from gui.widgets.springseparator import SpringSeparatorAction
|
||||||
from Spell import Spell
|
from Spell import Spell
|
||||||
from GrampsDisplay import url as display_url
|
from GrampsDisplay import url as display_url
|
||||||
|
import config
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -365,6 +366,11 @@ class StyledTextEditor(gtk.TextView):
|
|||||||
spell_menu.show_all()
|
spell_menu.show_all()
|
||||||
menu.prepend(spell_menu)
|
menu.prepend(spell_menu)
|
||||||
|
|
||||||
|
search_menu = gtk.MenuItem(_("Search selection on web"))
|
||||||
|
search_menu.connect('activate', self.search_web)
|
||||||
|
search_menu.show_all()
|
||||||
|
menu.append(search_menu)
|
||||||
|
|
||||||
# url menu items
|
# url menu items
|
||||||
if self.url_match:
|
if self.url_match:
|
||||||
flavor = self.url_match[MATCH_FLAVOR]
|
flavor = self.url_match[MATCH_FLAVOR]
|
||||||
@ -387,12 +393,24 @@ class StyledTextEditor(gtk.TextView):
|
|||||||
|
|
||||||
copy_menu.connect('activate', self._copy_url_cb, url, flavor)
|
copy_menu.connect('activate', self._copy_url_cb, url, flavor)
|
||||||
copy_menu.show()
|
copy_menu.show()
|
||||||
|
|
||||||
menu.prepend(copy_menu)
|
menu.prepend(copy_menu)
|
||||||
|
|
||||||
open_menu.connect('activate', self._open_url_cb, url, flavor)
|
open_menu.connect('activate', self._open_url_cb, url, flavor)
|
||||||
open_menu.show()
|
open_menu.show()
|
||||||
menu.prepend(open_menu)
|
menu.prepend(open_menu)
|
||||||
|
|
||||||
|
def search_web(self, widget):
|
||||||
|
"""
|
||||||
|
Search the web for selected text.
|
||||||
|
"""
|
||||||
|
selection = self.textbuffer.get_selection_bounds()
|
||||||
|
if len(selection) > 0:
|
||||||
|
display_url(config.get("behavior.web-search-url") %
|
||||||
|
{'text':
|
||||||
|
self.textbuffer.get_text(selection[0],
|
||||||
|
selection[1])})
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
"""
|
"""
|
||||||
Reset the undoable buffer
|
Reset the undoable buffer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user