small fixes

This commit is contained in:
Wesley Stout 2011-04-13 17:10:07 -05:00
commit d8b1313e22
2 changed files with 9 additions and 5 deletions

View File

@ -23,7 +23,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging
import re import re
try: try:
import enchant import enchant
@ -38,20 +38,24 @@ except ImportError:
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, DisplayTags from openlp.core.lib import translate, DisplayTags
log = logging.getLogger(__name__)
class SpellTextEdit(QtGui.QPlainTextEdit): class SpellTextEdit(QtGui.QPlainTextEdit):
""" """
Spell checking widget based on QPlanTextEdit. Spell checking widget based on QPlanTextEdit.
""" """
def __init__(self, *args): def __init__(self, *args):
global ENCHANT_AVAILABLE
QtGui.QPlainTextEdit.__init__(self, *args) QtGui.QPlainTextEdit.__init__(self, *args)
# Default dictionary based on the current locale. # Default dictionary based on the current locale.
if ENCHANT_AVAILABLE: if ENCHANT_AVAILABLE:
try: try:
self.dictionary = enchant.Dict() self.dictionary = enchant.Dict()
self.highlighter = Highlighter(self.document())
self.highlighter.spellingDictionary = self.dictionary
except DictNotFoundError: except DictNotFoundError:
self.dictionary = enchant.Dict(u'en_US') ENCHANT_AVAILABLE = False
self.highlighter = Highlighter(self.document()) log.debug(u'Could not load default dictionary')
self.highlighter.spellingDictionary = self.dictionary
def mousePressEvent(self, event): def mousePressEvent(self, event):
""" """

View File

@ -105,7 +105,7 @@ class PresentationDocument(object):
Loads the presentation and starts it Loads the presentation and starts it
``presentation`` ``presentation``
The file name of the presentations to the run. The file name of the presentations to the run.
Returns False if the file could not be opened Returns False if the file could not be opened
""" """