# HG changeset patch # User Simon Heimberg <sim...@besonet.ch> # Date 1250507083 -7200 # Node ID c83dd355585fece19c52cbf454ee24fb14d59565 # Parent 28804ddf9ded1864cd5299a3c9fc341d24c96f97 gtklib: add entry to context menu for selecting spell check language
The language is selected in a dialog. No list of installed languages is available. diff -r 28804ddf9ded -r c83dd355585f hggtk/gtklib.py --- a/hggtk/gtklib.py Mon Aug 17 12:51:24 2009 +0200 +++ b/hggtk/gtklib.py Mon Aug 17 13:04:43 2009 +0200 @@ -325,3 +325,42 @@ gtkspell.Spell(textview) except ImportError: pass + else: + def selectlang(senderitem): + from hggtk import dialog + spell = gtkspell.get_from_text_view(textview) + lang = '' + while True: + msg = _('Select language for spell checking.\n\n' + 'Empty is for the default language.\n' + 'When all text is highlited, the dictionary\n' + 'is probably not installed.\n\n' + 'examples: en, en_GB, en_US') + if lang: + msg = _('Lang "%s" can not be set.\n') % lang + msg + lang = dialog.entry_dialog(None, msg) + if lang is None: # cancel + return + lang = lang.strip() + if not lang: + lang = None # set default language from $LANG + try: + spell.set_language(lang) + return + except Exception, e: + pass + def langmenu(textview, menu): + item = gtk.MenuItem(_('Spell Check Language')) + item.connect('activate', selectlang) + menuitems = menu.get_children()[:2] + x = menuitems[0].get_submenu() + if len(menuitems) >= 2 and menuitems[1].get_child() is None and menuitems[0].get_submenu(): + # the spellcheck language menu seems to be at the top + menu.insert(item, 1) + else: + sep = gtk.SeparatorMenuItem() + sep.show() + menu.append(sep) + menu.append(item) + item.show() + textview.connect('populate-popup', langmenu) ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Tortoisehg-develop mailing list Tortoisehg-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop