From 8b0ac6e81e25742e2558376575dbc32b7ca775cf Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 18 Feb 2021 19:19:50 +0100 Subject: [PATCH] Rename projLang to spellLang --- nw/core/project.py | 17 +++++++++++------ nw/gui/doceditor.py | 4 ++-- nw/gui/projsettings.py | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/nw/core/project.py b/nw/core/project.py index 4019fcbc..cc4914b9 100644 --- a/nw/core/project.py +++ b/nw/core/project.py @@ -79,7 +79,8 @@ class NWProject(): 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.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 # Project Meta @@ -195,6 +196,7 @@ class NWProject(): self.projCache = None self.projContent = None self.projDict = None + self.projSpell = None self.projLang = None self.projFile = nwFiles.PROJ_FILE self.projName = "" @@ -533,10 +535,12 @@ class NWProject(): continue if xItem.tag == "doBackup": self.doBackup = checkBool(xItem.text, False) + elif xItem.tag == "language": + self.projLang = checkString(xItem.text, None, True) elif xItem.tag == "spellCheck": self.spellCheck = checkBool(xItem.text, False) elif xItem.tag == "spellLang": - self.projLang = checkString(xItem.text, None, True) + self.projSpell = checkString(xItem.text, None, True) elif xItem.tag == "autoOutline": self.autoOutline = checkBool(xItem.text, True) elif xItem.tag == "lastEdited": @@ -650,8 +654,9 @@ class NWProject(): # Save Project Settings xSettings = etree.SubElement(nwXML, "settings") self._packProjectValue(xSettings, "doBackup", self.doBackup) + self._packProjectValue(xSettings, "language", self.projLang) 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, "lastEdited", self.lastEdited) self._packProjectValue(xSettings, "lastViewed", self.lastViewed) @@ -1012,9 +1017,9 @@ class NWProject(): """Set the project-specific spell check language. """ theLang = checkString(theLang, None, True) - if self.projLang != theLang: - self.projLang = theLang - self.loadProjectLocalisation(theLang) + if self.projSpell != theLang: + self.projSpell = theLang + # self.loadProjectLocalisation(theLang) self.setProjectChanged(True) return True diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 7dc80520..9f4949a4 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -599,10 +599,10 @@ class GuiDocEditor(QTextEdit): status bar to show the one actually loaded by the spell checker class. """ - if self.theProject.projLang is None: + if self.theProject.projSpell is None: theLang = self.mainConf.spellLanguage else: - theLang = self.theProject.projLang + theLang = self.theProject.projSpell self.theDict.setLanguage(theLang, self.theProject.projDict) theTag, theProvider = self.theDict.describeDict() diff --git a/nw/gui/projsettings.py b/nw/gui/projsettings.py index c09cbfdb..eeee08e4 100644 --- a/nw/gui/projsettings.py +++ b/nw/gui/projsettings.py @@ -223,8 +223,8 @@ class GuiProjectEditMain(QWidget): ) spellIdx = 0 - if self.theProject.projLang is not None: - spellIdx = self.spellLang.findData(self.theProject.projLang) + if self.theProject.projSpell is not None: + spellIdx = self.spellLang.findData(self.theProject.projSpell) if spellIdx != -1: self.spellLang.setCurrentIndex(spellIdx)