From 78351349a300f4bab73e5ca0067be8639973675b Mon Sep 17 00:00:00 2001 From: Gergely Imreh Date: Wed, 20 May 2009 23:12:42 +0800 Subject: [PATCH] ui_pygtk: initial spell checking support for the update box --- mitterlib/ui/ui_pygtk.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mitterlib/ui/ui_pygtk.py b/mitterlib/ui/ui_pygtk.py index 949a25d..2f0fce3 100644 --- a/mitterlib/ui/ui_pygtk.py +++ b/mitterlib/ui/ui_pygtk.py @@ -484,6 +484,23 @@ class Interface(object): update_area = gtk.VBox(True, 0) update_area.pack_start(update_box) + """ Spell checking the update box """ + spell_check_enabled = self._options[self.NAMESPACE]['spell_check'] + if spell_check_enabled: + try: + import gtkspell + import locale + self.spell_check_support = True + language = locale.getlocale()[0] + self.spell_check = gtkspell.Spell(self._update_text, language) + _log.debug('Spell checking turned on with language: %s' \ + % (language)) + except: + self._options[self.NAMESPACE]['spell_check'] = False + self.spell_check_support = False + _log.debug('Error initializing spell checking: ' \ + 'spell checking disabled') + return update_area def _create_statusbar(self): @@ -885,3 +902,12 @@ class Interface(object): default='blue', conflict_group='interface', is_cmd_option=False) + options.add_option( + group=self.NAMESPACE, + option='spell_check', + help='Spell checking update text', + type='boolean', + metavar='SPELL', + default=False, + conflict_group='interface', + is_cmd_option=False)