Added some more comments and debug output
This commit is contained in:
@@ -530,9 +530,12 @@ class GuiDocEditor(QTextEdit):
|
|||||||
|
|
||||||
theCursor = self.cursorForPosition(thePos)
|
theCursor = self.cursorForPosition(thePos)
|
||||||
theCursor.select(QTextCursor.WordUnderCursor)
|
theCursor.select(QTextCursor.WordUnderCursor)
|
||||||
|
|
||||||
theWord = theCursor.selectedText().strip().strip(self.nonWord)
|
theWord = theCursor.selectedText().strip().strip(self.nonWord)
|
||||||
if theWord == "":
|
if theWord == "":
|
||||||
return
|
return
|
||||||
|
|
||||||
|
logger.verbose("Looking up '%s' in the dictionary" % theWord)
|
||||||
if self.theDict.checkWord(theWord):
|
if self.theDict.checkWord(theWord):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -201,12 +201,14 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
# Build a QRegExp for each pattern and for the spell checker
|
# Build a QRegExp for each highlight pattern
|
||||||
self.rxRules = []
|
self.rxRules = []
|
||||||
for regEx, regRules in self.hRules:
|
for regEx, regRules in self.hRules:
|
||||||
hReg = QRegularExpression(regEx)
|
hReg = QRegularExpression(regEx)
|
||||||
hReg.setPatternOptions(QRegularExpression.UseUnicodePropertiesOption)
|
hReg.setPatternOptions(QRegularExpression.UseUnicodePropertiesOption)
|
||||||
self.rxRules.append((hReg, regRules))
|
self.rxRules.append((hReg, regRules))
|
||||||
|
|
||||||
|
# Build a QRegExp for spell checker
|
||||||
self.spellRx = QRegularExpression(r"\b[^\s]+\b")
|
self.spellRx = QRegularExpression(r"\b[^\s]+\b")
|
||||||
self.spellRx.setPatternOptions(QRegularExpression.UseUnicodePropertiesOption)
|
self.spellRx.setPatternOptions(QRegularExpression.UseUnicodePropertiesOption)
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
import logging
|
import logging
|
||||||
import nw
|
import nw
|
||||||
|
|
||||||
|
from os import path
|
||||||
|
|
||||||
from nw.constants import isoLanguage
|
from nw.constants import isoLanguage
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -75,6 +77,8 @@ class NWSpellCheck():
|
|||||||
self.PROJW = []
|
self.PROJW = []
|
||||||
if projectDict is not None:
|
if projectDict is not None:
|
||||||
self.projectDict = projectDict
|
self.projectDict = projectDict
|
||||||
|
if not path.isfile(projectDict):
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
with open(projectDict,mode="r",encoding="utf-8") as wordsFile:
|
with open(projectDict,mode="r",encoding="utf-8") as wordsFile:
|
||||||
for theLine in wordsFile:
|
for theLine in wordsFile:
|
||||||
|
|||||||
Reference in New Issue
Block a user