The isExported option should only apply to files

This commit is contained in:
Veronica K. B. Olsen
2020-05-10 23:24:32 +02:00
parent a7d2ca24a5
commit 0faf1f9986
13 changed files with 40 additions and 63 deletions
+1 -1
View File
@@ -1350,8 +1350,8 @@ class NWItem():
xSub = self._subPack(xPack,"class", text=str(self.itemClass.name))
xSub = self._subPack(xPack,"status", text=str(self.itemStatus))
xSub = self._subPack(xPack,"expanded", text=str(self.isExpanded))
xSub = self._subPack(xPack,"exported", text=str(self.isExported))
if self.itemType == nwItemType.FILE:
xSub = self._subPack(xPack,"exported", text=str(self.isExported))
xSub = self._subPack(xPack,"layout", text=str(self.itemLayout.name))
xSub = self._subPack(xPack,"charCount", text=str(self.charCount), none=False)
xSub = self._subPack(xPack,"wordCount", text=str(self.wordCount), none=False)
+7 -2
View File
@@ -105,9 +105,14 @@ class GuiItemEditor(QDialog):
if itemLayout in self.validLayouts:
self.editLayout.addItem(nwLabels.LAYOUT_NAME[itemLayout],itemLayout)
self.editExport = QSwitch()
self.editExport.setChecked(self.theItem.isExported)
self.textExport = QLabel("Include when building project")
self.editExport = QSwitch()
if self.theItem.itemType == nwItemType.FILE:
self.editExport.setEnabled(True)
self.editExport.setChecked(self.theItem.isExported)
else:
self.editExport.setEnabled(False)
self.editExport.setChecked(False)
self.mainForm.addWidget(QLabel("Label"), 0, 0)
self.mainForm.addWidget(self.editName, 0, 1, 1, 2)
+7 -4
View File
@@ -32,7 +32,7 @@ from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QFrame, QGridLayout, QLabel
from nw.constants import nwLabels, nwItemClass, nwUnicode
from nw.constants import nwLabels, nwItemClass, nwItemType, nwUnicode
logger = logging.getLogger(__name__)
@@ -170,10 +170,13 @@ class GuiDocDetails(QFrame):
iStatus = self.theProject.importItems.checkEntry(iStatus) # Make sure it's valid
flagIcon = self.theParent.importIcons[iStatus]
if nwItem.isExported:
exportFlag = nwUnicode.U_CHECK
if nwItem.itemType == nwItemType.FILE:
if nwItem.isExported:
exportFlag = nwUnicode.U_CHECK
else:
exportFlag = " "
else:
exportFlag = " "
exportFlag = "+"
self.labelFlag.setText(exportFlag)
self.statusFlag.setPixmap(flagIcon.pixmap(10, 10))
+12 -6
View File
@@ -412,13 +412,19 @@ class GuiDocTree(QTreeWidget):
tHandle = nwItem.itemHandle
pHandle = nwItem.parHandle
if nwItem.isExported:
tStatus = nwUnicode.U_CHECK
else:
tStatus = " "
tStatus += " "+nwLabels.CLASS_FLAG[nwItem.itemClass]
stExport = " "
stClass = nwLabels.CLASS_FLAG[nwItem.itemClass]
stLayout = ""
if nwItem.itemType == nwItemType.FILE:
tStatus += "."+nwLabels.LAYOUT_FLAG[nwItem.itemLayout]
stLayout = "."+nwLabels.LAYOUT_FLAG[nwItem.itemLayout]
if nwItem.isExported:
stExport = nwUnicode.U_CHECK
else:
stExport = "+"
tStatus = stExport+" "+stClass+stLayout
iStatus = nwItem.itemStatus
if tClass == nwItemClass.NOVEL:
iStatus = self.theProject.statusItems.checkEntry(iStatus) # Make sure it's valid
+1 -7
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="257" autoCount="31" timeStamp="2020-05-10 22:50:38">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="263" autoCount="31" timeStamp="2020-05-10 23:14:34">
<project>
<name>Sample Project</name>
<title>Sample Project</title>
@@ -51,7 +51,6 @@
<class>NOVEL</class>
<status>Started</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="53b69b83cdafc" order="0" parent="7031beac91f75">
<name>Title Page</name>
@@ -72,7 +71,6 @@
<class>NOVEL</class>
<status>1st Draft</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="6a2d6d5f4f401" order="0" parent="e7ded148d6e4a">
<name>Chapter One</name>
@@ -171,7 +169,6 @@
<class>CHARACTER</class>
<status>None</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="f7e2d9f330615" order="0" parent="f6622b4617424">
<name>Main Characters</name>
@@ -179,7 +176,6 @@
<class>CHARACTER</class>
<status>None</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="14298de4d9524" order="0" parent="f7e2d9f330615">
<name>John Smith</name>
@@ -213,7 +209,6 @@
<class>WORLD</class>
<status>None</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="b3e74dbc1f584" order="0" parent="15c4492bd5107">
<name>Earth</name>
@@ -260,7 +255,6 @@
<class>TRASH</class>
<status>None</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="b8136a5a774a0" order="0" parent="98acd8c76c93a">
<name>Delete Me!</name>
+1 -6
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="2" autoCount="0" timeStamp="2020-05-10 19:34:15">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="2" autoCount="0" timeStamp="2020-05-10 23:17:36">
<project>
<name></name>
<title></title>
@@ -42,7 +42,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>New Chapter</name>
@@ -50,7 +49,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<name>New Scene</name>
@@ -71,7 +69,6 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
@@ -79,7 +76,6 @@
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="811786ad1ae74" order="3" parent="None">
<name>World</name>
@@ -87,7 +83,6 @@
<class>WORLD</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
</content>
</novelWriterXML>
+1 -6
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="4" autoCount="0" timeStamp="2020-05-10 19:34:57">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="4" autoCount="0" timeStamp="2020-05-10 23:18:06">
<project>
<name></name>
<title></title>
@@ -42,7 +42,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>New Chapter</name>
@@ -50,7 +49,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<name>New Scene</name>
@@ -71,7 +69,6 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="98010bd9270f9" order="0" parent="44cb730c42048">
<name>New File</name>
@@ -92,7 +89,6 @@
<class>PLOT</class>
<status>New</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="0e17daca5f3e1" order="0" parent="71ee45a3c0db9">
<name>New File</name>
@@ -113,7 +109,6 @@
<class>WORLD</class>
<status>New</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="1a6562590ef19" order="0" parent="811786ad1ae74">
<name>New File</name>
+1 -6
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="2" autoCount="0" timeStamp="2020-05-10 19:35:53">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="2" autoCount="0" timeStamp="2020-05-10 23:19:00">
<project>
<name>Project Name</name>
<title>Project Title</title>
@@ -46,7 +46,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>New Chapter</name>
@@ -54,7 +53,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<name>New Scene</name>
@@ -75,7 +73,6 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
@@ -83,7 +80,6 @@
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="811786ad1ae74" order="3" parent="None">
<name>World</name>
@@ -91,7 +87,6 @@
<class>WORLD</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
</content>
</novelWriterXML>
+2 -7
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="2" autoCount="0" timeStamp="2020-05-10 19:36:44">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="2" autoCount="0" timeStamp="2020-05-10 23:19:44">
<project>
<name></name>
<title></title>
@@ -42,7 +42,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>New Chapter</name>
@@ -50,7 +49,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<name>Just a Page</name>
@@ -58,7 +56,7 @@
<class>NOVEL</class>
<status>Note</status>
<expanded>False</expanded>
<exported>True</exported>
<exported>False</exported>
<layout>PAGE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
@@ -71,7 +69,6 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
@@ -79,7 +76,6 @@
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="811786ad1ae74" order="3" parent="None">
<name>World</name>
@@ -87,7 +83,6 @@
<class>WORLD</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
</content>
</novelWriterXML>
+1 -6
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="1" autoCount="0" timeStamp="2020-05-10 19:32:32">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="1" autoCount="0" timeStamp="2020-05-10 23:16:14">
<project>
<name></name>
<title></title>
@@ -42,7 +42,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="44cb730c42048" order="None" parent="None">
<name>Characters</name>
@@ -50,7 +49,6 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="71ee45a3c0db9" order="None" parent="None">
<name>Plot</name>
@@ -58,7 +56,6 @@
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="811786ad1ae74" order="None" parent="None">
<name>World</name>
@@ -66,7 +63,6 @@
<class>WORLD</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="None" parent="73475cb40a568">
<name>New Chapter</name>
@@ -74,7 +70,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="None" parent="25fc0e7096fc6">
<name>New Scene</name>
+1 -10
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="4" autoCount="0" timeStamp="2020-05-10 19:33:26">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="4" autoCount="0" timeStamp="2020-05-10 23:16:52">
<project>
<name></name>
<title></title>
@@ -42,7 +42,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="44cb730c42048" order="None" parent="None">
<name>Characters</name>
@@ -50,7 +49,6 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="71ee45a3c0db9" order="None" parent="None">
<name>Plot</name>
@@ -58,7 +56,6 @@
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="811786ad1ae74" order="None" parent="None">
<name>World</name>
@@ -66,7 +63,6 @@
<class>WORLD</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="None" parent="73475cb40a568">
<name>New Chapter</name>
@@ -74,7 +70,6 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="None" parent="25fc0e7096fc6">
<name>New Scene</name>
@@ -95,7 +90,6 @@
<class>TIMELINE</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="0e17daca5f3e1" order="None" parent="None">
<name>Object</name>
@@ -103,7 +97,6 @@
<class>OBJECT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="1a6562590ef19" order="None" parent="None">
<name>Custom1</name>
@@ -111,7 +104,6 @@
<class>CUSTOM</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="031b4af5197ec" order="None" parent="None">
<name>Custom2</name>
@@ -119,7 +111,6 @@
<class>CUSTOM</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
</content>
</novelWriterXML>
+3
View File
@@ -361,6 +361,9 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
layoutIdx = itemEdit.editLayout.findData(nwItemLayout.PAGE)
itemEdit.editLayout.setCurrentIndex(layoutIdx)
itemEdit.editExport.setChecked(False)
assert not itemEdit.editExport.isChecked()
itemEdit._doSave()
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916")
+2 -2
View File
@@ -197,8 +197,8 @@ def testItemXMLPackUnpack():
assert etree.tostring(xContent, pretty_print=False, encoding="utf-8") == (
b"<content>"
b"<item handle=\"0123456789abc\" order=\"1\" parent=\"0123456789abc\">"
b"<name>A Name</name><type>TRASH</type><class>TRASH</class><status>Main</status>"
b"<expanded>True</expanded><exported>True</exported>"
b"<name>A Name</name><type>TRASH</type><class>TRASH</class>"
b"<status>Main</status><expanded>True</expanded>"
b"</item>"
b"</content>"
)