Save both status and importance flags (#1030)

* Put the status icons in the status object itself
* Allow saving both status and importance values
* Update current tests
* Improve test coverage
* Update sample project file
This commit is contained in:
Veronica Berglyd Olsen
2022-04-03 22:43:11 +02:00
committed by GitHub
parent a04b44d890
commit 23fd6b815f
29 changed files with 481 additions and 418 deletions
+1
View File
@@ -133,6 +133,7 @@ class GuiDocMerge(QDialog):
nHandle = self.theProject.newFile(srcItem.itemName, srcItem.itemClass, srcItem.itemParent)
newItem = self.theProject.projTree[nHandle]
newItem.setStatus(srcItem.itemStatus)
newItem.setImport(srcItem.itemImport)
outDoc = NWDoc(self.theProject, nHandle)
if not outDoc.writeDocument(theText):
+1
View File
@@ -203,6 +203,7 @@ class GuiDocSplit(QDialog):
newItem = self.theProject.projTree[nHandle]
newItem.setLayout(itemLayout)
newItem.setStatus(srcItem.itemStatus)
newItem.setImport(srcItem.itemImport)
logger.verbose(
"Creating new document '%s' with text from line %d to %d",
nHandle, iStart+1, iEnd
+7 -10
View File
@@ -75,15 +75,11 @@ class GuiItemEditor(QDialog):
self.editStatus = QComboBox()
self.editStatus.setMinimumWidth(mVd)
if self.theItem.itemClass in nwLists.CLS_NOVEL:
for sLabel, _, _ in self.theProject.statusItems:
self.editStatus.addItem(
self.theParent.statusIcons[sLabel], sLabel, sLabel
)
for sLabel, _, _, sIcon in self.theProject.statusItems:
self.editStatus.addItem(sIcon, sLabel, sLabel)
else:
for sLabel, _, _ in self.theProject.importItems:
self.editStatus.addItem(
self.theParent.importIcons[sLabel], sLabel, sLabel
)
for sLabel, _, _, sIcon in self.theProject.importItems:
self.editStatus.addItem(sIcon, sLabel, sLabel)
# Item Layout
self.editLayout = QComboBox()
@@ -120,7 +116,8 @@ class GuiItemEditor(QDialog):
self.editName.setText(self.theItem.itemName)
self.editName.selectAll()
statusIdx = self.editStatus.findData(self.theItem.itemStatus)
currStatus, _ = self.theItem.getImportStatus()
statusIdx = self.editStatus.findData(currStatus)
if statusIdx != -1:
self.editStatus.setCurrentIndex(statusIdx)
@@ -180,7 +177,7 @@ class GuiItemEditor(QDialog):
isExported = self.editExport.isChecked()
self.theItem.setName(itemName)
self.theItem.setStatus(itemStatus)
self.theItem.setImportStatus(itemStatus)
self.theItem.setLayout(itemLayout)
self.theItem.setExported(isExported)
+1 -1
View File
@@ -285,7 +285,7 @@ class GuiProjectEditStatus(QWidget):
self.listBox.setColumnWidth(self.COL_LABEL, wCol0)
self.listBox.setIndentation(0)
for iName, iCol, nUse in self.theStatus:
for iName, iCol, nUse, _ in self.theStatus:
self._addItem(iName, iCol, iName, nUse)
# List Controls