Also saving options for DocSplit dialog

This commit is contained in:
Veronica K. B. Olsen
2020-02-19 20:08:27 +01:00
parent b90f96643e
commit 10dcbe6ee5
4 changed files with 8 additions and 4 deletions
+8 -1
View File
@@ -33,6 +33,7 @@ class GuiDocSplit(QDialog):
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theProject = theProject
self.optState = self.theProject.optState
self.sourceItem = None
self.outerBox = QHBoxLayout()
@@ -56,7 +57,11 @@ class GuiDocSplit(QDialog):
self.splitLevel.addItem("Split up to Header Level 2 (Chapter)", 2)
self.splitLevel.addItem("Split up to Header Level 3 (Scene)", 3)
self.splitLevel.addItem("Split up to Header Level 4 (Section)", 4)
self.splitLevel.setCurrentIndex(2)
spIndex = self.splitLevel.findData(
self.optState.getInt("GuiDocSplit", "spLevel", 3)
)
if spIndex != -1:
self.splitLevel.setCurrentIndex(spIndex)
self.splitLevel.currentIndexChanged.connect(self._populateList)
self.splitButton = QPushButton("Split")
@@ -172,6 +177,7 @@ class GuiDocSplit(QDialog):
"""Close the dialog window without doing anything.
"""
logger.verbose("GuiDocSplit close button clicked")
self.optState.saveSettings()
self.close()
return
@@ -206,6 +212,7 @@ class GuiDocSplit(QDialog):
theText = theDoc.openDocument(self.sourceItem, False)
spLevel = self.splitLevel.currentData()
self.optState.setValue("GuiDocSplit", "spLevel", spLevel)
logger.debug("Scanning document %s for headings level <= %d" % (self.sourceItem, spLevel))
lineNo = 0
-1
View File
@@ -24,7 +24,6 @@ from PyQt5.QtWidgets import (
)
from nw.convert import TextFile, HtmlFile, MarkdownFile, LaTeXFile, ConcatFile
from nw.tools import OptionState
from nw.common import packageRefURL
from nw.constants import nwFiles, nwItemType, nwAlert
-1
View File
@@ -24,7 +24,6 @@ from PyQt5.QtWidgets import (
)
from nw.constants import nwConst, nwFiles, nwAlert
from nw.tools import OptionState
logger = logging.getLogger(__name__)
-1
View File
@@ -22,7 +22,6 @@ from PyQt5.QtWidgets import (
)
from nw.constants import nwFiles, nwItemClass
from nw.tools import OptionState
logger = logging.getLogger(__name__)