forked from openlp/openlp
Remove border and handle missing enchant
This commit is contained in:
parent
a4e58c3349
commit
37d1ab68b4
@ -31,7 +31,11 @@ The :mod:`ui` module provides the core user interface for OpenLP
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
try:
|
||||||
import enchant
|
import enchant
|
||||||
|
enchant_available = True
|
||||||
|
except ImportError:
|
||||||
|
enchant_available = False
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.lib import html_expands, translate, context_menu_action
|
from openlp.core.lib import html_expands, translate, context_menu_action
|
||||||
@ -41,6 +45,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
|
|||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
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:
|
||||||
self.dict = enchant.Dict()
|
self.dict = enchant.Dict()
|
||||||
self.highlighter = Highlighter(self.document())
|
self.highlighter = Highlighter(self.document())
|
||||||
self.highlighter.setDict(self.dict)
|
self.highlighter.setDict(self.dict)
|
||||||
@ -63,7 +68,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
|
|||||||
|
|
||||||
# Check if the selected word is misspelled and offer spelling
|
# Check if the selected word is misspelled and offer spelling
|
||||||
# suggestions if it is.
|
# suggestions if it is.
|
||||||
if self.textCursor().hasSelection():
|
if enchant_available and self.textCursor().hasSelection():
|
||||||
text = unicode(self.textCursor().selectedText())
|
text = unicode(self.textCursor().selectedText())
|
||||||
if not self.dict.check(text):
|
if not self.dict.check(text):
|
||||||
spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',
|
spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',
|
||||||
|
@ -55,6 +55,7 @@ class DisplayWidget(QtGui.QGraphicsView):
|
|||||||
QtCore.Qt.Key_Enter: 'slidecontroller_live_next_noloop',
|
QtCore.Qt.Key_Enter: 'slidecontroller_live_next_noloop',
|
||||||
QtCore.Qt.Key_0: 'servicemanager_next_item',
|
QtCore.Qt.Key_0: 'servicemanager_next_item',
|
||||||
QtCore.Qt.Key_Backspace: 'slidecontroller_live_previous_noloop'}
|
QtCore.Qt.Key_Backspace: 'slidecontroller_live_previous_noloop'}
|
||||||
|
self.setStyleSheet(u'border: none;')
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
# Key events only needed for live
|
# Key events only needed for live
|
||||||
|
Loading…
Reference in New Issue
Block a user