Cleaned up item editor, and removed some redundant imports here and there
This commit is contained in:
@@ -1,48 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
version="1.1"
|
|
||||||
id="Layer_1"
|
|
||||||
x="0px"
|
|
||||||
y="0px"
|
|
||||||
width="280px"
|
|
||||||
height="279.416px"
|
|
||||||
viewBox="340 140 280 279.416"
|
|
||||||
enable-background="new 340 140 280 279.416"
|
|
||||||
xml:space="preserve"
|
|
||||||
sodipodi:docname="gear.svg"
|
|
||||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
|
|
||||||
id="metadata9"><rdf:RDF><cc:Work
|
|
||||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
|
||||||
id="defs7" /><sodipodi:namedview
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1"
|
|
||||||
objecttolerance="10"
|
|
||||||
gridtolerance="10"
|
|
||||||
guidetolerance="10"
|
|
||||||
inkscape:pageopacity="0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:window-width="1920"
|
|
||||||
inkscape:window-height="1013"
|
|
||||||
id="namedview5"
|
|
||||||
showgrid="false"
|
|
||||||
inkscape:zoom="0.84461882"
|
|
||||||
inkscape:cx="22.787362"
|
|
||||||
inkscape:cy="139.70799"
|
|
||||||
inkscape:window-x="1920"
|
|
||||||
inkscape:window-y="27"
|
|
||||||
inkscape:window-maximized="1"
|
|
||||||
inkscape:current-layer="Layer_1" />
|
|
||||||
<path
|
|
||||||
d="M620,305.666v-51.333l-31.5-5.25c-2.333-8.75-5.833-16.917-9.917-23.917L597.25,199.5l-36.167-36.75l-26.25,18.083 c-7.583-4.083-15.75-7.583-23.916-9.917L505.667,140h-51.334l-5.25,31.5c-8.75,2.333-16.333,5.833-23.916,9.916L399.5,163.333 L362.75,199.5l18.667,25.666c-4.083,7.584-7.583,15.75-9.917,24.5l-31.5,4.667v51.333l31.5,5.25 c2.333,8.75,5.833,16.334,9.917,23.917l-18.667,26.25l36.167,36.167l26.25-18.667c7.583,4.083,15.75,7.583,24.5,9.917l5.25,30.916 h51.333l5.25-31.5c8.167-2.333,16.333-5.833,23.917-9.916l26.25,18.666l36.166-36.166l-18.666-26.25 c4.083-7.584,7.583-15.167,9.916-23.917L620,305.666z M480,333.666c-29.75,0-53.667-23.916-53.667-53.666s24.5-53.667,53.667-53.667 S533.667,250.25,533.667,280S509.75,333.666,480,333.666z"
|
|
||||||
id="path2"
|
|
||||||
style="fill:#000000;fill-opacity:0.35408559" />
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.3 KiB |
@@ -1,8 +0,0 @@
|
|||||||
FROM ICON SET: Typicons
|
|
||||||
LICENSE: Creative Commons (Attribution-Share Alike 3.0 Unported)
|
|
||||||
https://creativecommons.org/licenses/by-sa/3.0/
|
|
||||||
|
|
||||||
Applies to:
|
|
||||||
* graphics/export.svg
|
|
||||||
* graphics/merge.svg
|
|
||||||
* graphics/split.svg
|
|
||||||
@@ -29,10 +29,9 @@ import logging
|
|||||||
import nw
|
import nw
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtGui import QColor, QPalette
|
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QDialog, QHBoxLayout, QVBoxLayout, QGridLayout, QPushButton, QLabel,
|
QDialog, QVBoxLayout, QLabel, QListWidget, QAbstractItemView,
|
||||||
QListWidget, QAbstractItemView, QListWidgetItem, QDialogButtonBox
|
QListWidgetItem, QDialogButtonBox
|
||||||
)
|
)
|
||||||
|
|
||||||
from nw.constants import nwAlert, nwItemType
|
from nw.constants import nwAlert, nwItemType
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ import nw
|
|||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QDialog, QHBoxLayout, QVBoxLayout, QGridLayout, QPushButton, QComboBox,
|
QDialog, QVBoxLayout, QComboBox, QListWidget, QAbstractItemView,
|
||||||
QListWidget, QAbstractItemView, QListWidgetItem, QDialogButtonBox, QLabel
|
QListWidgetItem, QDialogButtonBox, QLabel
|
||||||
)
|
)
|
||||||
from nw.constants import nwAlert, nwItemType, nwItemClass, nwItemLayout
|
from nw.constants import nwAlert, nwItemType, nwItemClass, nwItemLayout
|
||||||
from nw.gui.additions import QHelpLabel
|
from nw.gui.additions import QHelpLabel
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ import nw
|
|||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QDialog, QHBoxLayout, QVBoxLayout, QGroupBox, QGridLayout, QLineEdit,
|
QDialog, QVBoxLayout, QGridLayout, QLineEdit, QComboBox, QLabel,
|
||||||
QComboBox, QLabel, QSpacerItem, QSizePolicy, QDialogButtonBox
|
QDialogButtonBox
|
||||||
)
|
)
|
||||||
|
|
||||||
from nw.gui.additions import QSwitch
|
from nw.gui.additions import QSwitch, QHelpLabel
|
||||||
from nw.constants import nwLabels, nwItemLayout, nwItemClass, nwItemType
|
from nw.constants import nwLabels, nwItemLayout, nwItemClass, nwItemType
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -49,31 +49,30 @@ class GuiItemEditor(QDialog):
|
|||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theProject = theProject
|
self.theProject = theProject
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.outerBox = QHBoxLayout()
|
|
||||||
self.innerBox = QVBoxLayout()
|
|
||||||
|
|
||||||
self.theItem = self.theProject.projTree[tHandle]
|
self.outerBox = QVBoxLayout()
|
||||||
|
|
||||||
|
self.theItem = self.theProject.projTree[tHandle]
|
||||||
if self.theItem is None:
|
if self.theItem is None:
|
||||||
self._doClose()
|
self._doClose()
|
||||||
|
|
||||||
self.setWindowTitle("Item Settings")
|
self.setWindowTitle("Item Settings")
|
||||||
self.guiDeco = self.theParent.theTheme.loadDecoration("settings", (64,64))
|
|
||||||
self.outerBox.setSpacing(16)
|
|
||||||
|
|
||||||
self.outerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
|
|
||||||
self.outerBox.addLayout(self.innerBox)
|
|
||||||
self.setLayout(self.outerBox)
|
self.setLayout(self.outerBox)
|
||||||
|
|
||||||
self.mainGroup = QGroupBox("Item Settings")
|
# Labels
|
||||||
self.mainForm = QGridLayout()
|
self.headLabel = QLabel("<b>Edit Item Settings</b>")
|
||||||
|
self.helpLabel = QHelpLabel(
|
||||||
|
"Item layout and status options depend on the root folder.",
|
||||||
|
self.theParent.theTheme.helpText
|
||||||
|
)
|
||||||
|
|
||||||
|
# Item Label
|
||||||
self.editName = QLineEdit()
|
self.editName = QLineEdit()
|
||||||
self.editName.setMinimumWidth(220)
|
self.editName.setMinimumWidth(220)
|
||||||
self.editName.setMaxLength(200)
|
self.editName.setMaxLength(200)
|
||||||
|
|
||||||
|
# Item Status
|
||||||
self.editStatus = QComboBox()
|
self.editStatus = QComboBox()
|
||||||
self.editLayout = QComboBox()
|
|
||||||
|
|
||||||
if self.theItem.itemClass == nwItemClass.NOVEL:
|
if self.theItem.itemClass == nwItemClass.NOVEL:
|
||||||
for sLabel, _, _ in self.theProject.statusItems:
|
for sLabel, _, _ in self.theProject.statusItems:
|
||||||
self.editStatus.addItem(
|
self.editStatus.addItem(
|
||||||
@@ -85,6 +84,8 @@ class GuiItemEditor(QDialog):
|
|||||||
self.theParent.importIcons[sLabel], sLabel, sLabel
|
self.theParent.importIcons[sLabel], sLabel, sLabel
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Item Layout
|
||||||
|
self.editLayout = QComboBox()
|
||||||
self.validLayouts = []
|
self.validLayouts = []
|
||||||
if self.theItem.itemType == nwItemType.FILE:
|
if self.theItem.itemType == nwItemType.FILE:
|
||||||
if self.theItem.itemClass == nwItemClass.NOVEL:
|
if self.theItem.itemClass == nwItemClass.NOVEL:
|
||||||
@@ -105,6 +106,7 @@ class GuiItemEditor(QDialog):
|
|||||||
if itemLayout in self.validLayouts:
|
if itemLayout in self.validLayouts:
|
||||||
self.editLayout.addItem(nwLabels.LAYOUT_NAME[itemLayout],itemLayout)
|
self.editLayout.addItem(nwLabels.LAYOUT_NAME[itemLayout],itemLayout)
|
||||||
|
|
||||||
|
# Export Switch
|
||||||
self.textExport = QLabel("Include when building project")
|
self.textExport = QLabel("Include when building project")
|
||||||
self.editExport = QSwitch()
|
self.editExport = QSwitch()
|
||||||
if self.theItem.itemType == nwItemType.FILE:
|
if self.theItem.itemType == nwItemType.FILE:
|
||||||
@@ -114,18 +116,6 @@ class GuiItemEditor(QDialog):
|
|||||||
self.editExport.setEnabled(False)
|
self.editExport.setEnabled(False)
|
||||||
self.editExport.setChecked(False)
|
self.editExport.setChecked(False)
|
||||||
|
|
||||||
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)
|
self.editName.setText(self.theItem.itemName)
|
||||||
statusIdx = self.editStatus.findData(self.theItem.itemStatus)
|
statusIdx = self.editStatus.findData(self.theItem.itemStatus)
|
||||||
if statusIdx != -1:
|
if statusIdx != -1:
|
||||||
@@ -134,14 +124,34 @@ class GuiItemEditor(QDialog):
|
|||||||
if layoutIdx != -1:
|
if layoutIdx != -1:
|
||||||
self.editLayout.setCurrentIndex(layoutIdx)
|
self.editLayout.setCurrentIndex(layoutIdx)
|
||||||
|
|
||||||
|
# Buttons
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||||
self.buttonBox.accepted.connect(self._doSave)
|
self.buttonBox.accepted.connect(self._doSave)
|
||||||
self.buttonBox.rejected.connect(self._doClose)
|
self.buttonBox.rejected.connect(self._doClose)
|
||||||
|
|
||||||
self.mainGroup.setLayout(self.mainForm)
|
# Assemble
|
||||||
self.innerBox.addWidget(self.mainGroup)
|
self.mainForm = QGridLayout()
|
||||||
self.innerBox.addWidget(self.buttonBox)
|
self.mainForm.setVerticalSpacing(4)
|
||||||
|
self.mainForm.addWidget(QLabel("Label"), 0, 0, 1, 1)
|
||||||
|
self.mainForm.addWidget(self.editName, 0, 1, 1, 2)
|
||||||
|
self.mainForm.addWidget(QLabel("Status"), 1, 0, 1, 1)
|
||||||
|
self.mainForm.addWidget(self.editStatus, 1, 1, 1, 2)
|
||||||
|
self.mainForm.addWidget(QLabel("Layout"), 2, 0, 1, 1)
|
||||||
|
self.mainForm.addWidget(self.editLayout, 2, 1, 1, 2)
|
||||||
|
self.mainForm.addWidget(self.textExport, 3, 0, 1, 2)
|
||||||
|
self.mainForm.addWidget(self.editExport, 3, 2, 1, 1)
|
||||||
|
|
||||||
|
self.outerBox.setSpacing(0)
|
||||||
|
self.outerBox.addWidget(self.headLabel)
|
||||||
|
self.outerBox.addWidget(self.helpLabel)
|
||||||
|
self.outerBox.addSpacing(8)
|
||||||
|
self.outerBox.addLayout(self.mainForm)
|
||||||
|
self.outerBox.addSpacing(12)
|
||||||
|
self.outerBox.addStretch(1)
|
||||||
|
self.outerBox.addWidget(self.buttonBox)
|
||||||
|
self.setLayout(self.outerBox)
|
||||||
|
|
||||||
|
self.rejected.connect(self._doClose)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
self.editName.selectAll()
|
self.editName.selectAll()
|
||||||
@@ -175,7 +185,6 @@ class GuiItemEditor(QDialog):
|
|||||||
|
|
||||||
def _doClose(self):
|
def _doClose(self):
|
||||||
logger.verbose("ItemEditor close button clicked")
|
logger.verbose("ItemEditor close button clicked")
|
||||||
self.reject()
|
|
||||||
self.close()
|
self.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ class GuiIcons:
|
|||||||
|
|
||||||
DECO_MAP = {
|
DECO_MAP = {
|
||||||
"nwicon" : ["icons", "novelWriter.svg"],
|
"nwicon" : ["icons", "novelWriter.svg"],
|
||||||
"settings" : ["graphics", "gear.svg"],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, theParent):
|
def __init__(self, theParent):
|
||||||
|
|||||||
Reference in New Issue
Block a user