Let the document editor handle the status of spell checking, and let it set all other classes from there
This commit is contained in:
@@ -314,17 +314,41 @@ class GuiDocEditor(QTextEdit):
|
||||
##
|
||||
|
||||
def setDictionaries(self):
|
||||
"""Set the spell checker dictionary language, and update the
|
||||
status bar to show the one actually loaded by the spell checker
|
||||
class.
|
||||
"""
|
||||
self.theDict.setLanguage(self.mainConf.spellLanguage, self.theProject.projDict)
|
||||
self.theParent.statusBar.setLanguage(self.theDict.spellLanguage)
|
||||
return True
|
||||
|
||||
def setSpellCheck(self, theMode):
|
||||
"""This is the master spell check setting function, and this one
|
||||
should call all other setSpellCheck functions in other classes.
|
||||
If the spell check mode is not defined, then toggle the current
|
||||
status saved in the class.
|
||||
"""
|
||||
|
||||
if theMode is None:
|
||||
theMode = not self.spellCheck
|
||||
|
||||
if self.theDict.spellLanguage is None:
|
||||
theMode = False
|
||||
|
||||
self.spellCheck = theMode
|
||||
self.theParent.mainMenu.setSpellCheck(theMode)
|
||||
self.theProject.setSpellCheck(theMode)
|
||||
self.hLight.setSpellCheck(theMode)
|
||||
self.hLight.rehighlight()
|
||||
|
||||
logger.verbose("Spell check is set to %s" % str(theMode))
|
||||
|
||||
return True
|
||||
|
||||
def updateSpellCheck(self):
|
||||
"""Rerun the highlighter to update spell checking status of the
|
||||
currently loaded text.
|
||||
"""
|
||||
if self.spellCheck:
|
||||
self.hLight.rehighlight()
|
||||
return True
|
||||
|
||||
+5
-6
@@ -91,6 +91,10 @@ class GuiMainMenu(QMenuBar):
|
||||
|
||||
return
|
||||
|
||||
def setSpellCheck(self, theMode):
|
||||
self.aSpellCheck.setChecked(theMode)
|
||||
return
|
||||
|
||||
def updateSpellCheck(self):
|
||||
if self.theParent.hasProject:
|
||||
self.aSpellCheck.setChecked(self.theProject.spellCheck)
|
||||
@@ -106,12 +110,7 @@ class GuiMainMenu(QMenuBar):
|
||||
return
|
||||
|
||||
def _toggleSpellCheck(self):
|
||||
if self.theParent.hasProject:
|
||||
self.theProject.setSpellCheck(self.aSpellCheck.isChecked())
|
||||
self.theParent.docEditor.setSpellCheck(self.aSpellCheck.isChecked())
|
||||
logger.verbose("Spell check is set to %s" % str(self.theProject.spellCheck))
|
||||
else:
|
||||
self.aSpellCheck.setChecked(False)
|
||||
self.theParent.docEditor.setSpellCheck(None)
|
||||
return True
|
||||
|
||||
def _toggleViewComments(self):
|
||||
|
||||
Reference in New Issue
Block a user