Also make tree and options properties of the project

This commit is contained in:
Veronica Berglyd Olsen
2022-05-28 14:33:25 +02:00
parent 8bdd09400a
commit 44926a4e9a
28 changed files with 324 additions and 315 deletions
+6 -7
View File
@@ -50,7 +50,6 @@ class GuiDocSplit(QDialog):
self.mainConf = novelwriter.CONFIG
self.theParent = theParent
self.theProject = theParent.theProject
self.optState = theParent.theProject.optState
self.sourceItem = None
self.sourceText = []
@@ -75,7 +74,7 @@ class GuiDocSplit(QDialog):
self.splitLevel.addItem(self.tr("Split up to Header Level 3 (Scene)"), 3)
self.splitLevel.addItem(self.tr("Split up to Header Level 4 (Section)"), 4)
spIndex = self.splitLevel.findData(
self.optState.getInt("GuiDocSplit", "spLevel", 3)
self.theProject.options.getInt("GuiDocSplit", "spLevel", 3)
)
if spIndex != -1:
self.splitLevel.setCurrentIndex(spIndex)
@@ -121,7 +120,7 @@ class GuiDocSplit(QDialog):
), nwAlert.ERROR)
return False
srcItem = self.theProject.projTree[self.sourceItem]
srcItem = self.theProject.tree[self.sourceItem]
if srcItem is None:
self.theParent.makeAlert(self.tr(
"Could not parse source document."
@@ -184,7 +183,7 @@ class GuiDocSplit(QDialog):
wTitle = wTitle.lstrip("#").strip()
nHandle = self.theProject.newFile(wTitle, fHandle)
newItem = self.theProject.projTree[nHandle]
newItem = self.theProject.tree[nHandle]
newItem.setStatus(srcItem.itemStatus)
newItem.setImport(srcItem.itemImport)
logger.verbose(
@@ -211,7 +210,7 @@ class GuiDocSplit(QDialog):
def _doClose(self):
"""Close the dialog window without doing anything.
"""
self.optState.saveSettings()
self.theProject.options.saveSettings()
self.close()
return
@@ -232,7 +231,7 @@ class GuiDocSplit(QDialog):
if self.sourceItem is None:
return False
nwItem = self.theProject.projTree[self.sourceItem]
nwItem = self.theProject.tree[self.sourceItem]
if nwItem is None:
return False
@@ -249,7 +248,7 @@ class GuiDocSplit(QDialog):
return False
spLevel = self.splitLevel.currentData()
self.optState.setValue("GuiDocSplit", "spLevel", spLevel)
self.theProject.options.setValue("GuiDocSplit", "spLevel", spLevel)
logger.debug(
"Scanning document '%s' for headings level <= %d",
self.sourceItem, spLevel