Added the new exported option to project tree and item editor
This commit is contained in:
@@ -59,6 +59,7 @@ class GuiConfigEditor(QDialog):
|
||||
|
||||
self.setWindowTitle("Preferences")
|
||||
self.guiDeco = self.theParent.theTheme.loadDecoration("settings",(64,64))
|
||||
self.outerBox.setSpacing(16)
|
||||
|
||||
self.tabGeneral = GuiConfigEditGeneralTab(self.theParent)
|
||||
self.tabLayout = GuiConfigEditLayoutTab(self.theParent)
|
||||
|
||||
@@ -30,10 +30,11 @@ import nw
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QGroupBox, QFormLayout, QLineEdit,
|
||||
QPushButton, QComboBox
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QGroupBox, QGridLayout, QLineEdit,
|
||||
QPushButton, QComboBox, QLabel, QSpacerItem, QSizePolicy, QDialogButtonBox
|
||||
)
|
||||
|
||||
from nw.gui.additions import QSwitch
|
||||
from nw.constants import nwLabels, nwItemLayout, nwItemClass, nwItemType
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -48,22 +49,26 @@ class GuiItemEditor(QDialog):
|
||||
self.mainConf = nw.CONFIG
|
||||
self.theProject = theProject
|
||||
self.theParent = theParent
|
||||
self.theItem = self.theProject.projTree[tHandle]
|
||||
|
||||
self.outerBox = QHBoxLayout()
|
||||
self.innerBox = QVBoxLayout()
|
||||
|
||||
self.theItem = self.theProject.projTree[tHandle]
|
||||
if self.theItem is None:
|
||||
self._doClose()
|
||||
|
||||
self.setWindowTitle("Item Settings")
|
||||
self.guiDeco = self.theParent.theTheme.loadDecoration("settings",(64,64))
|
||||
self.outerBox.setSpacing(16)
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
self.outerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
|
||||
self.outerBox.addLayout(self.innerBox)
|
||||
|
||||
self.mainGroup = QGroupBox("Item Settings")
|
||||
self.mainForm = QFormLayout()
|
||||
self.mainForm = QGridLayout()
|
||||
|
||||
self.editName = QLineEdit()
|
||||
self.editName.setMinimumWidth(220)
|
||||
self.editName.setMaxLength(200)
|
||||
|
||||
self.editStatus = QComboBox()
|
||||
@@ -100,11 +105,21 @@ class GuiItemEditor(QDialog):
|
||||
if itemLayout in self.validLayouts:
|
||||
self.editLayout.addItem(nwLabels.LAYOUT_NAME[itemLayout],itemLayout)
|
||||
|
||||
self.mainForm.addRow("Label", self.editName)
|
||||
self.mainForm.addRow("Status", self.editStatus)
|
||||
self.mainForm.addRow("Layout", self.editLayout)
|
||||
self.editExport = QSwitch()
|
||||
self.editExport.setChecked(self.theItem.isExported)
|
||||
self.textExport = QLabel("Include when building project")
|
||||
|
||||
self.editName.setMinimumWidth(200)
|
||||
self.mainForm.addWidget(QLabel("Label"), 0, 0)
|
||||
self.mainForm.addWidget(self.editName, 0, 1, 1, 2)
|
||||
self.mainForm.addWidget(QLabel("Status"), 1, 0)
|
||||
self.mainForm.addWidget(self.editStatus, 1, 1, 1, 2)
|
||||
self.mainForm.addWidget(QLabel("Layout"), 2, 0)
|
||||
self.mainForm.addWidget(self.editLayout, 2, 1, 1, 2)
|
||||
self.mainForm.addWidget(self.textExport, 4, 0, 1, 2)
|
||||
self.mainForm.addWidget(self.editExport, 4, 2)
|
||||
|
||||
self.spacerItem = QSpacerItem(12, 12, QSizePolicy.Fixed, QSizePolicy.Fixed)
|
||||
self.mainForm.addItem(self.spacerItem, 3, 0)
|
||||
|
||||
self.editName.setText(self.theItem.itemName)
|
||||
statusIdx = self.editStatus.findData(self.theItem.itemStatus)
|
||||
@@ -114,19 +129,13 @@ class GuiItemEditor(QDialog):
|
||||
if layoutIdx != -1:
|
||||
self.editLayout.setCurrentIndex(layoutIdx)
|
||||
|
||||
self.buttonBox = QHBoxLayout()
|
||||
self.closeButton = QPushButton("Close")
|
||||
self.closeButton.clicked.connect(self._doClose)
|
||||
self.saveButton = QPushButton("Save")
|
||||
self.saveButton.setDefault(True)
|
||||
self.saveButton.clicked.connect(self._doSave)
|
||||
self.buttonBox.addStretch(1)
|
||||
self.buttonBox.addWidget(self.closeButton)
|
||||
self.buttonBox.addWidget(self.saveButton)
|
||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||
self.buttonBox.accepted.connect(self._doSave)
|
||||
self.buttonBox.rejected.connect(self._doClose)
|
||||
|
||||
self.mainGroup.setLayout(self.mainForm)
|
||||
self.innerBox.addWidget(self.mainGroup)
|
||||
self.innerBox.addLayout(self.buttonBox)
|
||||
self.innerBox.addWidget(self.buttonBox)
|
||||
|
||||
self.show()
|
||||
|
||||
@@ -137,16 +146,26 @@ class GuiItemEditor(QDialog):
|
||||
return
|
||||
|
||||
def _doSave(self):
|
||||
"""Save the setting to the item.
|
||||
"""
|
||||
|
||||
logger.verbose("ItemEditor save button clicked")
|
||||
|
||||
itemName = self.editName.text()
|
||||
itemStatus = self.editStatus.currentData()
|
||||
itemLayout = self.editLayout.currentData()
|
||||
isExported = self.editExport.isChecked()
|
||||
|
||||
self.theItem.setName(itemName)
|
||||
self.theItem.setStatus(itemStatus)
|
||||
self.theItem.setLayout(itemLayout)
|
||||
self.theItem.setExported(isExported)
|
||||
|
||||
self.theProject.setProjectChanged(True)
|
||||
|
||||
self.accept()
|
||||
self.close()
|
||||
|
||||
return
|
||||
|
||||
def _doClose(self):
|
||||
|
||||
@@ -54,10 +54,10 @@ class GuiProjectEditor(QDialog):
|
||||
|
||||
self.outerBox = QHBoxLayout()
|
||||
self.innerBox = QVBoxLayout()
|
||||
self.setWindowTitle("Project Settings")
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
self.setWindowTitle("Project Settings")
|
||||
self.guiDeco = self.theParent.theTheme.loadDecoration("settings",(64,64))
|
||||
self.outerBox.setSpacing(16)
|
||||
|
||||
self.theProject.countStatus()
|
||||
self.tabMain = GuiProjectEditMain(self.theParent, self.theProject)
|
||||
@@ -78,6 +78,7 @@ class GuiProjectEditor(QDialog):
|
||||
self.buttonBox.accepted.connect(self._doSave)
|
||||
self.buttonBox.rejected.connect(self._doClose)
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
self.innerBox.addWidget(self.tabWidget)
|
||||
self.innerBox.addWidget(self.buttonBox)
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from nw.core import NWDoc
|
||||
from nw.constants import (
|
||||
nwLabels, nwItemType, nwItemClass, nwItemLayout, nwAlert
|
||||
nwLabels, nwItemType, nwItemClass, nwItemLayout, nwAlert, nwUnicode
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -254,6 +254,8 @@ class GuiDocTree(QTreeWidget):
|
||||
return theList
|
||||
|
||||
def getColumnSizes(self):
|
||||
"""Return the column widths for the tree columns.
|
||||
"""
|
||||
retVals = [
|
||||
self.columnWidth(0),
|
||||
self.columnWidth(1),
|
||||
@@ -401,7 +403,8 @@ class GuiDocTree(QTreeWidget):
|
||||
return True
|
||||
|
||||
def setTreeItemValues(self, tHandle):
|
||||
|
||||
"""Set the name and flag values for a tree item.
|
||||
"""
|
||||
trItem = self._getTreeItem(tHandle)
|
||||
nwItem = self.theProject.projTree[tHandle]
|
||||
tName = nwItem.itemName
|
||||
@@ -409,7 +412,11 @@ class GuiDocTree(QTreeWidget):
|
||||
tHandle = nwItem.itemHandle
|
||||
pHandle = nwItem.parHandle
|
||||
|
||||
tStatus = nwLabels.CLASS_FLAG[nwItem.itemClass]
|
||||
if nwItem.isExported:
|
||||
tStatus = nwUnicode.U_CHECK
|
||||
else:
|
||||
tStatus = " "
|
||||
tStatus += " "+nwLabels.CLASS_FLAG[nwItem.itemClass]
|
||||
if nwItem.itemType == nwItemType.FILE:
|
||||
tStatus += "."+nwLabels.LAYOUT_FLAG[nwItem.itemLayout]
|
||||
iStatus = nwItem.itemStatus
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<novelWriterXML appVersion="0.4.5" fileVersion="1.0" saveCount="127" autoCount="17" timeStamp="2020-05-09 16:03:23">
|
||||
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="162" autoCount="19" timeStamp="2020-05-09 20:50:45">
|
||||
<project>
|
||||
<name>Sample Project</name>
|
||||
<title>Sample Project</title>
|
||||
@@ -10,7 +10,7 @@
|
||||
<settings>
|
||||
<spellCheck>True</spellCheck>
|
||||
<autoOutline>True</autoOutline>
|
||||
<lastEdited>96b68994dfa3d</lastEdited>
|
||||
<lastEdited>6a2d6d5f4f401</lastEdited>
|
||||
<lastViewed>b3e74dbc1f584</lastViewed>
|
||||
<lastWordCount>875</lastWordCount>
|
||||
<autoReplace>
|
||||
@@ -41,6 +41,7 @@
|
||||
<class>NOVEL</class>
|
||||
<status>Started</status>
|
||||
<expanded>True</expanded>
|
||||
<exported>True</exported>
|
||||
</item>
|
||||
<item handle="53b69b83cdafc" order="0" parent="7031beac91f75">
|
||||
<name>Title Page</name>
|
||||
@@ -48,6 +49,7 @@
|
||||
<class>NOVEL</class>
|
||||
<status>Started</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>TITLE</layout>
|
||||
<charCount>72</charCount>
|
||||
<wordCount>15</wordCount>
|
||||
@@ -60,6 +62,7 @@
|
||||
<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>
|
||||
@@ -67,6 +70,7 @@
|
||||
<class>NOVEL</class>
|
||||
<status>Notes</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>CHAPTER</layout>
|
||||
<charCount>12</charCount>
|
||||
<wordCount>3</wordCount>
|
||||
@@ -79,6 +83,7 @@
|
||||
<class>NOVEL</class>
|
||||
<status>1st Draft</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>SCENE</layout>
|
||||
<charCount>1199</charCount>
|
||||
<wordCount>216</wordCount>
|
||||
@@ -91,6 +96,7 @@
|
||||
<class>NOVEL</class>
|
||||
<status>1st Draft</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>SCENE</layout>
|
||||
<charCount>476</charCount>
|
||||
<wordCount>93</wordCount>
|
||||
@@ -103,6 +109,7 @@
|
||||
<class>NOVEL</class>
|
||||
<status>Finished</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>UNNUMBERED</layout>
|
||||
<charCount>633</charCount>
|
||||
<wordCount>101</wordCount>
|
||||
@@ -115,6 +122,7 @@
|
||||
<class>NOVEL</class>
|
||||
<status>2nd Draft</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>False</exported>
|
||||
<layout>NOTE</layout>
|
||||
<charCount>1692</charCount>
|
||||
<wordCount>313</wordCount>
|
||||
@@ -127,6 +135,7 @@
|
||||
<class>NOVEL</class>
|
||||
<status>1st Draft</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>CHAPTER</layout>
|
||||
<charCount>139</charCount>
|
||||
<wordCount>28</wordCount>
|
||||
@@ -139,6 +148,7 @@
|
||||
<class>NOVEL</class>
|
||||
<status>1st Draft</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>SCENE</layout>
|
||||
<charCount>189</charCount>
|
||||
<wordCount>37</wordCount>
|
||||
@@ -151,6 +161,7 @@
|
||||
<class>CHARACTER</class>
|
||||
<status>None</status>
|
||||
<expanded>True</expanded>
|
||||
<exported>True</exported>
|
||||
</item>
|
||||
<item handle="f7e2d9f330615" order="0" parent="f6622b4617424">
|
||||
<name>Main Characters</name>
|
||||
@@ -158,6 +169,7 @@
|
||||
<class>CHARACTER</class>
|
||||
<status>None</status>
|
||||
<expanded>True</expanded>
|
||||
<exported>True</exported>
|
||||
</item>
|
||||
<item handle="14298de4d9524" order="0" parent="f7e2d9f330615">
|
||||
<name>John Smith</name>
|
||||
@@ -165,6 +177,7 @@
|
||||
<class>CHARACTER</class>
|
||||
<status>Minor</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>NOTE</layout>
|
||||
<charCount>49</charCount>
|
||||
<wordCount>9</wordCount>
|
||||
@@ -177,6 +190,7 @@
|
||||
<class>CHARACTER</class>
|
||||
<status>Major</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>NOTE</layout>
|
||||
<charCount>55</charCount>
|
||||
<wordCount>9</wordCount>
|
||||
@@ -189,6 +203,7 @@
|
||||
<class>WORLD</class>
|
||||
<status>None</status>
|
||||
<expanded>True</expanded>
|
||||
<exported>True</exported>
|
||||
</item>
|
||||
<item handle="b3e74dbc1f584" order="0" parent="15c4492bd5107">
|
||||
<name>Earth</name>
|
||||
@@ -196,6 +211,7 @@
|
||||
<class>WORLD</class>
|
||||
<status>Main</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>NOTE</layout>
|
||||
<charCount>76</charCount>
|
||||
<wordCount>15</wordCount>
|
||||
@@ -208,6 +224,7 @@
|
||||
<class>WORLD</class>
|
||||
<status>Minor</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>NOTE</layout>
|
||||
<charCount>115</charCount>
|
||||
<wordCount>24</wordCount>
|
||||
@@ -220,6 +237,7 @@
|
||||
<class>WORLD</class>
|
||||
<status>Major</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>NOTE</layout>
|
||||
<charCount>28</charCount>
|
||||
<wordCount>6</wordCount>
|
||||
@@ -232,6 +250,7 @@
|
||||
<class>TRASH</class>
|
||||
<status>None</status>
|
||||
<expanded>True</expanded>
|
||||
<exported>True</exported>
|
||||
</item>
|
||||
<item handle="b8136a5a774a0" order="0" parent="98acd8c76c93a">
|
||||
<name>Delete Me!</name>
|
||||
@@ -239,6 +258,7 @@
|
||||
<class>NOVEL</class>
|
||||
<status>New</status>
|
||||
<expanded>False</expanded>
|
||||
<exported>True</exported>
|
||||
<layout>SCENE</layout>
|
||||
<charCount>30</charCount>
|
||||
<wordCount>6</wordCount>
|
||||
|
||||
Reference in New Issue
Block a user