Complete loading project xml via data class
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user