Cleaned up the split and merge dialogs
This commit is contained in:
@@ -1,44 +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"
|
||||
height="18"
|
||||
id="Layer_1"
|
||||
version="1.2"
|
||||
viewBox="0 0 19 18"
|
||||
width="19"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="export.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
|
||||
id="metadata874"><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="defs872" /><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="1080"
|
||||
id="namedview870"
|
||||
showgrid="false"
|
||||
inkscape:zoom="33.875"
|
||||
inkscape:cx="12.118081"
|
||||
inkscape:cy="12"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" /><path
|
||||
d="M 18.711,6.796 C 18.67,6.755 14.656,2.7 12.729,0.65 12.309,0.236 11.73,0 11.143,0 9.961,0 9,0.896 9,2 H 1 C 0.447,2 0,2.448 0,3 v 14 c 0,0.552 0.447,1 1,1 h 14 c 0.553,0 1,-0.448 1,-1 v -6.045 c 1.434,-1.461 2.688,-2.729 2.711,-2.751 0.387,-0.39 0.387,-1.018 0,-1.408 z m -7.432,6.145 C 11.257,12.968 11.214,13 11.143,13 11.069,13 11.022,12.977 10.999,12.96 V 10 9 h -1 C 8.228,9.034 6.663,9.68 5.246,10.958 5.676,8.743 6.846,6 9.999,6 h 1 V 2.042 C 11.027,2.021 11.07,2 11.143,2 c 0.09,0 0.152,0.05 0.154,0.05 1.436,1.525 4.051,4.187 5.297,5.45 -0.253,0.257 -4.342,4.422 -5.315,5.441 z M 2,16 V 4 h 8 c 0,0.348 0,0.695 0,1 C 5.34,5 4,9.871 4,13.5 V 14 c 1.691,-2.578 3.6,-3.953 6,-4 0,1.045 0,2.838 0,3 0,0.551 0.512,1 1.143,1 0.364,0 0.676,-0.158 0.883,-0.391 0.539,-0.565 1.242,-1.291 1.976,-2.043 V 16 Z"
|
||||
id="path867"
|
||||
style="fill:#000000;fill-opacity:0.35408559"
|
||||
inkscape:connector-curvature="0" /></svg>
|
||||
|
Before Width: | Height: | Size: 2.3 KiB |
@@ -1,31 +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"
|
||||
id="svg4"
|
||||
viewBox="0 0 20 20"
|
||||
height="20"
|
||||
width="20"
|
||||
version="1.2">
|
||||
<metadata
|
||||
id="metadata10">
|
||||
<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="defs8" />
|
||||
<path
|
||||
style="fill:#000000;fill-opacity:0.35294118;stroke:none;stroke-opacity:1"
|
||||
id="path2"
|
||||
d="m 16,5.816 v 1.851 c 0,1.93 -1.57,3.5 -3.5,3.5 -0.827,0 -1.5,0.673 -1.5,1.5 v 1.517 c 1.161,0.415 2,1.514 2,2.816 0,1.654 -1.346,3 -3,3 C 8.346,20 7,18.654 7,17 7,15.698 7.839,14.599 9,14.185 V 12.667 C 9,11.84 8.327,11.167 7.5,11.167 5.57,11.167 4,9.597 4,7.667 V 5.816 C 2.839,5.401 2,4.302 2,3 2,1.346 3.346,0 5,0 6.654,0 8,1.346 8,3 8,4.302 7.161,5.401 6,5.816 v 1.851 c 0,0.827 0.673,1.5 1.5,1.5 0.979,0 1.864,0.407 2.5,1.058 0.636,-0.651 1.521,-1.058 2.5,-1.058 0.827,0 1.5,-0.673 1.5,-1.5 V 5.816 C 12.839,5.401 12,4.302 12,3 c 0,-1.654 1.346,-3 3,-3 1.654,0 3,1.346 3,3 0,1.302 -0.839,2.401 -2,2.816 z M 5,2 C 4.448,2 4,2.449 4,3 4,3.551 4.448,4 5,4 5.552,4 6,3.551 6,3 6,2.449 5.552,2 5,2 Z m 5,16 c 0.552,0 1,-0.449 1,-1 0,-0.551 -0.448,-1 -1,-1 -0.552,0 -1,0.449 -1,1 0,0.551 0.448,1 1,1 z M 15,2 c -0.552,0 -1,0.449 -1,1 0,0.551 0.448,1 1,1 0.552,0 1,-0.449 1,-1 0,-0.551 -0.448,-1 -1,-1 z" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.7 KiB |
@@ -1,31 +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"
|
||||
id="svg4"
|
||||
viewBox="0 0 20 20"
|
||||
height="20"
|
||||
width="20"
|
||||
version="1.2">
|
||||
<metadata
|
||||
id="metadata10">
|
||||
<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="defs8" />
|
||||
<path
|
||||
style="fill:#000000;fill-opacity:0.35294118;stroke:none;stroke-opacity:1"
|
||||
id="path2"
|
||||
d="m 16,14.184 v -1.851 c 0,-1.93 -1.57,-3.5 -3.5,-3.5 -0.827,0 -1.5,-0.673 -1.5,-1.5 V 5.816 C 12.161,5.401 13,4.302 13,3 13,1.346 11.654,0 10,0 8.346,0 7,1.346 7,3 7,4.302 7.839,5.401 9,5.815 v 1.518 c 0,0.827 -0.673,1.5 -1.5,1.5 -1.93,0 -3.5,1.57 -3.5,3.5 v 1.851 C 2.839,14.599 2,15.698 2,17 c 0,1.654 1.346,3 3,3 1.654,0 3,-1.346 3,-3 0,-1.302 -0.839,-2.401 -2,-2.816 v -1.851 c 0,-0.827 0.673,-1.5 1.5,-1.5 0.979,0 1.864,-0.407 2.5,-1.058 0.636,0.651 1.521,1.058 2.5,1.058 0.827,0 1.5,0.673 1.5,1.5 v 1.851 c -1.161,0.415 -2,1.514 -2,2.816 0,1.654 1.346,3 3,3 1.654,0 3,-1.346 3,-3 0,-1.302 -0.839,-2.401 -2,-2.816 z M 5,18 c -0.552,0 -1,-0.449 -1,-1 0,-0.551 0.448,-1 1,-1 0.552,0 1,0.449 1,1 0,0.551 -0.448,1 -1,1 z M 10,2 c 0.552,0 1,0.449 1,1 0,0.551 -0.448,1 -1,1 C 9.448,4 9,3.551 9,3 9,2.449 9.448,2 10,2 Z m 5,16 c -0.552,0 -1,-0.449 -1,-1 0,-0.551 0.448,-1 1,-1 0.552,0 1,0.449 1,1 0,0.551 -0.448,1 -1,1 z" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.7 KiB |
@@ -1,10 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from nw.gui.additions.pageddialog import PagedDialog
|
||||
from nw.gui.additions.qconfiglayout import QConfigLayout
|
||||
from nw.gui.additions.qconfiglayout import QHelpLabel
|
||||
from nw.gui.additions.qswitch import QSwitch
|
||||
|
||||
__all__ = [
|
||||
"PagedDialog",
|
||||
"QConfigLayout",
|
||||
"QHelpLabel",
|
||||
"QSwitch",
|
||||
]
|
||||
|
||||
@@ -130,17 +130,9 @@ class QConfigLayout(QGridLayout):
|
||||
|
||||
qLabel.setIndent(8)
|
||||
if helpText is not None:
|
||||
qHelp = QLabel(str(helpText))
|
||||
qHelp = QHelpLabel(str(helpText), self._helpCol, self._fontScale)
|
||||
qHelp.setIndent(8)
|
||||
|
||||
lblCol = qHelp.palette()
|
||||
lblCol.setColor(QPalette.WindowText, self._helpCol)
|
||||
qHelp.setPalette(lblCol)
|
||||
|
||||
lblFont = qHelp.font()
|
||||
lblFont.setPointSizeF(self._fontScale*lblFont.pointSizeF())
|
||||
qHelp.setFont(lblFont)
|
||||
|
||||
labelBox = QVBoxLayout()
|
||||
labelBox.addWidget(qLabel)
|
||||
labelBox.addWidget(qHelp)
|
||||
@@ -176,3 +168,25 @@ class QConfigLayout(QGridLayout):
|
||||
return self._nextRow - 1
|
||||
|
||||
# END Class QConfigLayout
|
||||
|
||||
class QHelpLabel(QLabel):
|
||||
|
||||
def __init__(self, theText, textCol, fontSize=0.9):
|
||||
QLabel.__init__(self, theText)
|
||||
|
||||
if isinstance(textCol, QColor):
|
||||
qCol = textCol
|
||||
else:
|
||||
qCol = QColor(*textCol)
|
||||
|
||||
lblCol = self.palette()
|
||||
lblCol.setColor(QPalette.WindowText, qCol)
|
||||
self.setPalette(lblCol)
|
||||
|
||||
lblFont = self.font()
|
||||
lblFont.setPointSizeF(fontSize*lblFont.pointSizeF())
|
||||
self.setFont(lblFont)
|
||||
|
||||
return
|
||||
|
||||
# END Class QHelpLabel
|
||||
|
||||
+23
-23
@@ -29,11 +29,14 @@ import logging
|
||||
import nw
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QColor, QPalette
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QGridLayout, QPushButton,
|
||||
QListWidget, QAbstractItemView, QListWidgetItem
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QGridLayout, QPushButton, QLabel,
|
||||
QListWidget, QAbstractItemView, QListWidgetItem, QDialogButtonBox
|
||||
)
|
||||
|
||||
from nw.constants import nwAlert, nwItemType
|
||||
from nw.gui.additions import QHelpLabel
|
||||
from nw.core import NWDoc
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -50,34 +53,31 @@ class GuiDocMerge(QDialog):
|
||||
self.theProject = theProject
|
||||
self.sourceItem = None
|
||||
|
||||
self.outerBox = QHBoxLayout()
|
||||
self.innerBox = QVBoxLayout()
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
self.outerBox = QVBoxLayout()
|
||||
self.setWindowTitle("Merge Documents")
|
||||
self.guiDeco = self.theParent.theTheme.loadDecoration("merge",(64,64))
|
||||
self.outerBox.setSpacing(16)
|
||||
|
||||
self.outerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
|
||||
self.outerBox.addLayout(self.innerBox)
|
||||
|
||||
self.doMergeForm = QGridLayout()
|
||||
self.doMergeForm.setContentsMargins(0,0,0,0)
|
||||
self.headLabel = QLabel("<b>Documents to Merge</b>")
|
||||
self.helpLabel = QHelpLabel(
|
||||
"Drag and drop items to change the order.", self.theParent.theTheme.helpText
|
||||
)
|
||||
|
||||
self.listBox = QListWidget()
|
||||
self.listBox.setDragDropMode(QAbstractItemView.InternalMove)
|
||||
self.listBox.setMinimumWidth(400)
|
||||
self.listBox.setMinimumHeight(180)
|
||||
|
||||
self.mergeButton = QPushButton("Merge")
|
||||
self.mergeButton.clicked.connect(self._doMerge)
|
||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||
self.buttonBox.accepted.connect(self._doMerge)
|
||||
self.buttonBox.rejected.connect(self._doClose)
|
||||
|
||||
self.closeButton = QPushButton("Close")
|
||||
self.closeButton.clicked.connect(self._doClose)
|
||||
|
||||
self.doMergeForm.addWidget(self.listBox, 0, 0, 1, 3)
|
||||
self.doMergeForm.addWidget(self.mergeButton, 1, 1)
|
||||
self.doMergeForm.addWidget(self.closeButton, 1, 2)
|
||||
|
||||
self.innerBox.addLayout(self.doMergeForm)
|
||||
self.outerBox.setSpacing(0)
|
||||
self.outerBox.addWidget(self.headLabel)
|
||||
self.outerBox.addWidget(self.helpLabel)
|
||||
self.outerBox.addSpacing(8)
|
||||
self.outerBox.addWidget(self.listBox)
|
||||
self.outerBox.addSpacing(12)
|
||||
self.outerBox.addWidget(self.buttonBox)
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
self.rejected.connect(self._doClose)
|
||||
self.show()
|
||||
|
||||
+21
-23
@@ -31,9 +31,10 @@ import nw
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QGridLayout, QPushButton, QComboBox,
|
||||
QListWidget, QAbstractItemView, QListWidgetItem
|
||||
QListWidget, QAbstractItemView, QListWidgetItem, QDialogButtonBox, QLabel
|
||||
)
|
||||
from nw.constants import nwAlert, nwItemType, nwItemClass, nwItemLayout
|
||||
from nw.gui.additions import QHelpLabel
|
||||
from nw.core import NWDoc
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -51,22 +52,18 @@ class GuiDocSplit(QDialog):
|
||||
self.optState = self.theProject.optState
|
||||
self.sourceItem = None
|
||||
|
||||
self.outerBox = QHBoxLayout()
|
||||
self.innerBox = QVBoxLayout()
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
self.outerBox = QVBoxLayout()
|
||||
self.setWindowTitle("Split Document")
|
||||
self.guiDeco = self.theParent.theTheme.loadDecoration("split",(64,64))
|
||||
self.outerBox.setSpacing(16)
|
||||
|
||||
self.outerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
|
||||
self.outerBox.addLayout(self.innerBox)
|
||||
|
||||
self.doMergeForm = QGridLayout()
|
||||
self.doMergeForm.setContentsMargins(0,0,0,0)
|
||||
self.headLabel = QLabel("<b>Document Headers</b>")
|
||||
self.helpLabel = QHelpLabel(
|
||||
"Select the maximum level to split into files at.", self.theParent.theTheme.helpText
|
||||
)
|
||||
|
||||
self.listBox = QListWidget()
|
||||
self.listBox.setDragDropMode(QAbstractItemView.NoDragDrop)
|
||||
self.listBox.setMinimumWidth(400)
|
||||
self.listBox.setMinimumHeight(180)
|
||||
|
||||
self.splitLevel = QComboBox(self)
|
||||
self.splitLevel.addItem("Split on Header Level 1 (Title)", 1)
|
||||
@@ -80,18 +77,19 @@ class GuiDocSplit(QDialog):
|
||||
self.splitLevel.setCurrentIndex(spIndex)
|
||||
self.splitLevel.currentIndexChanged.connect(self._populateList)
|
||||
|
||||
self.splitButton = QPushButton("Split")
|
||||
self.splitButton.clicked.connect(self._doSplit)
|
||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||
self.buttonBox.accepted.connect(self._doSplit)
|
||||
self.buttonBox.rejected.connect(self._doClose)
|
||||
|
||||
self.closeButton = QPushButton("Close")
|
||||
self.closeButton.clicked.connect(self._doClose)
|
||||
|
||||
self.doMergeForm.addWidget(self.listBox, 0, 0, 1, 3)
|
||||
self.doMergeForm.addWidget(self.splitLevel, 1, 0, 1, 3)
|
||||
self.doMergeForm.addWidget(self.splitButton, 2, 1)
|
||||
self.doMergeForm.addWidget(self.closeButton, 2, 2)
|
||||
|
||||
self.innerBox.addLayout(self.doMergeForm)
|
||||
self.outerBox.setSpacing(0)
|
||||
self.outerBox.addWidget(self.headLabel)
|
||||
self.outerBox.addWidget(self.helpLabel)
|
||||
self.outerBox.addSpacing(8)
|
||||
self.outerBox.addWidget(self.listBox)
|
||||
self.outerBox.addWidget(self.splitLevel)
|
||||
self.outerBox.addSpacing(12)
|
||||
self.outerBox.addWidget(self.buttonBox)
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
self.rejected.connect(self._doClose)
|
||||
self.show()
|
||||
|
||||
@@ -99,10 +99,7 @@ class GuiIcons:
|
||||
|
||||
DECO_MAP = {
|
||||
"nwicon" : ["icons", "novelWriter.svg"],
|
||||
"export" : ["graphics", "export.svg"],
|
||||
"merge" : ["graphics", "merge.svg"],
|
||||
"settings" : ["graphics", "gear.svg"],
|
||||
"split" : ["graphics", "split.svg"],
|
||||
}
|
||||
|
||||
def __init__(self, theParent):
|
||||
|
||||
Reference in New Issue
Block a user