From 37d1ab68b4d747fd6b9668fe68c86c2171c50105 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 23 Aug 2010 05:58:32 +0100 Subject: [PATCH] Remove border and handle missing enchant --- openlp/core/ui/__init__.py | 15 ++++++++++----- openlp/core/ui/maindisplay.py | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index da2155559..ad356a7e0 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -31,7 +31,11 @@ The :mod:`ui` module provides the core user interface for OpenLP import re import sys -import enchant +try: + import enchant + enchant_available = True +except ImportError: + enchant_available = False from PyQt4 import QtCore, QtGui from openlp.core.lib import html_expands, translate, context_menu_action @@ -41,9 +45,10 @@ class SpellTextEdit(QtGui.QPlainTextEdit): def __init__(self, *args): QtGui.QPlainTextEdit.__init__(self, *args) # Default dictionary based on the current locale. - self.dict = enchant.Dict() - self.highlighter = Highlighter(self.document()) - self.highlighter.setDict(self.dict) + if enchant_available: + self.dict = enchant.Dict() + self.highlighter = Highlighter(self.document()) + self.highlighter.setDict(self.dict) def mousePressEvent(self, event): if event.button() == QtCore.Qt.RightButton: @@ -63,7 +68,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit): # Check if the selected word is misspelled and offer spelling # suggestions if it is. - if self.textCursor().hasSelection(): + if enchant_available and self.textCursor().hasSelection(): text = unicode(self.textCursor().selectedText()) if not self.dict.check(text): spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index bbb2e1c2b..2e9a4f205 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -55,6 +55,7 @@ class DisplayWidget(QtGui.QGraphicsView): QtCore.Qt.Key_Enter: 'slidecontroller_live_next_noloop', QtCore.Qt.Key_0: 'servicemanager_next_item', QtCore.Qt.Key_Backspace: 'slidecontroller_live_previous_noloop'} + self.setStyleSheet(u'border: none;') def keyPressEvent(self, event): # Key events only needed for live