Merge pull request #218 from vkbo/gui-updates
Preferences and Open Project changes
This commit is contained in:
@@ -0,0 +1,252 @@
|
||||
<?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:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
inkscape:export-ydpi="3"
|
||||
inkscape:export-xdpi="3"
|
||||
inkscape:export-filename="/home/vkbo/Code/novelWriter/Icons/novelWriter-32.png"
|
||||
width="1024"
|
||||
height="1024"
|
||||
viewBox="0 0 270.93333 270.93334"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
|
||||
sodipodi:docname="mimetype-nwx.svg">
|
||||
<defs
|
||||
id="defs2">
|
||||
<linearGradient
|
||||
id="linearGradient2515"
|
||||
inkscape:collect="always">
|
||||
<stop
|
||||
id="stop2511"
|
||||
offset="0"
|
||||
style="stop-color:#f7f7f7;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop2513"
|
||||
offset="1"
|
||||
style="stop-color:#e5e5e5;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<rect
|
||||
id="rect852"
|
||||
height="65.785888"
|
||||
width="130.57787"
|
||||
y="205.79962"
|
||||
x="60.484347" />
|
||||
<rect
|
||||
x="13.463703"
|
||||
y="18.019813"
|
||||
width="177.70083"
|
||||
height="28.631245"
|
||||
id="rect1474" />
|
||||
<rect
|
||||
x="60.484348"
|
||||
y="205.79962"
|
||||
width="130.57787"
|
||||
height="65.785889"
|
||||
id="rect852-7" />
|
||||
<rect
|
||||
x="60.484348"
|
||||
y="205.79962"
|
||||
width="130.57787"
|
||||
height="65.785889"
|
||||
id="rect1544" />
|
||||
<rect
|
||||
id="rect1570"
|
||||
height="65.785889"
|
||||
width="130.57787"
|
||||
y="205.79962"
|
||||
x="60.484348" />
|
||||
<rect
|
||||
id="rect1587"
|
||||
height="28.631245"
|
||||
width="177.70083"
|
||||
y="18.019813"
|
||||
x="13.463703" />
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB"
|
||||
inkscape:label="Drop Shadow"
|
||||
id="filter1444">
|
||||
<feFlood
|
||||
flood-opacity="0.498039"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood"
|
||||
id="feFlood1434" />
|
||||
<feComposite
|
||||
in="flood"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
result="composite1"
|
||||
id="feComposite1436" />
|
||||
<feGaussianBlur
|
||||
in="composite1"
|
||||
stdDeviation="3"
|
||||
result="blur"
|
||||
id="feGaussianBlur1438" />
|
||||
<feOffset
|
||||
dx="6"
|
||||
dy="6"
|
||||
result="offset"
|
||||
id="feOffset1440" />
|
||||
<feComposite
|
||||
in="SourceGraphic"
|
||||
in2="offset"
|
||||
operator="over"
|
||||
result="composite2"
|
||||
id="feComposite1442" />
|
||||
</filter>
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB"
|
||||
inkscape:label="Drop Shadow"
|
||||
id="filter1456">
|
||||
<feFlood
|
||||
flood-opacity="0.498039"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood"
|
||||
id="feFlood1446" />
|
||||
<feComposite
|
||||
in="flood"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
result="composite1"
|
||||
id="feComposite1448" />
|
||||
<feGaussianBlur
|
||||
in="composite1"
|
||||
stdDeviation="3"
|
||||
result="blur"
|
||||
id="feGaussianBlur1450" />
|
||||
<feOffset
|
||||
dx="6"
|
||||
dy="6"
|
||||
result="offset"
|
||||
id="feOffset1452" />
|
||||
<feComposite
|
||||
in="SourceGraphic"
|
||||
in2="offset"
|
||||
operator="over"
|
||||
result="composite2"
|
||||
id="feComposite1454" />
|
||||
</filter>
|
||||
<radialGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(2.4110274,1.7617596,-0.719517,0.98463462,-776.23441,-1372.7537)"
|
||||
r="410"
|
||||
fy="623.97186"
|
||||
fx="605.42725"
|
||||
cy="623.97186"
|
||||
cx="605.42725"
|
||||
id="radialGradient2517"
|
||||
xlink:href="#linearGradient2515"
|
||||
inkscape:collect="always" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.7"
|
||||
inkscape:cx="505.1269"
|
||||
inkscape:cy="568.88259"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer3"
|
||||
inkscape:document-rotation="0"
|
||||
showgrid="false"
|
||||
units="px"
|
||||
inkscape:pagecheckerboard="true"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1344"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<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>
|
||||
<g
|
||||
style="display:inline"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer3"
|
||||
inkscape:label="Sheet">
|
||||
<path
|
||||
id="rect1481"
|
||||
style="fill:url(#radialGradient2517);fill-opacity:1;stroke:#999999;stroke-width:20;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 192,22 c -44.32,0 -80,35.680002 -80,80 v 820 c 0,44.32002 35.68,80 80,80 h 640 c 44.31999,0 80,-35.67998 80,-80 V 213.44727 L 720.55469,22 Z"
|
||||
transform="scale(0.26458333)"
|
||||
inkscape:label="Page"
|
||||
clip-path="none" />
|
||||
<path
|
||||
d="M 241.30037,56.474215 190.64713,5.8204593 V 35.307549 c 0,11.726333 9.44034,21.166666 21.16667,21.166666 z"
|
||||
style="display:inline;fill:#e0e0e0;fill-opacity:1;stroke:#999999;stroke-width:5.29167;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path1490"
|
||||
inkscape:label="Corner" />
|
||||
<g
|
||||
inkscape:label=".nwx"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect852);display:inline;fill:#666666;fill-opacity:1"
|
||||
id="text850"
|
||||
transform="matrix(1.7893481,0,0,1.782571,-45.41919,-191.90571)"
|
||||
aria-label=".nwx">
|
||||
<path
|
||||
inkscape:label="dot"
|
||||
id="path856"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:42.3333px;font-family:Roboto;-inkscape-font-specification:'Roboto, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#666666;fill-opacity:1"
|
||||
d="m 63.088865,241.76928 q 0,-1.36426 0.909505,-2.27376 0.930175,-0.93018 2.480467,-0.93018 1.550291,0 2.459796,0.93018 0.909504,0.9095 0.909504,2.27376 0,1.34359 -0.909504,2.27376 -0.909505,0.9095 -2.459796,0.9095 -1.550292,0 -2.480467,-0.9095 -0.909505,-0.93017 -0.909505,-2.27376 z" />
|
||||
<path
|
||||
inkscape:label="n"
|
||||
id="path858"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:42.3333px;font-family:Roboto;-inkscape-font-specification:'Roboto, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#666666;fill-opacity:1"
|
||||
d="m 84.75161,226.78312 q -2.542479,0 -3.782712,2.14974 v 15.79231 h -5.973791 v -22.36554 h 5.601721 l 0.206705,2.56314 q 2.397785,-2.97656 6.428544,-2.97656 3.162595,0 5.105627,1.88103 1.943033,1.88102 1.963703,6.55256 v 14.34537 h -5.994461 v -14.26269 q 0,-2.14973 -0.930175,-2.91454 -0.909505,-0.76482 -2.625161,-0.76482 z" />
|
||||
<path
|
||||
inkscape:label="w"
|
||||
id="path860"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:42.3333px;font-family:Roboto;-inkscape-font-specification:'Roboto, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#666666;fill-opacity:1"
|
||||
d="m 126.96089,222.35963 -5.68441,22.36554 h -5.00227 l -4.25814,-14.07665 -4.23746,14.07665 h -4.9816 l -5.705078,-22.36554 h 5.767088 l 2.95589,14.22134 4.05143,-14.22134 h 4.32014 l 4.09277,14.20067 2.91455,-14.20067 z" />
|
||||
<path
|
||||
inkscape:label="x"
|
||||
id="path862"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:42.3333px;font-family:Roboto;-inkscape-font-specification:'Roboto, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#666666;fill-opacity:1"
|
||||
d="m 134.77436,222.35963 3.65869,6.65592 3.76204,-6.65592 h 6.3872 l -6.36653,10.93472 6.63525,11.43082 h -6.3872 l -4.01009,-7.04866 -3.94808,7.04866 h -6.42854 l 6.63525,-11.43082 -6.36654,-10.93472 z" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
inkscape:label="Logo"
|
||||
transform="matrix(1.2371037,0,0,1.2371037,206.3182,37.341857)"
|
||||
id="g2509">
|
||||
<path
|
||||
d="m 145.18984,56.414257 c -44.32,0 -79.999998,35.68 -79.999998,80.000003 v 199.99805 a 279.99999,279.99999 0 0 0 0,0.002 279.99999,279.99999 0 0 0 0,0.0195 v 199.98242 c 0,44.31999 35.679998,80 79.999998,80 44.32,0 80,-35.68001 80,-80 v -200 a 120,120 0 0 1 120,-120 120,120 0 0 1 120,120 v 282.83592 h 160 V 336.41621 a 279.99999,279.99999 0 0 0 -280,-280.000003 279.99999,279.99999 0 0 0 -0.81055,0 279.99999,279.99999 0 0 0 -133.46484,34.29688 c -14.4245,-20.75262 -38.42829,-34.29883 -65.72461,-34.29883 z M 376.65078,619.64082 c -0.62174,0.0972 -1.2172,0.22317 -1.7793,0.37696 0.5621,-0.15379 1.15756,-0.27973 1.7793,-0.37696 z m -1.7793,0.37696 c -0.5621,0.15378 -1.09071,0.33534 -1.58008,0.53906 0.48937,-0.20372 1.01798,-0.38528 1.58008,-0.53906 z m 338.85742,-0.37696 c 0.62174,0.0972 1.2172,0.22317 1.7793,0.37696 -0.5621,-0.15379 -1.15756,-0.27973 -1.7793,-0.37696 z m 1.7793,0.37696 c 0.5621,0.15378 1.09071,0.33534 1.58008,0.53906 -0.48938,-0.20372 -1.01798,-0.38528 -1.58008,-0.53906 z"
|
||||
inkscape:label="n"
|
||||
style="display:inline;fill:#a11212;fill-opacity:1;stroke:#7e1b1b;stroke-width:9.99999;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter1444)"
|
||||
id="rect1406-1"
|
||||
transform="matrix(0.16895991,0,0,0.18329422,-134.6942,-19.491243)" />
|
||||
<path
|
||||
d="m 465.18984,619.25215 v 0.16406 h -85.58398 c -5.49302,0 -9.91602,2.2329 -9.91602,5.00586 0,0.52294 0.15913,1.02696 0.45117,1.5 h -0.44531 c 0.30916,2.03607 1.24102,3.99791 2.81641,5.57227 l 165.59961,165.49414 c 3.92061,3.91808 10.23371,3.91812 14.15429,0 L 717.86757,631.49434 c 1.57569,-1.57463 2.50725,-3.53578 2.81641,-5.57227 h -0.44531 c 0.29216,-0.47304 0.45117,-0.97706 0.45117,-1.5 0,-2.77296 -4.42304,-5.00586 -9.91602,-5.00586 h -85.58398 v -0.16406 z"
|
||||
inkscape:label="Arrow"
|
||||
style="display:inline;fill:#730d0d;fill-opacity:1;stroke:#590d0d;stroke-width:9.99999;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter1456)"
|
||||
id="path897"
|
||||
transform="matrix(0.16895991,0,0,0.18329422,-134.6942,-19.491243)" />
|
||||
<rect
|
||||
inkscape:label="Highlight"
|
||||
ry="3.6658845"
|
||||
rx="3.3791983"
|
||||
y="1.2969339"
|
||||
x="-118.27303"
|
||||
height="82.482399"
|
||||
width="6.7583966"
|
||||
id="rect914"
|
||||
style="display:inline;fill:#c32222;fill-opacity:1;stroke:none;stroke-width:1.75982;stroke-linejoin:round;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 11 KiB |
@@ -64,7 +64,7 @@ class GuiConfigEditor(PagedDialog):
|
||||
|
||||
self.addTab(self.tabGeneral, "General")
|
||||
self.addTab(self.tabLayout, "Layout")
|
||||
self.addTab(self.tabEditing, "Editing")
|
||||
self.addTab(self.tabEditing, "Editor")
|
||||
self.addTab(self.tabAutoRep, "Auto-Replace")
|
||||
|
||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||
@@ -174,22 +174,6 @@ class GuiConfigEditGeneralTab(QWidget):
|
||||
"Changing this requires restarting %s." % nw.__package__
|
||||
)
|
||||
|
||||
## Syntax Highlighting
|
||||
self.selectSyntax = QComboBox()
|
||||
self.selectSyntax.setMinimumWidth(200)
|
||||
self.theSyntaxes = self.theTheme.listSyntax()
|
||||
for syntaxFile, syntaxName in self.theSyntaxes:
|
||||
self.selectSyntax.addItem(syntaxName, syntaxFile)
|
||||
syntaxIdx = self.selectSyntax.findData(self.mainConf.guiSyntax)
|
||||
if syntaxIdx != -1:
|
||||
self.selectSyntax.setCurrentIndex(syntaxIdx)
|
||||
|
||||
self.mainForm.addRow(
|
||||
"Syntax highlight theme",
|
||||
self.selectSyntax,
|
||||
""
|
||||
)
|
||||
|
||||
## Dark Icons
|
||||
self.preferDarkIcons = QSwitch()
|
||||
self.preferDarkIcons.setChecked(self.mainConf.guiDark)
|
||||
@@ -210,13 +194,6 @@ class GuiConfigEditGeneralTab(QWidget):
|
||||
self.showFullPath
|
||||
)
|
||||
|
||||
self.highlightQuotes = QSwitch()
|
||||
self.highlightQuotes.setChecked(self.mainConf.highlightQuotes)
|
||||
self.mainForm.addRow(
|
||||
"Add highlighting to text in quotes",
|
||||
self.highlightQuotes
|
||||
)
|
||||
|
||||
# AutoSave Settings
|
||||
# =================
|
||||
self.mainForm.addGroupLabel("Automatic Save")
|
||||
@@ -287,11 +264,9 @@ class GuiConfigEditGeneralTab(QWidget):
|
||||
needsRestart = False
|
||||
|
||||
guiTheme = self.selectTheme.currentData()
|
||||
guiSyntax = self.selectSyntax.currentData()
|
||||
guiIcons = self.selectIcons.currentData()
|
||||
guiDark = self.preferDarkIcons.isChecked()
|
||||
showFullPath = self.showFullPath.isChecked()
|
||||
highlightQuotes = self.highlightQuotes.isChecked()
|
||||
autoSaveDoc = self.autoSaveDoc.value()
|
||||
autoSaveProj = self.autoSaveProj.value()
|
||||
backupPath = self.backupPath
|
||||
@@ -303,11 +278,9 @@ class GuiConfigEditGeneralTab(QWidget):
|
||||
needsRestart |= self.mainConf.guiIcons != guiIcons
|
||||
|
||||
self.mainConf.guiTheme = guiTheme
|
||||
self.mainConf.guiSyntax = guiSyntax
|
||||
self.mainConf.guiIcons = guiIcons
|
||||
self.mainConf.guiDark = guiDark
|
||||
self.mainConf.showFullPath = showFullPath
|
||||
self.mainConf.highlightQuotes = highlightQuotes
|
||||
self.mainConf.autoSaveDoc = autoSaveDoc
|
||||
self.mainConf.autoSaveProj = autoSaveProj
|
||||
self.mainConf.backupPath = backupPath
|
||||
@@ -530,6 +503,33 @@ class GuiConfigEditEditingTab(QWidget):
|
||||
self.mainForm.setHelpTextStyle(self.theTheme.helpText)
|
||||
self.setLayout(self.mainForm)
|
||||
|
||||
# Spell Checking
|
||||
# ==============
|
||||
self.mainForm.addGroupLabel("Syntax Highlighting")
|
||||
|
||||
## Syntax Highlighting
|
||||
self.selectSyntax = QComboBox()
|
||||
self.selectSyntax.setMinimumWidth(200)
|
||||
self.theSyntaxes = self.theTheme.listSyntax()
|
||||
for syntaxFile, syntaxName in self.theSyntaxes:
|
||||
self.selectSyntax.addItem(syntaxName, syntaxFile)
|
||||
syntaxIdx = self.selectSyntax.findData(self.mainConf.guiSyntax)
|
||||
if syntaxIdx != -1:
|
||||
self.selectSyntax.setCurrentIndex(syntaxIdx)
|
||||
|
||||
self.mainForm.addRow(
|
||||
"Highlight theme",
|
||||
self.selectSyntax,
|
||||
""
|
||||
)
|
||||
|
||||
self.highlightQuotes = QSwitch()
|
||||
self.highlightQuotes.setChecked(self.mainConf.highlightQuotes)
|
||||
self.mainForm.addRow(
|
||||
"Highlight text wrapped in quotes",
|
||||
self.highlightQuotes
|
||||
)
|
||||
|
||||
# Spell Checking
|
||||
# ==============
|
||||
self.mainForm.addGroupLabel("Spell Checking")
|
||||
@@ -583,13 +583,17 @@ class GuiConfigEditEditingTab(QWidget):
|
||||
validEntries = True
|
||||
needsRestart = False
|
||||
|
||||
spellTool = self.spellToolList.currentData()
|
||||
spellLanguage = self.spellLangList.currentData()
|
||||
bigDocLimit = self.bigDocLimit.value()
|
||||
guiSyntax = self.selectSyntax.currentData()
|
||||
highlightQuotes = self.highlightQuotes.isChecked()
|
||||
spellTool = self.spellToolList.currentData()
|
||||
spellLanguage = self.spellLangList.currentData()
|
||||
bigDocLimit = self.bigDocLimit.value()
|
||||
|
||||
self.mainConf.spellTool = spellTool
|
||||
self.mainConf.spellLanguage = spellLanguage
|
||||
self.mainConf.bigDocLimit = bigDocLimit
|
||||
self.mainConf.guiSyntax = guiSyntax
|
||||
self.mainConf.highlightQuotes = highlightQuotes
|
||||
self.mainConf.spellTool = spellTool
|
||||
self.mainConf.spellLanguage = spellLanguage
|
||||
self.mainConf.bigDocLimit = bigDocLimit
|
||||
|
||||
self.mainConf.confChanged = True
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ from datetime import datetime
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QGridLayout, QPushButton, QTreeWidget,
|
||||
QAbstractItemView, QTreeWidgetItem
|
||||
QAbstractItemView, QTreeWidgetItem, QDialogButtonBox, QLabel
|
||||
)
|
||||
|
||||
from nw.common import formatInt
|
||||
@@ -42,25 +42,33 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class GuiProjectLoad(QDialog):
|
||||
|
||||
NONE_STATE = 0
|
||||
BROWSE_STATE = 1
|
||||
NEW_STATE = 2
|
||||
OPEN_STATE = 3
|
||||
|
||||
def __init__(self, theParent):
|
||||
QDialog.__init__(self, theParent)
|
||||
|
||||
logger.debug("Initialising GuiProjectLoad ...")
|
||||
|
||||
self.mainConf = nw.CONFIG
|
||||
self.theParent = theParent
|
||||
self.sourceItem = None
|
||||
self.openPath = None
|
||||
self.mainConf = nw.CONFIG
|
||||
self.theParent = theParent
|
||||
self.openState = self.NONE_STATE
|
||||
self.openPath = None
|
||||
|
||||
self.outerBox = QVBoxLayout()
|
||||
self.innerBox = QHBoxLayout()
|
||||
self.outerBox.setSpacing(16)
|
||||
self.innerBox.setSpacing(16)
|
||||
|
||||
self.outerBox = QHBoxLayout()
|
||||
self.innerBox = QVBoxLayout()
|
||||
self.setWindowTitle("Open Project")
|
||||
self.setLayout(self.outerBox)
|
||||
self.setMinimumWidth(650)
|
||||
self.setMinimumHeight(400)
|
||||
self.setModal(True)
|
||||
|
||||
self.guiDeco = self.theParent.theTheme.loadDecoration("nwicon", (128, 128))
|
||||
|
||||
self.outerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
|
||||
self.outerBox.addLayout(self.innerBox)
|
||||
self.guiDeco = self.theParent.theTheme.loadDecoration("nwicon", (96, 96))
|
||||
self.innerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
|
||||
|
||||
self.projectForm = QGridLayout()
|
||||
self.projectForm.setContentsMargins(0, 0, 0, 0)
|
||||
@@ -71,34 +79,45 @@ class GuiProjectLoad(QDialog):
|
||||
self.listBox.setColumnCount(4)
|
||||
self.listBox.setHeaderLabels(["Working Title","Words","Last Opened","Path"])
|
||||
self.listBox.setRootIsDecorated(False)
|
||||
self.listBox.setColumnHidden(3, True)
|
||||
self.listBox.itemClicked.connect(self._doSelectRecent)
|
||||
self.listBox.itemDoubleClicked.connect(self._doOpenRecent)
|
||||
|
||||
treeHead = self.listBox.headerItem()
|
||||
treeHead.setTextAlignment(1, Qt.AlignRight)
|
||||
treeHead.setTextAlignment(2, Qt.AlignRight)
|
||||
|
||||
self.recentButton = QPushButton("Open")
|
||||
self.recentButton.clicked.connect(self._doOpenRecent)
|
||||
self.browseButton = QPushButton("Browse")
|
||||
self.browseButton.clicked.connect(self._doBrowse)
|
||||
self.closeButton = QPushButton("Close")
|
||||
self.closeButton.clicked.connect(self._doClose)
|
||||
self.lblRecent = QLabel("<b>Recently Opened:</b>")
|
||||
self.lblPath = QLabel("<b>Path:</b>")
|
||||
self.selPath = QLabel("")
|
||||
self.selPath.setWordWrap(True)
|
||||
|
||||
self.projectForm.addWidget(self.listBox, 0, 0, 1, 4)
|
||||
self.projectForm.addWidget(self.recentButton, 1, 1)
|
||||
self.projectForm.addWidget(self.browseButton, 1, 2)
|
||||
self.projectForm.addWidget(self.closeButton, 1, 3)
|
||||
self.projectForm.setColumnStretch(0, 1)
|
||||
self.projectForm.addWidget(self.lblRecent, 0, 0, 1, 2)
|
||||
self.projectForm.addWidget(self.listBox, 1, 0, 1, 2)
|
||||
self.projectForm.addWidget(self.lblPath, 2, 0, 1, 1, Qt.AlignTop)
|
||||
self.projectForm.addWidget(self.selPath, 2, 1, 1, 1, Qt.AlignTop)
|
||||
self.projectForm.setColumnStretch(1, 1)
|
||||
self.projectForm.setVerticalSpacing(4)
|
||||
self.projectForm.setHorizontalSpacing(8)
|
||||
|
||||
self.innerBox.addLayout(self.projectForm)
|
||||
|
||||
self.rejected.connect(self._doClose)
|
||||
self.setModal(True)
|
||||
self.setMinimumWidth(750)
|
||||
self.setMinimumHeight(450)
|
||||
self.show()
|
||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Open | QDialogButtonBox.Cancel)
|
||||
self.buttonBox.accepted.connect(self._doOpenRecent)
|
||||
self.buttonBox.rejected.connect(self._doClose)
|
||||
|
||||
self.newButton = self.buttonBox.addButton("New", QDialogButtonBox.ActionRole)
|
||||
self.newButton.clicked.connect(self._doNewProject)
|
||||
|
||||
self.browseButton = self.buttonBox.addButton("Browse", QDialogButtonBox.ActionRole)
|
||||
self.browseButton.clicked.connect(self._doBrowse)
|
||||
|
||||
self.outerBox.addLayout(self.innerBox)
|
||||
self.outerBox.addWidget(self.buttonBox)
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
self._populateList()
|
||||
self._doSelectRecent()
|
||||
|
||||
logger.debug("GuiProjectLoad initialisation complete")
|
||||
|
||||
@@ -116,10 +135,19 @@ class GuiProjectLoad(QDialog):
|
||||
selItems = self.listBox.selectedItems()
|
||||
if selItems:
|
||||
self.openPath = selItems[0].text(3)
|
||||
self.openState = self.OPEN_STATE
|
||||
self.accept()
|
||||
else:
|
||||
self.openPath = None
|
||||
self.openState = self.NONE_STATE
|
||||
return
|
||||
|
||||
def _doSelectRecent(self):
|
||||
"""A recent item has been selected.
|
||||
"""
|
||||
selList = self.listBox.selectedItems()
|
||||
if selList:
|
||||
self.selPath.setText(selList[0].text(3))
|
||||
return
|
||||
|
||||
def _doBrowse(self):
|
||||
@@ -129,6 +157,7 @@ class GuiProjectLoad(QDialog):
|
||||
logger.verbose("GuiProjectLoad browse button clicked")
|
||||
self._saveDialogState()
|
||||
self.openPath = None
|
||||
self.openState = self.BROWSE_STATE
|
||||
self.accept()
|
||||
return
|
||||
|
||||
@@ -140,6 +169,16 @@ class GuiProjectLoad(QDialog):
|
||||
self.close()
|
||||
return
|
||||
|
||||
def _doNewProject(self):
|
||||
"""Create a new project.
|
||||
"""
|
||||
logger.verbose("GuiProjectLoad new project button clicked")
|
||||
self._saveDialogState()
|
||||
self.openPath = None
|
||||
self.openState = self.NEW_STATE
|
||||
self.accept()
|
||||
return
|
||||
|
||||
##
|
||||
# Internal Functions
|
||||
##
|
||||
@@ -156,7 +195,6 @@ class GuiProjectLoad(QDialog):
|
||||
def _populateList(self):
|
||||
"""Populate the list box with recent project data.
|
||||
"""
|
||||
|
||||
listOrder = []
|
||||
listData = {}
|
||||
for projPath in self.mainConf.recentProj.keys():
|
||||
@@ -178,6 +216,7 @@ class GuiProjectLoad(QDialog):
|
||||
hasSelection = False
|
||||
for timeStamp in sorted(listOrder, reverse=True):
|
||||
newItem = QTreeWidgetItem([""]*4)
|
||||
newItem.setIcon(0, self.theParent.theTheme.getIcon("proj_nwx"))
|
||||
newItem.setText(0, listData[timeStamp][0])
|
||||
newItem.setText(1, formatInt(listData[timeStamp][1]))
|
||||
newItem.setText(2, datetime.fromtimestamp(timeStamp).strftime("%x %X"))
|
||||
|
||||
+5
-2
@@ -76,6 +76,7 @@ class GuiIcons:
|
||||
"cls_trash" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"proj_document" : (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"proj_folder" : (QStyle.SP_DirIcon, "folder"),
|
||||
"proj_nwx" : (None, None),
|
||||
"status_lang" : (None, None),
|
||||
"status_time" : (None, None),
|
||||
"status_stats" : (None, None),
|
||||
@@ -295,8 +296,10 @@ class GuiIcons:
|
||||
# Finally. we check if we have a fallback icon
|
||||
if self.mainConf.guiDark:
|
||||
fbackIcon = path.join(self.mainConf.iconPath, self.fbackName, "%s-dark.svg" % iconKey)
|
||||
else:
|
||||
fbackIcon = path.join(self.mainConf.iconPath, self.fbackName, "%s.svg" % iconKey)
|
||||
if path.isfile(fbackIcon):
|
||||
logger.verbose("Loading icon '%s' from fallback theme" % iconKey)
|
||||
return QIcon(fbackIcon)
|
||||
fbackIcon = path.join(self.mainConf.iconPath, self.fbackName, "%s.svg" % iconKey)
|
||||
if path.isfile(fbackIcon):
|
||||
logger.verbose("Loading icon '%s' from fallback theme" % iconKey)
|
||||
return QIcon(fbackIcon)
|
||||
|
||||
+5
-5
@@ -212,7 +212,7 @@ class GuiMainStatus(QStatusBar):
|
||||
sWC = self.sessWords,
|
||||
))
|
||||
self.statsText.setText((
|
||||
"D:{wC:n} P:{pWC:n} S:{sWC:n}"
|
||||
"D:{wC:n} P:{pWC:n} ({sWC:+n})"
|
||||
).format(
|
||||
wC = self.wordCount,
|
||||
pWC = self.projWords,
|
||||
@@ -243,10 +243,10 @@ class StatusLED(QAbstractButton):
|
||||
def __init__(self, colNone, colTrue, colFalse, sW, sH, parent=None):
|
||||
super().__init__(parent=parent)
|
||||
|
||||
self.colNone = colNone
|
||||
self.colTrue = colTrue
|
||||
self.colFalse = colFalse
|
||||
self._theCol = colNone
|
||||
self.colNone = colNone
|
||||
self.colTrue = colTrue
|
||||
self.colFalse = colFalse
|
||||
self._theCol = colNone
|
||||
|
||||
self.setFixedWidth(sW)
|
||||
self.setFixedHeight(sH)
|
||||
|
||||
+6
-1
@@ -262,7 +262,12 @@ class GuiMain(QMainWindow):
|
||||
dlgProj = GuiProjectLoad(self)
|
||||
dlgProj.exec_()
|
||||
if dlgProj.result() == QDialog.Accepted:
|
||||
self.openProject(dlgProj.openPath)
|
||||
if dlgProj.openState == GuiProjectLoad.OPEN_STATE:
|
||||
self.openProject(dlgProj.openPath)
|
||||
elif dlgProj.openState == GuiProjectLoad.BROWSE_STATE:
|
||||
self.openProject(dlgProj.openPath)
|
||||
elif dlgProj.openState == GuiProjectLoad.NEW_STATE:
|
||||
self.newProject()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user