Please review this at http://codereview.appspot.com/186066
Affected files:
M tryton/gui/main.py
M tryton/gui/window/view_form/view/form_gtk/textbox.py
Index: tryton/gui/main.py
===================================================================
--- a/tryton/gui/main.py
+++ b/tryton/gui/main.py
@@ -32,6 +32,10 @@
import igemacintegration
except ImportError:
igemacintegration = None
+try:
+ import gtkspell
+except:
+ gtkspell = None
_ = gettext.gettext
@@ -678,15 +682,16 @@
if CONFIG['client.save_width_height']:
checkmenuitem_save_width_height.set_active(True)
- checkmenuitem_spellcheck = gtk.CheckMenuItem(_('Spell Checking'))
- checkmenuitem_spellcheck.connect('activate',
- lambda menuitem: CONFIG.__setitem__('client.spellcheck',
- menuitem.get_active()))
- checkmenuitem_spellcheck.set_accel_path(
- '<tryton>/Options/Form/Spell Checking')
- menu_form.add(checkmenuitem_spellcheck)
- if CONFIG['client.spellcheck']:
- checkmenuitem_spellcheck.set_active(True)
+ if gtkspell:
+ checkmenuitem_spellcheck = gtk.CheckMenuItem(_('Spell
Checking'))
+ checkmenuitem_spellcheck.connect('activate',
+ lambda menuitem:
CONFIG.__setitem__('client.spellcheck',
+ menuitem.get_active()))
+ checkmenuitem_spellcheck.set_accel_path(
+ '<tryton>/Options/Form/Spell Checking')
+ menu_form.add(checkmenuitem_spellcheck)
+ if CONFIG['client.spellcheck']:
+ checkmenuitem_spellcheck.set_active(True)
menuitem_tab = gtk.MenuItem(_('Tabs Position'))
menu_form.add(menuitem_tab)
Index: tryton/gui/window/view_form/view/form_gtk/textbox.py
===================================================================
--- a/tryton/gui/window/view_form/view/form_gtk/textbox.py
+++ b/tryton/gui/window/view_form/view/form_gtk/textbox.py
@@ -5,11 +5,10 @@
import tryton.rpc as rpc
from tryton.config import CONFIG
-HAS_GTKSPELL = True
try:
import gtkspell
except:
- HAS_GTKSPELL = False
+ gtkspell = None
class TextBox(WidgetInterface):
@@ -47,7 +46,7 @@
self.widget.set_focus_chain([])
else:
self.widget.set_focus_chain([self.textview])
- if HAS_GTKSPELL:
+ if gtkspell:
spell = None
try:
spell = gtkspell.get_from_text_view(self.textview)
@@ -94,7 +93,7 @@
iter_start = buf.get_start_iter()
buf.insert(iter_start, value)
- if HAS_GTKSPELL:
+ if gtkspell:
spell = None
try:
spell = gtkspell.get_from_text_view(self.textview)
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email: [email protected]
Jabber: [email protected]
Website: http://www.b2ck.com/
twitter: http://twitter.com/cedrickrier
identi.ca: http://identi.ca/cedrickrier
pgpB7yNxjRztU.pgp
Description: PGP signature
