Complete loading project xml via data class

This commit is contained in:
Veronica Berglyd Olsen
2022-10-31 18:11:46 +01:00
parent 522acc479b
commit 3a161e90f9
14 changed files with 129 additions and 161 deletions
+37
View File
@@ -54,6 +54,15 @@ class NWProjectData:
self._lastCount = {}
self._currCount = {}
self._autoReplace = {}
self._titleFormat = {
"title": "%title%",
"chapter": "%title%",
"unnumbered": "%title%",
"scene": "* * *",
"section": "",
}
self._status = NWStatus(NWStatus.STATUS)
self._import = NWStatus(NWStatus.IMPORT)
@@ -106,6 +115,14 @@ class NWProjectData:
def spellLang(self):
return self._spellLang
@property
def autoReplace(self):
return self._autoReplace
@property
def titleFormat(self):
return self._titleFormat
@property
def itemStatus(self):
return self._status
@@ -153,6 +170,9 @@ class NWProjectData:
def getCurrCount(self, type):
return self._currCount.get(type, 0)
def getTitleFormat(self, kind):
return self._titleFormat.get(kind, "%title%")
##
# Setters
##
@@ -231,4 +251,21 @@ class NWProjectData:
self._changed = True
return
def setAutoReplace(self, value):
if isinstance(value, dict):
self._autoReplace = {}
for key, entry in value.items():
if isinstance(entry, str):
self._autoReplace[key] = simplified(entry)
self._changed = True
return
def setTitleFormat(self, value):
if isinstance(value, dict):
for key, entry in value.items():
if key in self._titleFormat and isinstance(entry, str):
self._titleFormat[key] = simplified(entry)
self._changed = True
return
# END Class NWProjectData