From def7567933517e4b9256a23e470521bee9d26020 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 7 Apr 2011 19:54:17 +0200 Subject: [PATCH] easier check --- openlp/core/lib/spelltextedit.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py index 2861a6932..95befad09 100644 --- a/openlp/core/lib/spelltextedit.py +++ b/openlp/core/lib/spelltextedit.py @@ -45,6 +45,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit): Spell checking widget based on QPlanTextEdit. """ def __init__(self, *args): + global ENCHANT_AVAILABLE QtGui.QPlainTextEdit.__init__(self, *args) # Default dictionary based on the current locale. if ENCHANT_AVAILABLE: @@ -53,6 +54,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit): self.highlighter = Highlighter(self.document()) self.highlighter.spellingDictionary = self.dictionary except DictNotFoundError: + ENCHANT_AVAILABLE = False log.debug(u'Could not load default dictionary') def mousePressEvent(self, event): @@ -80,8 +82,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit): self.setTextCursor(cursor) # Check if the selected word is misspelled and offer spelling # suggestions if it is. - if ENCHANT_AVAILABLE and hasattr(self, u'dictionary') and \ - self.textCursor().hasSelection(): + if ENCHANT_AVAILABLE and self.textCursor().hasSelection(): text = unicode(self.textCursor().selectedText()) if not self.dictionary.check(text): spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',