diff --git a/nw/project/project.py b/nw/project/project.py index aece184c..c8d04db6 100644 --- a/nw/project/project.py +++ b/nw/project/project.py @@ -80,6 +80,7 @@ class NWProject(): newItem.setName(rootName) newItem.setType(nwItemType.ROOT) newItem.setClass(rootClass) + newItem.setStatus(0) self._appendItem(None,None,newItem) return newItem.itemHandle @@ -88,6 +89,7 @@ class NWProject(): newItem.setName(folderName) newItem.setType(nwItemType.FOLDER) newItem.setClass(folderClass) + newItem.setStatus(0) self._appendItem(None,pHandle,newItem) return newItem.itemHandle @@ -100,6 +102,7 @@ class NWProject(): else: newItem.setLayout(nwItemLayout.NOTE) newItem.setClass(fileClass) + newItem.setStatus(0) self._appendItem(None,pHandle,newItem) return newItem.itemHandle @@ -151,7 +154,7 @@ class NWProject(): self.statusItems.addEntry("Draft", (200,150, 0)) self.statusItems.addEntry("Finished",( 50,200, 0)) self.importItems = NWStatus() - self.importItems.addEntry("None", (100,100,100)) + self.importItems.addEntry("New", (100,100,100)) self.importItems.addEntry("Minor", (200, 50, 0)) self.importItems.addEntry("Major", (200,150, 0)) self.importItems.addEntry("Main", ( 50,200, 0)) @@ -438,7 +441,7 @@ class NWProject(): ## def deleteItem(self, tHandle): - """This only removed the item from the order list, but not from the project tree. + """This only removes the item from the order list, but not from the project tree. """ self.treeOrder.remove(tHandle) self.setProjectChanged(True) diff --git a/tests/reference/gui/1_nwProject.nwx b/tests/reference/gui/1_nwProject.nwx index cf0b0f54..971954a6 100644 --- a/tests/reference/gui/1_nwProject.nwx +++ b/tests/reference/gui/1_nwProject.nwx @@ -1,60 +1,72 @@ - + - False - None - None + True + 31489056e0916 + 31489056e0916 + + New + Note + Draft + Finished + + + New + Minor + Major + Main + Novel ROOT NOVEL - 0 - False + New + True New Chapter FOLDER NOVEL - 0 - False + New + True New Scene FILE NOVEL - 0 + New False SCENE - 0 - 0 - 0 - 0 + 377 + 69 + 2 + 443 Characters ROOT CHARACTER - 0 + New False Plot ROOT PLOT - 0 + New False World ROOT WORLD - 0 + New False diff --git a/tests/reference/gui/2_nwProject.nwx b/tests/reference/gui/2_nwProject.nwx index 33070870..1e41ce6e 100644 --- a/tests/reference/gui/2_nwProject.nwx +++ b/tests/reference/gui/2_nwProject.nwx @@ -1,5 +1,5 @@ - + Project Name Project Title @@ -10,27 +10,39 @@ False None None + + New + Note + Draft + Finished + + + New + Minor + Major + Main + Novel ROOT NOVEL - 0 + New False New Chapter FOLDER NOVEL - 0 + New False New Scene FILE NOVEL - 0 + New False SCENE 0 @@ -42,21 +54,21 @@ Characters ROOT CHARACTER - 0 + New False Plot ROOT PLOT - 0 + New False World ROOT WORLD - 0 + New False diff --git a/tests/reference/gui/3_nwProject.nwx b/tests/reference/gui/3_nwProject.nwx index ecc54350..510192ff 100644 --- a/tests/reference/gui/3_nwProject.nwx +++ b/tests/reference/gui/3_nwProject.nwx @@ -1,5 +1,5 @@ - + @@ -8,27 +8,39 @@ False None None + + New + Note + Draft + Finished + + + New + Minor + Major + Main + Novel ROOT NOVEL - 0 + New False New Chapter FOLDER NOVEL - 0 + New False Just a Page FILE NOVEL - 1 + Note False PAGE 0 @@ -40,21 +52,21 @@ Characters ROOT CHARACTER - 0 + New False Plot ROOT PLOT - 0 + New False World ROOT WORLD - 0 + New False diff --git a/tests/reference/proj/1_nwProject.nwx b/tests/reference/proj/1_nwProject.nwx index 181e1166..e9ff11f5 100644 --- a/tests/reference/proj/1_nwProject.nwx +++ b/tests/reference/proj/1_nwProject.nwx @@ -1,5 +1,5 @@ - + @@ -8,48 +8,60 @@ False None None + + New + Note + Draft + Finished + + + New + Minor + Major + Main + Novel ROOT NOVEL - 0 + New False Characters ROOT CHARACTER - 0 + New False Plot ROOT PLOT - 0 + New False World ROOT WORLD - 0 + New False New Chapter FOLDER NOVEL - 0 + New False New Scene FILE NOVEL - 0 + New False SCENE 0 diff --git a/tests/reference/proj/2_nwProject.nwx b/tests/reference/proj/2_nwProject.nwx index f9dbdef1..8c68bc42 100644 --- a/tests/reference/proj/2_nwProject.nwx +++ b/tests/reference/proj/2_nwProject.nwx @@ -1,5 +1,5 @@ - + @@ -8,48 +8,60 @@ False None None + + New + Note + Draft + Finished + + + New + Minor + Major + Main + Novel ROOT NOVEL - 0 + New False Characters ROOT CHARACTER - 0 + New False Plot ROOT PLOT - 0 + New False World ROOT WORLD - 0 + New False New Chapter FOLDER NOVEL - 0 + New False New Scene FILE NOVEL - 0 + New False SCENE 0 @@ -61,28 +73,28 @@ Timeline ROOT TIMELINE - 0 + New False Object ROOT OBJECT - 0 + New False Custom1 ROOT CUSTOM - 0 + New False Custom2 ROOT CUSTOM - 0 + New False diff --git a/tests/test_gui.py b/tests/test_gui.py index 681c2116..cf3593fe 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -99,15 +99,19 @@ def testMainWindows(qtbot, nwTempGUI, nwRef): qtbot.wait(stepDelay) nwGUI.docEditor.wCounter.run() qtbot.wait(stepDelay) + nwGUI.docEditor._updateCounts() # Save the document assert nwGUI.docEditor.docChanged assert nwGUI.saveDocument() + assert not nwGUI.docEditor.docChanged qtbot.wait(stepDelay) # Open and view the edited document assert nwGUI.openDocument("31489056e0916") assert nwGUI.viewDocument("31489056e0916") + qtbot.wait(stepDelay) + assert nwGUI.saveProject() # Check the files projFile = path.join(nwTempGUI,"nwProject.nwx") @@ -135,27 +139,27 @@ def testProjectEditor(qtbot, nwTempGUI, nwRef): qtbot.addWidget(projEdit) for c in "Project Name": - qtbot.keyClick(projEdit.editName, c, delay=keyDelay) + qtbot.keyClick(projEdit.tabMain.editName, c, delay=keyDelay) for c in "Project Title": - qtbot.keyClick(projEdit.editTitle, c, delay=keyDelay) + qtbot.keyClick(projEdit.tabMain.editTitle, c, delay=keyDelay) for c in "Jane Doe": - qtbot.keyClick(projEdit.editAuthors, c, delay=keyDelay) - qtbot.keyClick(projEdit.editAuthors, Qt.Key_Return, delay=keyDelay) + qtbot.keyClick(projEdit.tabMain.editAuthors, c, delay=keyDelay) + qtbot.keyClick(projEdit.tabMain.editAuthors, Qt.Key_Return, delay=keyDelay) for c in "John Doh": - qtbot.keyClick(projEdit.editAuthors, c, delay=keyDelay) + qtbot.keyClick(projEdit.tabMain.editAuthors, c, delay=keyDelay) - qtbot.mouseClick(projEdit.saveButton, Qt.LeftButton) + projEdit._doSave() projEdit = GuiProjectEditor(nwGUI, nwGUI.theProject) qtbot.addWidget(projEdit) - assert projEdit.editName.text() == "Project Name" - assert projEdit.editTitle.text() == "Project Title" - theAuth = projEdit.editAuthors.toPlainText().strip().splitlines() + assert projEdit.tabMain.editName.text() == "Project Name" + assert projEdit.tabMain.editTitle.text() == "Project Title" + theAuth = projEdit.tabMain.editAuthors.toPlainText().strip().splitlines() assert len(theAuth) == 2 assert theAuth[0] == "Jane Doe" assert theAuth[1] == "John Doh" - qtbot.mouseClick(projEdit.closeButton, Qt.LeftButton) + projEdit._doClose() qtbot.wait(stepDelay) assert nwGUI.saveProject() @@ -185,7 +189,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef): qtbot.addWidget(itemEdit) assert itemEdit.editName.text() == "New Scene" - assert itemEdit.editStatus.currentData() == 0 + assert itemEdit.editStatus.currentData() == "New" assert itemEdit.editLayout.currentData() == nwItemLayout.SCENE for c in "Just a Page": @@ -199,7 +203,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef): itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916") qtbot.addWidget(itemEdit) assert itemEdit.editName.text() == "Just a Page" - assert itemEdit.editStatus.currentData() == 1 + assert itemEdit.editStatus.currentData() == "Note" assert itemEdit.editLayout.currentData() == nwItemLayout.PAGE qtbot.mouseClick(itemEdit.closeButton, Qt.LeftButton)