Rename projLang to spellLang

This commit is contained in:
Veronica K. B. Olsen
2021-02-18 19:19:50 +01:00
parent a73eba8916
commit 8b0ac6e81e
3 changed files with 15 additions and 10 deletions
+11 -6
View File
@@ -79,7 +79,8 @@ class NWProject():
self.projCache = None # The full path to the project's cache folder self.projCache = None # The full path to the project's cache folder
self.projContent = None # The full path to the project's content folder self.projContent = None # The full path to the project's content folder
self.projDict = None # The spell check dictionary self.projDict = None # The spell check dictionary
self.projLang = None # The spell check language, if different than default self.projSpell = None # The spell check language, if different than default
self.projLang = None # The project language, if different than default
self.projFile = None # The file name of the project main XML file self.projFile = None # The file name of the project main XML file
# Project Meta # Project Meta
@@ -195,6 +196,7 @@ class NWProject():
self.projCache = None self.projCache = None
self.projContent = None self.projContent = None
self.projDict = None self.projDict = None
self.projSpell = None
self.projLang = None self.projLang = None
self.projFile = nwFiles.PROJ_FILE self.projFile = nwFiles.PROJ_FILE
self.projName = "" self.projName = ""
@@ -533,10 +535,12 @@ class NWProject():
continue continue
if xItem.tag == "doBackup": if xItem.tag == "doBackup":
self.doBackup = checkBool(xItem.text, False) self.doBackup = checkBool(xItem.text, False)
elif xItem.tag == "language":
self.projLang = checkString(xItem.text, None, True)
elif xItem.tag == "spellCheck": elif xItem.tag == "spellCheck":
self.spellCheck = checkBool(xItem.text, False) self.spellCheck = checkBool(xItem.text, False)
elif xItem.tag == "spellLang": elif xItem.tag == "spellLang":
self.projLang = checkString(xItem.text, None, True) self.projSpell = checkString(xItem.text, None, True)
elif xItem.tag == "autoOutline": elif xItem.tag == "autoOutline":
self.autoOutline = checkBool(xItem.text, True) self.autoOutline = checkBool(xItem.text, True)
elif xItem.tag == "lastEdited": elif xItem.tag == "lastEdited":
@@ -650,8 +654,9 @@ class NWProject():
# Save Project Settings # Save Project Settings
xSettings = etree.SubElement(nwXML, "settings") xSettings = etree.SubElement(nwXML, "settings")
self._packProjectValue(xSettings, "doBackup", self.doBackup) self._packProjectValue(xSettings, "doBackup", self.doBackup)
self._packProjectValue(xSettings, "language", self.projLang)
self._packProjectValue(xSettings, "spellCheck", self.spellCheck) self._packProjectValue(xSettings, "spellCheck", self.spellCheck)
self._packProjectValue(xSettings, "spellLang", self.projLang) self._packProjectValue(xSettings, "spellLang", self.projSpell)
self._packProjectValue(xSettings, "autoOutline", self.autoOutline) self._packProjectValue(xSettings, "autoOutline", self.autoOutline)
self._packProjectValue(xSettings, "lastEdited", self.lastEdited) self._packProjectValue(xSettings, "lastEdited", self.lastEdited)
self._packProjectValue(xSettings, "lastViewed", self.lastViewed) self._packProjectValue(xSettings, "lastViewed", self.lastViewed)
@@ -1012,9 +1017,9 @@ class NWProject():
"""Set the project-specific spell check language. """Set the project-specific spell check language.
""" """
theLang = checkString(theLang, None, True) theLang = checkString(theLang, None, True)
if self.projLang != theLang: if self.projSpell != theLang:
self.projLang = theLang self.projSpell = theLang
self.loadProjectLocalisation(theLang) # self.loadProjectLocalisation(theLang)
self.setProjectChanged(True) self.setProjectChanged(True)
return True return True
+2 -2
View File
@@ -599,10 +599,10 @@ class GuiDocEditor(QTextEdit):
status bar to show the one actually loaded by the spell checker status bar to show the one actually loaded by the spell checker
class. class.
""" """
if self.theProject.projLang is None: if self.theProject.projSpell is None:
theLang = self.mainConf.spellLanguage theLang = self.mainConf.spellLanguage
else: else:
theLang = self.theProject.projLang theLang = self.theProject.projSpell
self.theDict.setLanguage(theLang, self.theProject.projDict) self.theDict.setLanguage(theLang, self.theProject.projDict)
theTag, theProvider = self.theDict.describeDict() theTag, theProvider = self.theDict.describeDict()
+2 -2
View File
@@ -223,8 +223,8 @@ class GuiProjectEditMain(QWidget):
) )
spellIdx = 0 spellIdx = 0
if self.theProject.projLang is not None: if self.theProject.projSpell is not None:
spellIdx = self.spellLang.findData(self.theProject.projLang) spellIdx = self.spellLang.findData(self.theProject.projSpell)
if spellIdx != -1: if spellIdx != -1:
self.spellLang.setCurrentIndex(spellIdx) self.spellLang.setCurrentIndex(spellIdx)