Clean up warnings and deprecations in gui tools
This commit is contained in:
@@ -399,14 +399,6 @@ class Config:
|
||||
# Methods
|
||||
##
|
||||
|
||||
def pxInt(self, value: int) -> int:
|
||||
"""Deprecated. Do not use."""
|
||||
return value
|
||||
|
||||
def rpxInt(self, value: int) -> int:
|
||||
"""Deprecated. Do not use."""
|
||||
return value
|
||||
|
||||
def homePath(self) -> Path:
|
||||
"""The user's home folder."""
|
||||
return self._homePath
|
||||
|
||||
@@ -57,12 +57,9 @@ class GuiDictionaries(NNonBlockingDialog):
|
||||
self._currDicts = set()
|
||||
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
iPx = CONFIG.pxInt(4)
|
||||
mPx = CONFIG.pxInt(8)
|
||||
sPx = CONFIG.pxInt(16)
|
||||
|
||||
self.setMinimumWidth(CONFIG.pxInt(500))
|
||||
self.setMinimumHeight(CONFIG.pxInt(300))
|
||||
self.setMinimumWidth(500)
|
||||
self.setMinimumHeight(300)
|
||||
|
||||
# Hunspell Dictionaries
|
||||
foUrl = "https://www.freeoffice.com/en/download/dictionaries"
|
||||
@@ -84,7 +81,7 @@ class GuiDictionaries(NNonBlockingDialog):
|
||||
self.huPathBox = QHBoxLayout()
|
||||
self.huPathBox.addWidget(self.huInput)
|
||||
self.huPathBox.addWidget(self.huBrowse)
|
||||
self.huPathBox.setSpacing(iPx)
|
||||
self.huPathBox.setSpacing(4)
|
||||
self.huAddBox = QHBoxLayout()
|
||||
self.huAddBox.addStretch(1)
|
||||
self.huAddBox.addWidget(self.huImport)
|
||||
@@ -99,7 +96,7 @@ class GuiDictionaries(NNonBlockingDialog):
|
||||
self.inBox = QHBoxLayout()
|
||||
self.inBox.addWidget(self.inPath)
|
||||
self.inBox.addWidget(self.inBrowse)
|
||||
self.inBox.setSpacing(iPx)
|
||||
self.inBox.setSpacing(4)
|
||||
|
||||
# Info Box
|
||||
self.infoBox = QPlainTextEdit(self)
|
||||
@@ -116,17 +113,17 @@ class GuiDictionaries(NNonBlockingDialog):
|
||||
self.innerBox.addWidget(self.huInfo)
|
||||
self.innerBox.addLayout(self.huPathBox)
|
||||
self.innerBox.addLayout(self.huAddBox)
|
||||
self.innerBox.addSpacing(mPx)
|
||||
self.innerBox.addSpacing(8)
|
||||
self.innerBox.addWidget(self.inInfo)
|
||||
self.innerBox.addLayout(self.inBox)
|
||||
self.innerBox.addWidget(self.infoBox)
|
||||
self.innerBox.setSpacing(iPx)
|
||||
self.innerBox.setSpacing(4)
|
||||
|
||||
self.outerBox = QVBoxLayout()
|
||||
self.outerBox.addLayout(self.innerBox, 0)
|
||||
self.outerBox.addStretch(1)
|
||||
self.outerBox.addWidget(self.buttonBox, 0)
|
||||
self.outerBox.setSpacing(sPx)
|
||||
self.outerBox.setSpacing(16)
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
|
||||
+10
-11
@@ -52,18 +52,15 @@ class GuiLipsum(NDialog):
|
||||
|
||||
self._lipsumText = ""
|
||||
|
||||
vSp = CONFIG.pxInt(4)
|
||||
nPx = CONFIG.pxInt(64)
|
||||
|
||||
self.innerBox = QHBoxLayout()
|
||||
self.innerBox.setSpacing(CONFIG.pxInt(16))
|
||||
self.innerBox.setSpacing(16)
|
||||
|
||||
# Icon
|
||||
self.docIcon = QLabel(self)
|
||||
self.docIcon.setPixmap(SHARED.theme.getPixmap("text", (nPx, nPx), "blue"))
|
||||
self.docIcon.setPixmap(SHARED.theme.getPixmap("text", (64, 64), "blue"))
|
||||
|
||||
self.leftBox = QVBoxLayout()
|
||||
self.leftBox.setSpacing(vSp)
|
||||
self.leftBox.setSpacing(4)
|
||||
self.leftBox.addWidget(self.docIcon)
|
||||
self.leftBox.addStretch(1)
|
||||
self.innerBox.addLayout(self.leftBox)
|
||||
@@ -87,7 +84,7 @@ class GuiLipsum(NDialog):
|
||||
self.formBox.addWidget(self.paraCount, 1, 1, 1, 1, QtAlignRight)
|
||||
self.formBox.addWidget(self.randLabel, 2, 0, 1, 1, QtAlignLeft)
|
||||
self.formBox.addWidget(self.randSwitch, 2, 1, 1, 1, QtAlignRight)
|
||||
self.formBox.setVerticalSpacing(vSp)
|
||||
self.formBox.setVerticalSpacing(4)
|
||||
self.formBox.setRowStretch(3, 1)
|
||||
self.innerBox.addLayout(self.formBox)
|
||||
|
||||
@@ -96,17 +93,19 @@ class GuiLipsum(NDialog):
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
|
||||
self.btnClose = self.buttonBox.addButton(QtDialogClose)
|
||||
self.btnClose.setAutoDefault(False)
|
||||
if self.btnClose:
|
||||
self.btnClose.setAutoDefault(False)
|
||||
|
||||
self.btnInsert = self.buttonBox.addButton(self.tr("Insert"), QtRoleAction)
|
||||
self.btnInsert.clicked.connect(self._doInsert)
|
||||
self.btnInsert.setAutoDefault(False)
|
||||
if self.btnInsert:
|
||||
self.btnInsert.clicked.connect(self._doInsert)
|
||||
self.btnInsert.setAutoDefault(False)
|
||||
|
||||
# Assemble
|
||||
self.outerBox = QVBoxLayout()
|
||||
self.outerBox.addLayout(self.innerBox)
|
||||
self.outerBox.addWidget(self.buttonBox)
|
||||
self.outerBox.setSpacing(CONFIG.pxInt(16))
|
||||
self.outerBox.setSpacing(16)
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
logger.debug("Ready: GuiLipsum")
|
||||
|
||||
@@ -35,7 +35,7 @@ from PyQt6.QtWidgets import (
|
||||
QPushButton, QSplitter, QVBoxLayout, QWidget
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.common import makeFileNameSafe, openExternalPath
|
||||
from novelwriter.constants import nwLabels
|
||||
from novelwriter.core.buildsettings import BuildSettings
|
||||
@@ -68,21 +68,16 @@ class GuiManuscriptBuild(NDialog):
|
||||
self._build = build
|
||||
|
||||
self.setWindowTitle(self.tr("Build Manuscript"))
|
||||
self.setMinimumWidth(CONFIG.pxInt(500))
|
||||
self.setMinimumHeight(CONFIG.pxInt(300))
|
||||
self.setMinimumWidth(500)
|
||||
self.setMinimumHeight(300)
|
||||
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
bSz = SHARED.theme.buttonIconSize
|
||||
sp4 = CONFIG.pxInt(4)
|
||||
sp8 = CONFIG.pxInt(8)
|
||||
sp16 = CONFIG.pxInt(16)
|
||||
wWin = CONFIG.pxInt(620)
|
||||
hWin = CONFIG.pxInt(360)
|
||||
|
||||
pOptions = SHARED.project.options
|
||||
self.resize(
|
||||
CONFIG.pxInt(pOptions.getInt("GuiManuscriptBuild", "winWidth", wWin)),
|
||||
CONFIG.pxInt(pOptions.getInt("GuiManuscriptBuild", "winHeight", hWin))
|
||||
pOptions.getInt("GuiManuscriptBuild", "winWidth", 620),
|
||||
pOptions.getInt("GuiManuscriptBuild", "winHeight", 360),
|
||||
)
|
||||
|
||||
# Output Format
|
||||
@@ -149,7 +144,7 @@ class GuiManuscriptBuild(NDialog):
|
||||
self.pathBox = QHBoxLayout()
|
||||
self.pathBox.addWidget(self.buildPath)
|
||||
self.pathBox.addWidget(self.btnBrowse)
|
||||
self.pathBox.setSpacing(sp8)
|
||||
self.pathBox.setSpacing(8)
|
||||
|
||||
# Build Name
|
||||
self.lblName = QLabel(self.tr("File Name"), self)
|
||||
@@ -160,14 +155,14 @@ class GuiManuscriptBuild(NDialog):
|
||||
self.nameBox = QHBoxLayout()
|
||||
self.nameBox.addWidget(self.buildName)
|
||||
self.nameBox.addWidget(self.btnReset)
|
||||
self.nameBox.setSpacing(sp8)
|
||||
self.nameBox.setSpacing(8)
|
||||
|
||||
# Build Progress
|
||||
self.buildProgress = NProgressSimple(self)
|
||||
self.buildProgress.setMinimum(0)
|
||||
self.buildProgress.setValue(0)
|
||||
self.buildProgress.setTextVisible(False)
|
||||
self.buildProgress.setFixedHeight(sp8)
|
||||
self.buildProgress.setFixedHeight(8)
|
||||
|
||||
# Build Box
|
||||
self.buildBox = QGridLayout()
|
||||
@@ -175,8 +170,8 @@ class GuiManuscriptBuild(NDialog):
|
||||
self.buildBox.addLayout(self.pathBox, 0, 1)
|
||||
self.buildBox.addWidget(self.lblName, 1, 0)
|
||||
self.buildBox.addLayout(self.nameBox, 1, 1)
|
||||
self.buildBox.setHorizontalSpacing(sp8)
|
||||
self.buildBox.setVerticalSpacing(sp4)
|
||||
self.buildBox.setHorizontalSpacing(8)
|
||||
self.buildBox.setVerticalSpacing(4)
|
||||
|
||||
# Dialog Buttons
|
||||
self.buttonBox = QDialogButtonBox(self)
|
||||
@@ -196,7 +191,8 @@ class GuiManuscriptBuild(NDialog):
|
||||
self.buttonBox.addButton(self.btnBuild, QtRoleAction)
|
||||
|
||||
self.btnClose = self.buttonBox.addButton(QtDialogClose)
|
||||
self.btnClose.setAutoDefault(False)
|
||||
if self.btnClose:
|
||||
self.btnClose.setAutoDefault(False)
|
||||
|
||||
# Assemble GUI
|
||||
# ============
|
||||
@@ -204,25 +200,25 @@ class GuiManuscriptBuild(NDialog):
|
||||
self.mainSplit = QSplitter(self)
|
||||
self.mainSplit.addWidget(self.formatWidget)
|
||||
self.mainSplit.addWidget(self.contentWidget)
|
||||
self.mainSplit.setHandleWidth(sp16)
|
||||
self.mainSplit.setHandleWidth(16)
|
||||
self.mainSplit.setCollapsible(0, False)
|
||||
self.mainSplit.setCollapsible(1, False)
|
||||
self.mainSplit.setStretchFactor(0, 0)
|
||||
self.mainSplit.setStretchFactor(1, 1)
|
||||
self.mainSplit.setSizes([
|
||||
CONFIG.pxInt(pOptions.getInt("GuiManuscriptBuild", "fmtWidth", wWin//2)),
|
||||
CONFIG.pxInt(pOptions.getInt("GuiManuscriptBuild", "sumWidth", wWin//2)),
|
||||
pOptions.getInt("GuiManuscriptBuild", "fmtWidth", 360),
|
||||
pOptions.getInt("GuiManuscriptBuild", "sumWidth", 360),
|
||||
])
|
||||
|
||||
self.outerBox = QVBoxLayout()
|
||||
self.outerBox.addWidget(self.lblMain, 0, QtAlignCenter)
|
||||
self.outerBox.addSpacing(sp16)
|
||||
self.outerBox.addSpacing(16)
|
||||
self.outerBox.addWidget(self.mainSplit, 1)
|
||||
self.outerBox.addSpacing(sp4)
|
||||
self.outerBox.addSpacing(4)
|
||||
self.outerBox.addWidget(self.buildProgress, 0)
|
||||
self.outerBox.addSpacing(sp4)
|
||||
self.outerBox.addSpacing(4)
|
||||
self.outerBox.addLayout(self.buildBox, 0)
|
||||
self.outerBox.addSpacing(sp16)
|
||||
self.outerBox.addSpacing(16)
|
||||
self.outerBox.addWidget(self.buttonBox, 0)
|
||||
self.outerBox.setSpacing(0)
|
||||
|
||||
@@ -363,21 +359,14 @@ class GuiManuscriptBuild(NDialog):
|
||||
|
||||
def _saveSettings(self) -> None:
|
||||
"""Save the user GUI settings."""
|
||||
winWidth = CONFIG.rpxInt(self.width())
|
||||
winHeight = CONFIG.rpxInt(self.height())
|
||||
|
||||
mainSplit = self.mainSplit.sizes()
|
||||
fmtWidth = CONFIG.rpxInt(mainSplit[0])
|
||||
sumWidth = CONFIG.rpxInt(mainSplit[1])
|
||||
|
||||
logger.debug("Saving State: GuiManuscriptBuild")
|
||||
mainSplit = self.mainSplit.sizes()
|
||||
pOptions = SHARED.project.options
|
||||
pOptions.setValue("GuiManuscriptBuild", "winWidth", winWidth)
|
||||
pOptions.setValue("GuiManuscriptBuild", "winHeight", winHeight)
|
||||
pOptions.setValue("GuiManuscriptBuild", "fmtWidth", fmtWidth)
|
||||
pOptions.setValue("GuiManuscriptBuild", "sumWidth", sumWidth)
|
||||
pOptions.setValue("GuiManuscriptBuild", "winWidth", self.width())
|
||||
pOptions.setValue("GuiManuscriptBuild", "winHeight", self.height())
|
||||
pOptions.setValue("GuiManuscriptBuild", "fmtWidth", mainSplit[0])
|
||||
pOptions.setValue("GuiManuscriptBuild", "sumWidth", mainSplit[1])
|
||||
pOptions.saveSettings()
|
||||
|
||||
return
|
||||
|
||||
def _populateContentList(self) -> None:
|
||||
|
||||
@@ -85,18 +85,16 @@ class GuiManuscript(NToolDialog):
|
||||
self._buildMap: dict[str, QListWidgetItem] = {}
|
||||
|
||||
self.setWindowTitle(self.tr("Build Manuscript"))
|
||||
self.setMinimumWidth(CONFIG.pxInt(600))
|
||||
self.setMinimumHeight(CONFIG.pxInt(500))
|
||||
self.setMinimumWidth(600)
|
||||
self.setMinimumHeight(500)
|
||||
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
wWin = CONFIG.pxInt(900)
|
||||
hWin = CONFIG.pxInt(600)
|
||||
|
||||
pOptions = SHARED.project.options
|
||||
self.resize(
|
||||
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "winWidth", wWin)),
|
||||
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "winHeight", hWin))
|
||||
pOptions.getInt("GuiManuscript", "winWidth", 900),
|
||||
pOptions.getInt("GuiManuscript", "winHeight", 600),
|
||||
)
|
||||
|
||||
# Build Controls
|
||||
@@ -153,9 +151,7 @@ class GuiManuscript(NToolDialog):
|
||||
# ============
|
||||
|
||||
self.buildDetails = _DetailsWidget(self)
|
||||
self.buildDetails.setColumnWidth(
|
||||
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "detailsWidth", 100)),
|
||||
)
|
||||
self.buildDetails.setColumnWidth(pOptions.getInt("GuiManuscript", "detailsWidth", 100))
|
||||
|
||||
self.buildOutline = _OutlineWidget(self)
|
||||
|
||||
@@ -168,8 +164,8 @@ class GuiManuscript(NToolDialog):
|
||||
self.buildSplit.addWidget(self.buildList)
|
||||
self.buildSplit.addWidget(self.detailsTabs)
|
||||
self.buildSplit.setSizes([
|
||||
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "listHeight", 50)),
|
||||
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "detailsHeight", 50)),
|
||||
pOptions.getInt("GuiManuscript", "listHeight", 50),
|
||||
pOptions.getInt("GuiManuscript", "detailsHeight", 50),
|
||||
])
|
||||
|
||||
# Process Controls
|
||||
@@ -240,8 +236,8 @@ class GuiManuscript(NToolDialog):
|
||||
self.mainSplit.setStretchFactor(0, 0)
|
||||
self.mainSplit.setStretchFactor(1, 1)
|
||||
self.mainSplit.setSizes([
|
||||
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "optsWidth", wWin//4)),
|
||||
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "viewWidth", 3*wWin//4)),
|
||||
pOptions.getInt("GuiManuscript", "optsWidth", 225),
|
||||
pOptions.getInt("GuiManuscript", "viewWidth", 675),
|
||||
])
|
||||
|
||||
self.outerBox = QVBoxLayout()
|
||||
@@ -441,28 +437,20 @@ class GuiManuscript(NToolDialog):
|
||||
|
||||
self._builds.setBuildsState(lastBuild, buildOrder)
|
||||
|
||||
winWidth = CONFIG.rpxInt(self.width())
|
||||
winHeight = CONFIG.rpxInt(self.height())
|
||||
|
||||
mainSplit = self.mainSplit.sizes()
|
||||
optsWidth = CONFIG.rpxInt(mainSplit[0])
|
||||
viewWidth = CONFIG.rpxInt(mainSplit[1])
|
||||
|
||||
buildSplit = self.buildSplit.sizes()
|
||||
listHeight = CONFIG.rpxInt(buildSplit[0])
|
||||
detailsHeight = CONFIG.rpxInt(buildSplit[1])
|
||||
detailsWidth = CONFIG.rpxInt(self.buildDetails.getColumnWidth())
|
||||
detailsWidth = self.buildDetails.getColumnWidth()
|
||||
detailsExpanded = self.buildDetails.getExpandedState()
|
||||
showNewPage = self.swtNewPage.isChecked()
|
||||
|
||||
logger.debug("Saving State: GuiManuscript")
|
||||
pOptions = SHARED.project.options
|
||||
pOptions.setValue("GuiManuscript", "winWidth", winWidth)
|
||||
pOptions.setValue("GuiManuscript", "winHeight", winHeight)
|
||||
pOptions.setValue("GuiManuscript", "optsWidth", optsWidth)
|
||||
pOptions.setValue("GuiManuscript", "viewWidth", viewWidth)
|
||||
pOptions.setValue("GuiManuscript", "listHeight", listHeight)
|
||||
pOptions.setValue("GuiManuscript", "detailsHeight", detailsHeight)
|
||||
pOptions.setValue("GuiManuscript", "winWidth", self.width())
|
||||
pOptions.setValue("GuiManuscript", "winHeight", self.height())
|
||||
pOptions.setValue("GuiManuscript", "optsWidth", mainSplit[0])
|
||||
pOptions.setValue("GuiManuscript", "viewWidth", mainSplit[1])
|
||||
pOptions.setValue("GuiManuscript", "listHeight", buildSplit[0])
|
||||
pOptions.setValue("GuiManuscript", "detailsHeight", buildSplit[1])
|
||||
pOptions.setValue("GuiManuscript", "detailsWidth", detailsWidth)
|
||||
pOptions.setValue("GuiManuscript", "detailsExpanded", detailsExpanded)
|
||||
pOptions.setValue("GuiManuscript", "showNewPage", showNewPage)
|
||||
@@ -693,33 +681,31 @@ class _OutlineWidget(QWidget):
|
||||
hFont.setBold(True)
|
||||
hFont.setUnderline(True)
|
||||
|
||||
root = self.listView.invisibleRootItem()
|
||||
parent = root
|
||||
indent = False
|
||||
for anchor, entry in data.items():
|
||||
prefix, _, text = entry.partition("|")
|
||||
if prefix in ("TT", "PT", "CH", "SC", "H1", "H2"):
|
||||
item = QTreeWidgetItem([text])
|
||||
item.setData(0, self.D_LINE, anchor)
|
||||
if prefix == "TT":
|
||||
item.setFont(0, tFont)
|
||||
item.setForeground(0, tBrush)
|
||||
root.addChild(item)
|
||||
parent = root
|
||||
elif prefix == "PT":
|
||||
item.setFont(0, hFont)
|
||||
root.addChild(item)
|
||||
parent = root
|
||||
elif prefix in ("CH", "H1"):
|
||||
root.addChild(item)
|
||||
parent = item
|
||||
elif prefix in ("SC", "H2"):
|
||||
parent.addChild(item)
|
||||
indent = True
|
||||
if root := self.listView.invisibleRootItem():
|
||||
parent = root
|
||||
indent = False
|
||||
for anchor, entry in data.items():
|
||||
prefix, _, text = entry.partition("|")
|
||||
if prefix in ("TT", "PT", "CH", "SC", "H1", "H2"):
|
||||
item = QTreeWidgetItem([text])
|
||||
item.setData(0, self.D_LINE, anchor)
|
||||
if prefix == "TT":
|
||||
item.setFont(0, tFont)
|
||||
item.setForeground(0, tBrush)
|
||||
root.addChild(item)
|
||||
parent = root
|
||||
elif prefix == "PT":
|
||||
item.setFont(0, hFont)
|
||||
root.addChild(item)
|
||||
parent = root
|
||||
elif prefix in ("CH", "H1"):
|
||||
root.addChild(item)
|
||||
parent = item
|
||||
elif prefix in ("SC", "H2"):
|
||||
parent.addChild(item)
|
||||
indent = True
|
||||
|
||||
self.listView.setIndentation(
|
||||
SHARED.theme.baseIconHeight if indent else CONFIG.pxInt(4)
|
||||
)
|
||||
self.listView.setIndentation(SHARED.theme.baseIconHeight if indent else 4)
|
||||
self._outline = data
|
||||
|
||||
return
|
||||
@@ -754,7 +740,9 @@ class _PreviewWidget(QTextBrowser):
|
||||
self.setOpenExternalLinks(False)
|
||||
self.setOpenLinks(False)
|
||||
|
||||
self.document().setDocumentMargin(CONFIG.textMargin)
|
||||
if document := self.document():
|
||||
document.setDocumentMargin(CONFIG.textMargin)
|
||||
|
||||
self.setPlaceholderText(self.tr(
|
||||
"Press the \"Preview\" button to generate ..."
|
||||
))
|
||||
@@ -781,7 +769,7 @@ class _PreviewWidget(QTextBrowser):
|
||||
self.ageLabel.setFixedHeight(int(2.1*SHARED.theme.fontPixelSize))
|
||||
|
||||
# Progress
|
||||
self.buildProgress = NProgressCircle(self, CONFIG.pxInt(160), CONFIG.pxInt(16))
|
||||
self.buildProgress = NProgressCircle(self, 160, 16)
|
||||
self.buildProgress.setVisible(False)
|
||||
self.buildProgress.setMaximum(1)
|
||||
self.buildProgress.setValue(0)
|
||||
@@ -834,7 +822,8 @@ class _PreviewWidget(QTextBrowser):
|
||||
self.buildProgress.setValue(0)
|
||||
self.buildProgress.setCentreText(None)
|
||||
self.buildProgress.setVisible(True)
|
||||
self._scrollPos = self.verticalScrollBar().value()
|
||||
if vBar := self.verticalScrollBar():
|
||||
self._scrollPos = vBar.value()
|
||||
self.setPlaceholderText("")
|
||||
self.clear()
|
||||
return
|
||||
@@ -883,10 +872,11 @@ class _PreviewWidget(QTextBrowser):
|
||||
@pyqtSlot("QPrinter*")
|
||||
def printPreview(self, printer: QPrinter) -> None:
|
||||
"""Connect the print preview painter to the document viewer."""
|
||||
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
|
||||
printer.setPageOrientation(QPageLayout.Orientation.Portrait)
|
||||
self.document().print(printer)
|
||||
QApplication.restoreOverrideCursor()
|
||||
if document := self.document():
|
||||
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
|
||||
printer.setPageOrientation(QPageLayout.Orientation.Portrait)
|
||||
document.print(printer)
|
||||
QApplication.restoreOverrideCursor()
|
||||
return
|
||||
|
||||
@pyqtSlot(str)
|
||||
@@ -928,7 +918,8 @@ class _PreviewWidget(QTextBrowser):
|
||||
def _postUpdate(self) -> None:
|
||||
"""Run tasks after content update."""
|
||||
self.buildProgress.setVisible(False)
|
||||
self.verticalScrollBar().setValue(self._scrollPos)
|
||||
if vBar := self.verticalScrollBar():
|
||||
vBar.setValue(self._scrollPos)
|
||||
return
|
||||
|
||||
##
|
||||
@@ -941,7 +932,7 @@ class _PreviewWidget(QTextBrowser):
|
||||
"""
|
||||
vBar = self.verticalScrollBar()
|
||||
tB = self.frameWidth()
|
||||
vW = self.width() - 2*tB - vBar.width()
|
||||
vW = self.width() - 2*tB - (vBar.width() if vBar else 0)
|
||||
vH = self.height() - 2*tB
|
||||
tH = self.ageLabel.height()
|
||||
pS = self.buildProgress.width()
|
||||
@@ -1033,10 +1024,6 @@ class _StatsWidget(QWidget):
|
||||
|
||||
def _buildBottomPanel(self) -> None:
|
||||
"""Build the bottom page."""
|
||||
mPx = CONFIG.pxInt(8)
|
||||
hPx = CONFIG.pxInt(12)
|
||||
vPx = CONFIG.pxInt(4)
|
||||
|
||||
trAllChars = trConst(nwLabels.STATS_NAME[nwStats.CHARS])
|
||||
trTextChars = trConst(nwLabels.STATS_NAME[nwStats.CHARS_TEXT])
|
||||
trTitleChars = trConst(nwLabels.STATS_NAME[nwStats.CHARS_TITLE])
|
||||
@@ -1073,8 +1060,8 @@ class _StatsWidget(QWidget):
|
||||
self.leftForm.addRow("", QLabel(self))
|
||||
self.leftForm.addRow(trTitleCount, self.maxTitleCount)
|
||||
self.leftForm.addRow(trParagraphCount, self.maxParCount)
|
||||
self.leftForm.setHorizontalSpacing(hPx)
|
||||
self.leftForm.setVerticalSpacing(vPx)
|
||||
self.leftForm.setHorizontalSpacing(12)
|
||||
self.leftForm.setVerticalSpacing(4)
|
||||
|
||||
# Maximal Form, Right Column
|
||||
self.maxTotalChars = QLabel(self)
|
||||
@@ -1098,25 +1085,25 @@ class _StatsWidget(QWidget):
|
||||
self.rightForm.addRow(trAllWordChars, self.maxTotalWordChars)
|
||||
self.rightForm.addRow(trTitleWordChars, self.maxHeadWordChars)
|
||||
self.rightForm.addRow(trTextWordChars, self.maxTextWordChars)
|
||||
self.rightForm.setHorizontalSpacing(hPx)
|
||||
self.rightForm.setVerticalSpacing(vPx)
|
||||
self.rightForm.setHorizontalSpacing(12)
|
||||
self.rightForm.setVerticalSpacing(4)
|
||||
|
||||
# Assemble
|
||||
self.minLayout = QHBoxLayout()
|
||||
self.minLayout.addWidget(QLabel(trAllWords, self))
|
||||
self.minLayout.addWidget(self.minWordCount)
|
||||
self.minLayout.addSpacing(mPx)
|
||||
self.minLayout.addSpacing(8)
|
||||
self.minLayout.addWidget(QLabel(trAllChars, self))
|
||||
self.minLayout.addWidget(self.minCharCount)
|
||||
self.minLayout.addStretch(1)
|
||||
self.minLayout.setSpacing(mPx)
|
||||
self.minLayout.setSpacing(8)
|
||||
self.minLayout.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.maxLayout = QHBoxLayout()
|
||||
self.maxLayout.addLayout(self.leftForm)
|
||||
self.maxLayout.addLayout(self.rightForm)
|
||||
self.maxLayout.addStretch(1)
|
||||
self.maxLayout.setSpacing(CONFIG.pxInt(32))
|
||||
self.maxLayout.setSpacing(32)
|
||||
self.maxLayout.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.minWidget.setLayout(self.minLayout)
|
||||
|
||||
@@ -37,7 +37,7 @@ from PyQt6.QtWidgets import (
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import describeFont, fontMatcher, qtLambda
|
||||
from novelwriter.common import describeFont, fontMatcher, qtAddAction, qtLambda
|
||||
from novelwriter.constants import nwHeadFmt, nwKeyWords, nwLabels, nwStyles, trConst
|
||||
from novelwriter.core.buildsettings import BuildSettings, FilterMode
|
||||
from novelwriter.extensions.configlayout import (
|
||||
@@ -83,21 +83,18 @@ class GuiBuildSettings(NToolDialog):
|
||||
self._build = build
|
||||
|
||||
self.setWindowTitle(self.tr("Manuscript Build Settings"))
|
||||
self.setMinimumSize(CONFIG.pxInt(700), CONFIG.pxInt(400))
|
||||
|
||||
wWin = CONFIG.pxInt(750)
|
||||
hWin = CONFIG.pxInt(550)
|
||||
self.setMinimumSize(700, 400)
|
||||
|
||||
options = SHARED.project.options
|
||||
self.resize(
|
||||
CONFIG.pxInt(options.getInt("GuiBuildSettings", "winWidth", wWin)),
|
||||
CONFIG.pxInt(options.getInt("GuiBuildSettings", "winHeight", hWin))
|
||||
options.getInt("GuiBuildSettings", "winWidth", 750),
|
||||
options.getInt("GuiBuildSettings", "winHeight", 550),
|
||||
)
|
||||
|
||||
# Title
|
||||
self.titleLabel = NColourLabel(
|
||||
self.tr("Manuscript Build Settings"), self, color=SHARED.theme.helpText,
|
||||
scale=NColourLabel.HEADER_SCALE, indent=CONFIG.pxInt(4)
|
||||
scale=NColourLabel.HEADER_SCALE, indent=4,
|
||||
)
|
||||
|
||||
# Settings Name
|
||||
@@ -145,7 +142,7 @@ class GuiBuildSettings(NToolDialog):
|
||||
self.outerBox.addLayout(self.topBox)
|
||||
self.outerBox.addLayout(self.mainBox)
|
||||
self.outerBox.addWidget(self.buttonBox)
|
||||
self.outerBox.setSpacing(CONFIG.pxInt(12))
|
||||
self.outerBox.setSpacing(12)
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
@@ -240,14 +237,11 @@ class GuiBuildSettings(NToolDialog):
|
||||
|
||||
def _saveSettings(self) -> None:
|
||||
"""Save the various user settings."""
|
||||
winWidth = CONFIG.rpxInt(self.width())
|
||||
winHeight = CONFIG.rpxInt(self.height())
|
||||
treeWidth, filterWidth = self.optTabSelect.mainSplitSizes()
|
||||
|
||||
logger.debug("Saving State: GuiBuildSettings")
|
||||
pOptions = SHARED.project.options
|
||||
pOptions.setValue("GuiBuildSettings", "winWidth", winWidth)
|
||||
pOptions.setValue("GuiBuildSettings", "winHeight", winHeight)
|
||||
pOptions.setValue("GuiBuildSettings", "winWidth", self.width())
|
||||
pOptions.setValue("GuiBuildSettings", "winHeight", self.height())
|
||||
pOptions.setValue("GuiBuildSettings", "treeWidth", treeWidth)
|
||||
pOptions.setValue("GuiBuildSettings", "filterWidth", filterWidth)
|
||||
pOptions.saveSettings()
|
||||
@@ -300,7 +294,6 @@ class _FilterTab(NFixedPage):
|
||||
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
cMg = CONFIG.pxInt(6)
|
||||
|
||||
# Tree Widget
|
||||
self.optTree = QTreeWidget(self)
|
||||
@@ -311,14 +304,14 @@ class _FilterTab(NFixedPage):
|
||||
self.optTree.setIndentation(iPx)
|
||||
self.optTree.setColumnCount(3)
|
||||
|
||||
treeHeader = self.optTree.header()
|
||||
treeHeader.setStretchLastSection(False)
|
||||
treeHeader.setMinimumSectionSize(iPx + cMg) # See Issue #1551
|
||||
treeHeader.setSectionResizeMode(self.C_NAME, QtHeaderStretch)
|
||||
treeHeader.setSectionResizeMode(self.C_ACTIVE, QtHeaderFixed)
|
||||
treeHeader.setSectionResizeMode(self.C_STATUS, QtHeaderFixed)
|
||||
treeHeader.resizeSection(self.C_ACTIVE, iPx + cMg)
|
||||
treeHeader.resizeSection(self.C_STATUS, iPx + cMg)
|
||||
if header := self.optTree.header():
|
||||
header.setStretchLastSection(False)
|
||||
header.setMinimumSectionSize(iPx + 6) # See Issue #1551
|
||||
header.setSectionResizeMode(self.C_NAME, QtHeaderStretch)
|
||||
header.setSectionResizeMode(self.C_ACTIVE, QtHeaderFixed)
|
||||
header.setSectionResizeMode(self.C_STATUS, QtHeaderFixed)
|
||||
header.resizeSection(self.C_ACTIVE, iPx + 6)
|
||||
header.resizeSection(self.C_STATUS, iPx + 6)
|
||||
|
||||
self.optTree.setDragDropMode(QAbstractItemView.DragDropMode.NoDragDrop)
|
||||
self.optTree.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
@@ -347,7 +340,7 @@ class _FilterTab(NFixedPage):
|
||||
self.modeBox.addWidget(self.includedButton)
|
||||
self.modeBox.addWidget(self.excludedButton)
|
||||
self.modeBox.addWidget(self.resetButton)
|
||||
self.modeBox.setSpacing(CONFIG.pxInt(4))
|
||||
self.modeBox.setSpacing(4)
|
||||
|
||||
# Filer Options
|
||||
self.filterOpt = NSwitchBox(self, iPx)
|
||||
@@ -375,8 +368,8 @@ class _FilterTab(NFixedPage):
|
||||
self.mainSplit.setStretchFactor(0, 1)
|
||||
self.mainSplit.setStretchFactor(1, 0)
|
||||
self.mainSplit.setSizes([
|
||||
CONFIG.pxInt(pOptions.getInt("GuiBuildSettings", "treeWidth", 300)),
|
||||
CONFIG.pxInt(pOptions.getInt("GuiBuildSettings", "filterWidth", 300))
|
||||
pOptions.getInt("GuiBuildSettings", "treeWidth", 300),
|
||||
pOptions.getInt("GuiBuildSettings", "filterWidth", 300),
|
||||
])
|
||||
|
||||
self.setCentralWidget(self.mainSplit)
|
||||
@@ -393,7 +386,7 @@ class _FilterTab(NFixedPage):
|
||||
"""Extract the sizes of the main splitter."""
|
||||
sizes = self.mainSplit.sizes()
|
||||
m, n = (sizes[0], sizes[1]) if len(sizes) >= 2 else (0, 0)
|
||||
return CONFIG.rpxInt(m), CONFIG.rpxInt(n)
|
||||
return m, n
|
||||
|
||||
##
|
||||
# Slots
|
||||
@@ -558,15 +551,12 @@ class _HeadingsTab(NScrollablePage):
|
||||
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
sSp = CONFIG.pxInt(16)
|
||||
vSp = CONFIG.pxInt(12)
|
||||
bSp = CONFIG.pxInt(6)
|
||||
trHide = self.tr("Hide")
|
||||
|
||||
# Format Boxes
|
||||
# ============
|
||||
self.formatBox = QGridLayout()
|
||||
self.formatBox.setHorizontalSpacing(bSp)
|
||||
self.formatBox.setHorizontalSpacing(6)
|
||||
|
||||
# Title Heading
|
||||
self.lblPart = QLabel(self._build.getLabel("headings.fmtPart"), self)
|
||||
@@ -575,7 +565,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.btnPart = NIconToolButton(self, iSz, "edit", "green")
|
||||
self.btnPart.clicked.connect(qtLambda(self._editHeading, self.EDIT_TITLE))
|
||||
self.hdePart = QLabel(trHide, self)
|
||||
self.hdePart.setIndent(bSp)
|
||||
self.hdePart.setIndent(6)
|
||||
self.swtPart = NSwitch(self, height=iPx)
|
||||
|
||||
self.formatBox.addWidget(self.lblPart, 0, 0)
|
||||
@@ -591,7 +581,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.btnChapter = NIconToolButton(self, iSz, "edit", "green")
|
||||
self.btnChapter.clicked.connect(qtLambda(self._editHeading, self.EDIT_CHAPTER))
|
||||
self.hdeChapter = QLabel(trHide, self)
|
||||
self.hdeChapter.setIndent(bSp)
|
||||
self.hdeChapter.setIndent(6)
|
||||
self.swtChapter = NSwitch(self, height=iPx)
|
||||
|
||||
self.formatBox.addWidget(self.lblChapter, 1, 0)
|
||||
@@ -607,7 +597,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.btnUnnumbered = NIconToolButton(self, iSz, "edit", "green")
|
||||
self.btnUnnumbered.clicked.connect(qtLambda(self._editHeading, self.EDIT_UNNUM))
|
||||
self.hdeUnnumbered = QLabel(trHide, self)
|
||||
self.hdeUnnumbered.setIndent(bSp)
|
||||
self.hdeUnnumbered.setIndent(6)
|
||||
self.swtUnnumbered = NSwitch(self, height=iPx)
|
||||
|
||||
self.formatBox.addWidget(self.lblUnnumbered, 2, 0)
|
||||
@@ -623,7 +613,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.btnScene = NIconToolButton(self, iSz, "edit", "green")
|
||||
self.btnScene.clicked.connect(qtLambda(self._editHeading, self.EDIT_SCENE))
|
||||
self.hdeScene = QLabel(trHide, self)
|
||||
self.hdeScene.setIndent(bSp)
|
||||
self.hdeScene.setIndent(6)
|
||||
self.swtScene = NSwitch(self, height=iPx)
|
||||
|
||||
self.formatBox.addWidget(self.lblScene, 3, 0)
|
||||
@@ -639,7 +629,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.btnAScene = NIconToolButton(self, iSz, "edit", "green")
|
||||
self.btnAScene.clicked.connect(qtLambda(self._editHeading, self.EDIT_HSCENE))
|
||||
self.hdeAScene = QLabel(trHide, self)
|
||||
self.hdeAScene.setIndent(bSp)
|
||||
self.hdeAScene.setIndent(6)
|
||||
self.swtAScene = NSwitch(self, height=iPx)
|
||||
|
||||
self.formatBox.addWidget(self.lblAScene, 4, 0)
|
||||
@@ -655,7 +645,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.btnSection = NIconToolButton(self, iSz, "edit", "green")
|
||||
self.btnSection.clicked.connect(qtLambda(self._editHeading, self.EDIT_SECTION))
|
||||
self.hdeSection = QLabel(trHide, self)
|
||||
self.hdeSection.setIndent(bSp)
|
||||
self.hdeSection.setIndent(6)
|
||||
self.swtSection = NSwitch(self, height=iPx)
|
||||
|
||||
self.formatBox.addWidget(self.lblSection, 5, 0)
|
||||
@@ -675,16 +665,16 @@ class _HeadingsTab(NScrollablePage):
|
||||
|
||||
self.formSyntax = _HeadingSyntaxHighlighter(self.editTextBox.document())
|
||||
|
||||
self.menuInsert = QMenu(self)
|
||||
self.aInsTitle = self.menuInsert.addAction(self.tr("Title"))
|
||||
self.aInsChNum = self.menuInsert.addAction(self.tr("Chapter Number"))
|
||||
self.aInsChWord = self.menuInsert.addAction(self.tr("Chapter Number (Word)"))
|
||||
self.aInsChRomU = self.menuInsert.addAction(self.tr("Chapter Number (Upper Case Roman)"))
|
||||
self.aInsChRomL = self.menuInsert.addAction(self.tr("Chapter Number (Lower Case Roman)"))
|
||||
self.aInsScNum = self.menuInsert.addAction(self.tr("Scene Number (In Chapter)"))
|
||||
self.aInsScAbs = self.menuInsert.addAction(self.tr("Scene Number (Absolute)"))
|
||||
self.aInsCharPOV = self.menuInsert.addAction(self.tr("Point of View Character"))
|
||||
self.aInsCharFocus = self.menuInsert.addAction(self.tr("Focus Character"))
|
||||
self.mInsert = QMenu(self)
|
||||
self.aInsTitle = qtAddAction(self.mInsert, self.tr("Title"))
|
||||
self.aInsChNum = qtAddAction(self.mInsert, self.tr("Chapter Number"))
|
||||
self.aInsChWord = qtAddAction(self.mInsert, self.tr("Chapter Number (Word)"))
|
||||
self.aInsChRomU = qtAddAction(self.mInsert, self.tr("Chapter Number (Upper Case Roman)"))
|
||||
self.aInsChRomL = qtAddAction(self.mInsert, self.tr("Chapter Number (Lower Case Roman)"))
|
||||
self.aInsScNum = qtAddAction(self.mInsert, self.tr("Scene Number (In Chapter)"))
|
||||
self.aInsScAbs = qtAddAction(self.mInsert, self.tr("Scene Number (Absolute)"))
|
||||
self.aInsCharPOV = qtAddAction(self.mInsert, self.tr("Point of View Character"))
|
||||
self.aInsCharFocus = qtAddAction(self.mInsert, self.tr("Focus Character"))
|
||||
|
||||
self.aInsTitle.triggered.connect(qtLambda(self._insertIntoForm, nwHeadFmt.TITLE))
|
||||
self.aInsChNum.triggered.connect(qtLambda(self._insertIntoForm, nwHeadFmt.CH_NUM))
|
||||
@@ -697,7 +687,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.aInsCharFocus.triggered.connect(qtLambda(self._insertIntoForm, nwHeadFmt.CHAR_FOCUS))
|
||||
|
||||
self.btnInsert = QPushButton(self.tr("Insert"), self)
|
||||
self.btnInsert.setMenu(self.menuInsert)
|
||||
self.btnInsert.setMenu(self.mInsert)
|
||||
|
||||
self.btnApply = QPushButton(self.tr("Apply"), self)
|
||||
self.btnApply.clicked.connect(self._saveFormat)
|
||||
@@ -715,8 +705,8 @@ class _HeadingsTab(NScrollablePage):
|
||||
# Layout Matrix
|
||||
# =============
|
||||
self.layoutMatrix = QGridLayout()
|
||||
self.layoutMatrix.setVerticalSpacing(vSp)
|
||||
self.layoutMatrix.setHorizontalSpacing(vSp)
|
||||
self.layoutMatrix.setVerticalSpacing(12)
|
||||
self.layoutMatrix.setHorizontalSpacing(12)
|
||||
|
||||
self.layoutMatrix.addWidget(QLabel(self.tr("Centre"), self), 0, 1)
|
||||
self.layoutMatrix.addWidget(QLabel(self.tr("Page Break"), self), 0, 2)
|
||||
@@ -764,9 +754,9 @@ class _HeadingsTab(NScrollablePage):
|
||||
|
||||
self.outerBox = QVBoxLayout()
|
||||
self.outerBox.addLayout(self.formatBox)
|
||||
self.outerBox.addSpacing(sSp)
|
||||
self.outerBox.addSpacing(16)
|
||||
self.outerBox.addLayout(self.editFormBox)
|
||||
self.outerBox.addSpacing(sSp)
|
||||
self.outerBox.addSpacing(16)
|
||||
self.outerBox.addLayout(self.layoutMatrix)
|
||||
self.outerBox.addStretch(1)
|
||||
|
||||
@@ -904,7 +894,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
|
||||
class _HeadingSyntaxHighlighter(QSyntaxHighlighter):
|
||||
|
||||
def __init__(self, document: QTextDocument) -> None:
|
||||
def __init__(self, document: QTextDocument | None) -> None:
|
||||
super().__init__(document)
|
||||
syntax = SHARED.theme.syntaxTheme
|
||||
self._fmtSymbol = QTextCharFormat()
|
||||
@@ -1223,7 +1213,7 @@ class _FormattingTab(NScrollableForm):
|
||||
|
||||
# Header
|
||||
self.odtPageHeader = QLineEdit(self)
|
||||
self.odtPageHeader.setMinimumWidth(CONFIG.pxInt(200))
|
||||
self.odtPageHeader.setMinimumWidth(200)
|
||||
self.btnPageHeader = NIconToolButton(self, iSz, "revert", "green")
|
||||
self.btnPageHeader.clicked.connect(self._resetPageHeader)
|
||||
self.addRow(
|
||||
|
||||
@@ -34,7 +34,7 @@ from PyQt6.QtWidgets import (
|
||||
QVBoxLayout, QWidget
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.common import formatTime, numberToRoman
|
||||
from novelwriter.constants import nwUnicode
|
||||
from novelwriter.extensions.configlayout import NColourLabel, NFixedPage, NScrollablePage
|
||||
@@ -60,16 +60,16 @@ class GuiNovelDetails(NNonBlockingDialog):
|
||||
self.setWindowTitle(self.tr("Novel Details"))
|
||||
|
||||
options = SHARED.project.options
|
||||
self.setMinimumSize(CONFIG.pxInt(500), CONFIG.pxInt(400))
|
||||
self.setMinimumSize(500, 400)
|
||||
self.resize(
|
||||
CONFIG.pxInt(options.getInt("GuiNovelDetails", "winWidth", CONFIG.pxInt(650))),
|
||||
CONFIG.pxInt(options.getInt("GuiNovelDetails", "winHeight", CONFIG.pxInt(500)))
|
||||
options.getInt("GuiNovelDetails", "winWidth", 650),
|
||||
options.getInt("GuiNovelDetails", "winHeight", 500),
|
||||
)
|
||||
|
||||
# Title
|
||||
self.titleLabel = NColourLabel(
|
||||
self.tr("Novel Details"), self, color=SHARED.theme.helpText,
|
||||
scale=NColourLabel.HEADER_SCALE, indent=CONFIG.pxInt(4)
|
||||
scale=NColourLabel.HEADER_SCALE, indent=4,
|
||||
)
|
||||
|
||||
# Novel Selector
|
||||
@@ -114,7 +114,7 @@ class GuiNovelDetails(NNonBlockingDialog):
|
||||
self.outerBox.addLayout(self.topBox)
|
||||
self.outerBox.addLayout(self.mainBox)
|
||||
self.outerBox.addWidget(self.buttonBox)
|
||||
self.outerBox.setSpacing(CONFIG.pxInt(8))
|
||||
self.outerBox.setSpacing(8)
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
self.setSizeGripEnabled(True)
|
||||
@@ -172,18 +172,13 @@ class GuiNovelDetails(NNonBlockingDialog):
|
||||
|
||||
def _saveSettings(self) -> None:
|
||||
"""Save the user GUI settings."""
|
||||
winWidth = CONFIG.rpxInt(self.width())
|
||||
winHeight = CONFIG.rpxInt(self.height())
|
||||
novelRoot = self.novelSelector.handle
|
||||
|
||||
logger.debug("Saving State: GuiNovelDetails")
|
||||
novelRoot = self.novelSelector.handle
|
||||
options = SHARED.project.options
|
||||
options.setValue("GuiNovelDetails", "winWidth", winWidth)
|
||||
options.setValue("GuiNovelDetails", "winHeight", winHeight)
|
||||
options.setValue("GuiNovelDetails", "winWidth", self.width())
|
||||
options.setValue("GuiNovelDetails", "winHeight", self.height())
|
||||
options.setValue("GuiNovelDetails", "novelRoot", novelRoot)
|
||||
|
||||
self.contentsPage.saveSettings()
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -192,11 +187,6 @@ class _OverviewPage(NScrollablePage):
|
||||
def __init__(self, parent: QWidget) -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
mPx = CONFIG.pxInt(8)
|
||||
sPx = CONFIG.pxInt(16)
|
||||
hPx = CONFIG.pxInt(24)
|
||||
vPx = CONFIG.pxInt(4)
|
||||
|
||||
# Project Info
|
||||
self.projLabel = NColourLabel(
|
||||
self.tr("Project"), self, color=SHARED.theme.helpText,
|
||||
@@ -217,9 +207,9 @@ class _OverviewPage(NScrollablePage):
|
||||
self.projForm.addRow("<b>{0}</b>".format(self.tr("Word Count")), self.projWords)
|
||||
self.projForm.addRow("<b>\u2026 {0}</b>".format(self.tr("In Novels")), self.projNovels)
|
||||
self.projForm.addRow("<b>\u2026 {0}</b>".format(self.tr("In Notes")), self.projNotes)
|
||||
self.projForm.setContentsMargins(mPx, 0, 0, 0)
|
||||
self.projForm.setHorizontalSpacing(hPx)
|
||||
self.projForm.setVerticalSpacing(vPx)
|
||||
self.projForm.setContentsMargins(8, 0, 0, 0)
|
||||
self.projForm.setHorizontalSpacing(24)
|
||||
self.projForm.setVerticalSpacing(4)
|
||||
|
||||
# Novel Info
|
||||
self.novelLabel = NColourLabel(
|
||||
@@ -237,9 +227,9 @@ class _OverviewPage(NScrollablePage):
|
||||
self.novelForm.addRow("<b>{0}</b>".format(self.tr("Word Count")), self.novelWords)
|
||||
self.novelForm.addRow("<b>{0}</b>".format(self.tr("Chapters")), self.novelChapters)
|
||||
self.novelForm.addRow("<b>{0}</b>".format(self.tr("Scenes")), self.novelScenes)
|
||||
self.novelForm.setContentsMargins(mPx, 0, 0, 0)
|
||||
self.novelForm.setHorizontalSpacing(hPx)
|
||||
self.novelForm.setVerticalSpacing(vPx)
|
||||
self.novelForm.setContentsMargins(8, 0, 0, 0)
|
||||
self.novelForm.setHorizontalSpacing(24)
|
||||
self.novelForm.setVerticalSpacing(4)
|
||||
|
||||
# Assemble
|
||||
self.outerBox = QVBoxLayout()
|
||||
@@ -247,7 +237,7 @@ class _OverviewPage(NScrollablePage):
|
||||
self.outerBox.addLayout(self.projForm)
|
||||
self.outerBox.addWidget(self.novelLabel)
|
||||
self.outerBox.addLayout(self.novelForm)
|
||||
self.outerBox.setSpacing(sPx)
|
||||
self.outerBox.setSpacing(16)
|
||||
self.outerBox.addStretch(1)
|
||||
|
||||
self.setCentralLayout(self.outerBox)
|
||||
@@ -309,8 +299,6 @@ class _ContentsPage(NFixedPage):
|
||||
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
hPx = CONFIG.pxInt(12)
|
||||
vPx = CONFIG.pxInt(4)
|
||||
options = SHARED.project.options
|
||||
|
||||
# Title
|
||||
@@ -341,22 +329,22 @@ class _ContentsPage(NFixedPage):
|
||||
treeHeadItem.setTextAlignment(self.C_PAGE, QtAlignRight)
|
||||
treeHeadItem.setTextAlignment(self.C_PROG, QtAlignRight)
|
||||
|
||||
treeHeader = self.tocTree.header()
|
||||
treeHeader.setStretchLastSection(True)
|
||||
treeHeader.setMinimumSectionSize(hPx)
|
||||
if header := self.tocTree.header():
|
||||
header.setStretchLastSection(True)
|
||||
header.setMinimumSectionSize(12)
|
||||
|
||||
wCol0 = CONFIG.pxInt(options.getInt("GuiNovelDetails", "widthCol0", 200))
|
||||
wCol1 = CONFIG.pxInt(options.getInt("GuiNovelDetails", "widthCol1", 60))
|
||||
wCol2 = CONFIG.pxInt(options.getInt("GuiNovelDetails", "widthCol2", 60))
|
||||
wCol3 = CONFIG.pxInt(options.getInt("GuiNovelDetails", "widthCol3", 60))
|
||||
wCol4 = CONFIG.pxInt(options.getInt("GuiNovelDetails", "widthCol4", 90))
|
||||
wCol0 = options.getInt("GuiNovelDetails", "widthCol0", 200)
|
||||
wCol1 = options.getInt("GuiNovelDetails", "widthCol1", 60)
|
||||
wCol2 = options.getInt("GuiNovelDetails", "widthCol2", 60)
|
||||
wCol3 = options.getInt("GuiNovelDetails", "widthCol3", 60)
|
||||
wCol4 = options.getInt("GuiNovelDetails", "widthCol4", 90)
|
||||
|
||||
self.tocTree.setColumnWidth(0, wCol0)
|
||||
self.tocTree.setColumnWidth(1, wCol1)
|
||||
self.tocTree.setColumnWidth(2, wCol2)
|
||||
self.tocTree.setColumnWidth(3, wCol3)
|
||||
self.tocTree.setColumnWidth(4, wCol4)
|
||||
self.tocTree.setColumnWidth(5, hPx)
|
||||
self.tocTree.setColumnWidth(5, 12)
|
||||
|
||||
# Options
|
||||
wordsPerPage = options.getInt("GuiNovelDetails", "wordsPerPage", 350)
|
||||
@@ -394,8 +382,8 @@ class _ContentsPage(NFixedPage):
|
||||
self.optionsBox.addWidget(self.dblValue, 0, 4)
|
||||
self.optionsBox.addWidget(self.poLabel, 1, 0)
|
||||
self.optionsBox.addWidget(self.poValue, 1, 1)
|
||||
self.optionsBox.setHorizontalSpacing(hPx)
|
||||
self.optionsBox.setVerticalSpacing(vPx)
|
||||
self.optionsBox.setHorizontalSpacing(12)
|
||||
self.optionsBox.setVerticalSpacing(4)
|
||||
self.optionsBox.setColumnStretch(2, 1)
|
||||
|
||||
# Assemble
|
||||
@@ -410,18 +398,12 @@ class _ContentsPage(NFixedPage):
|
||||
|
||||
def saveSettings(self) -> None:
|
||||
"""Save the user GUI settings."""
|
||||
widthCol0 = CONFIG.rpxInt(self.tocTree.columnWidth(0))
|
||||
widthCol1 = CONFIG.rpxInt(self.tocTree.columnWidth(1))
|
||||
widthCol2 = CONFIG.rpxInt(self.tocTree.columnWidth(2))
|
||||
widthCol3 = CONFIG.rpxInt(self.tocTree.columnWidth(3))
|
||||
widthCol4 = CONFIG.rpxInt(self.tocTree.columnWidth(4))
|
||||
|
||||
options = SHARED.project.options
|
||||
options.setValue("GuiNovelDetails", "widthCol0", widthCol0)
|
||||
options.setValue("GuiNovelDetails", "widthCol1", widthCol1)
|
||||
options.setValue("GuiNovelDetails", "widthCol2", widthCol2)
|
||||
options.setValue("GuiNovelDetails", "widthCol3", widthCol3)
|
||||
options.setValue("GuiNovelDetails", "widthCol4", widthCol4)
|
||||
options.setValue("GuiNovelDetails", "widthCol0", self.tocTree.columnWidth(0))
|
||||
options.setValue("GuiNovelDetails", "widthCol1", self.tocTree.columnWidth(1))
|
||||
options.setValue("GuiNovelDetails", "widthCol2", self.tocTree.columnWidth(2))
|
||||
options.setValue("GuiNovelDetails", "widthCol3", self.tocTree.columnWidth(3))
|
||||
options.setValue("GuiNovelDetails", "widthCol4", self.tocTree.columnWidth(4))
|
||||
options.setValue("GuiNovelDetails", "wordsPerPage", self.wpValue.value())
|
||||
options.setValue("GuiNovelDetails", "countFrom", self.poValue.value())
|
||||
options.setValue("GuiNovelDetails", "clearDouble", self.dblValue.isChecked())
|
||||
|
||||
@@ -40,7 +40,7 @@ from PyQt6.QtWidgets import (
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import cssCol, formatInt, makeFileNameSafe, qtLambda
|
||||
from novelwriter.common import cssCol, formatInt, makeFileNameSafe, qtAddAction, qtLambda
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.core.coretools import ProjectBuilder
|
||||
from novelwriter.enum import nwItemClass
|
||||
@@ -66,29 +66,21 @@ class GuiWelcome(NDialog):
|
||||
self.setObjectName("GuiWelcome")
|
||||
|
||||
self.setWindowTitle(self.tr("Welcome"))
|
||||
self.setMinimumWidth(CONFIG.pxInt(650))
|
||||
self.setMinimumHeight(CONFIG.pxInt(450))
|
||||
|
||||
hA = CONFIG.pxInt(8)
|
||||
hB = CONFIG.pxInt(16)
|
||||
hC = CONFIG.pxInt(24)
|
||||
hD = CONFIG.pxInt(36)
|
||||
hE = CONFIG.pxInt(48)
|
||||
hF = CONFIG.pxInt(128)
|
||||
btnIconSize = SHARED.theme.buttonIconSize
|
||||
|
||||
self._hPx = CONFIG.pxInt(600)
|
||||
self.setMinimumWidth(650)
|
||||
self.setMinimumHeight(450)
|
||||
self.resize(*CONFIG.welcomeWinSize)
|
||||
|
||||
btnIconSize = SHARED.theme.buttonIconSize
|
||||
|
||||
# Elements
|
||||
# ========
|
||||
|
||||
self.bgImage = SHARED.theme.loadDecoration("welcome")
|
||||
self.nwImage = SHARED.theme.loadDecoration("nw-text", h=hD)
|
||||
self.nwImage = SHARED.theme.loadDecoration("nw-text", h=36)
|
||||
self.bgColor = QColor(54, 54, 54) if SHARED.theme.isDarkTheme else QColor(255, 255, 255)
|
||||
|
||||
self.nwLogo = QLabel(self)
|
||||
self.nwLogo.setPixmap(SHARED.theme.getPixmap("novelwriter", (hF, hF)))
|
||||
self.nwLogo.setPixmap(SHARED.theme.getPixmap("novelwriter", (128, 128)))
|
||||
|
||||
self.nwLabel = QLabel(self)
|
||||
self.nwLabel.setPixmap(self.nwImage)
|
||||
@@ -152,18 +144,18 @@ class GuiWelcome(NDialog):
|
||||
# ========
|
||||
|
||||
self.innerBox = QVBoxLayout()
|
||||
self.innerBox.addSpacing(hB)
|
||||
self.innerBox.addSpacing(16)
|
||||
self.innerBox.addWidget(self.nwLabel)
|
||||
self.innerBox.addWidget(self.nwInfo)
|
||||
self.innerBox.addSpacing(hA)
|
||||
self.innerBox.addSpacing(8)
|
||||
self.innerBox.addWidget(self.mainStack)
|
||||
self.innerBox.addSpacing(hB)
|
||||
self.innerBox.addSpacing(16)
|
||||
self.innerBox.addLayout(self.btnBox)
|
||||
|
||||
self.outerBox = QHBoxLayout()
|
||||
self.outerBox.addWidget(self.nwLogo, 3, QtAlignRightTop)
|
||||
self.outerBox.addLayout(self.innerBox, 9)
|
||||
self.outerBox.setContentsMargins(hF, hE, hC, hE)
|
||||
self.outerBox.setContentsMargins(128, 48, 24, 48)
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
self.setSizeGripEnabled(True)
|
||||
@@ -183,7 +175,7 @@ class GuiWelcome(NDialog):
|
||||
def paintEvent(self, event: QPaintEvent) -> None:
|
||||
"""Overload the paint event to draw the background image."""
|
||||
hWin = self.height()
|
||||
hPix = min(hWin, self._hPx)
|
||||
hPix = min(hWin, 600)
|
||||
tMode = Qt.TransformationMode.SmoothTransformation
|
||||
painter = QPainter(self)
|
||||
painter.fillRect(self.rect(), self.bgColor)
|
||||
@@ -309,11 +301,10 @@ class _OpenProjectPage(QWidget):
|
||||
|
||||
self._selectFirstItem()
|
||||
|
||||
mPx = CONFIG.pxInt(4)
|
||||
baseCol = cssCol(self.palette().base().color(), PANEL_ALPHA)
|
||||
self.setStyleSheet(
|
||||
f"QListView {{border: none; background: {baseCol};}} "
|
||||
f"QLineEdit {{border: none; background: {baseCol}; padding: {mPx}px;}} "
|
||||
f"QLineEdit {{border: none; background: {baseCol}; padding: 4px;}} "
|
||||
)
|
||||
|
||||
return
|
||||
@@ -370,9 +361,9 @@ class _OpenProjectPage(QWidget):
|
||||
"""Open the custom context menu."""
|
||||
ctxMenu = QMenu(self)
|
||||
ctxMenu.setObjectName("ContextMenu") # Used for testing
|
||||
action = ctxMenu.addAction(self.tr("Open Project"))
|
||||
action = qtAddAction(ctxMenu, self.tr("Open Project"))
|
||||
action.triggered.connect(self.openSelectedItem)
|
||||
action = ctxMenu.addAction(self.tr("Remove Project"))
|
||||
action = qtAddAction(ctxMenu, self.tr("Remove Project"))
|
||||
action.triggered.connect(self._deleteSelectedItem)
|
||||
ctxMenu.exec(self.mapToGlobal(pos))
|
||||
ctxMenu.deleteLater()
|
||||
@@ -400,11 +391,10 @@ class _ProjectListItem(QStyledItemDelegate):
|
||||
fPx = SHARED.theme.fontPixelSize
|
||||
fPt = SHARED.theme.fontPointSize
|
||||
tPx = round(1.2 * fPx)
|
||||
mPx = CONFIG.pxInt(4)
|
||||
iPx = tPx + fPx
|
||||
|
||||
self._pPx = (mPx//2, 3*mPx//2, iPx + mPx, mPx, mPx + tPx) # Painter coordinates
|
||||
self._hPx = 2*mPx + tPx + fPx # Fixed height
|
||||
self._pPx = (iPx + 4, tPx + 4) # Painter coordinates
|
||||
self._hPx = 8 + tPx + fPx # Fixed height
|
||||
|
||||
self._tFont = QApplication.font()
|
||||
self._tFont.setPointSizeF(1.2*fPt)
|
||||
@@ -423,7 +413,7 @@ class _ProjectListItem(QStyledItemDelegate):
|
||||
rect = opt.rect
|
||||
title, _, details = index.data()
|
||||
tFlag = Qt.TextFlag.TextSingleLine
|
||||
ix, iy, x, y1, y2 = self._pPx
|
||||
x, y = self._pPx
|
||||
|
||||
painter.save()
|
||||
if opt.state & QtSelected == QtSelected:
|
||||
@@ -431,12 +421,12 @@ class _ProjectListItem(QStyledItemDelegate):
|
||||
painter.fillRect(rect, QApplication.palette().highlight())
|
||||
painter.setOpacity(1.0)
|
||||
|
||||
painter.drawPixmap(ix, rect.top() + iy, self._icon)
|
||||
painter.drawPixmap(2, rect.top() + 6, self._icon)
|
||||
painter.setFont(self._tFont)
|
||||
painter.drawText(rect.adjusted(x, y1, 0, 0), tFlag, title)
|
||||
painter.drawText(rect.adjusted(x, 4, 0, 0), tFlag, title)
|
||||
painter.setFont(self._dFont)
|
||||
painter.setPen(self._dPen)
|
||||
painter.drawText(rect.adjusted(x, y2, 0, 0), tFlag, details)
|
||||
painter.drawText(rect.adjusted(x, y, 0, 0), tFlag, details)
|
||||
painter.restore()
|
||||
|
||||
return
|
||||
@@ -557,7 +547,6 @@ class _NewProjectForm(QWidget):
|
||||
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
sPx = CONFIG.pxInt(16)
|
||||
|
||||
# Project Settings
|
||||
# ================
|
||||
@@ -592,15 +581,15 @@ class _NewProjectForm(QWidget):
|
||||
|
||||
self.fillMenu = QMenu(self.browseFill)
|
||||
|
||||
self.fillBlank = self.fillMenu.addAction(self.tr("Create a fresh project"))
|
||||
self.fillBlank = qtAddAction(self.fillMenu, self.tr("Create a fresh project"))
|
||||
self.fillBlank.setIcon(SHARED.theme.getIcon("document"))
|
||||
self.fillBlank.triggered.connect(self._setFillBlank)
|
||||
|
||||
self.fillSample = self.fillMenu.addAction(self.tr("Create an example project"))
|
||||
self.fillSample = qtAddAction(self.fillMenu, self.tr("Create an example project"))
|
||||
self.fillSample.setIcon(SHARED.theme.getIcon("document_add", "blue"))
|
||||
self.fillSample.triggered.connect(self._setFillSample)
|
||||
|
||||
self.fillCopy = self.fillMenu.addAction(self.tr("Copy an existing project"))
|
||||
self.fillCopy = qtAddAction(self.fillMenu, self.tr("Copy an existing project"))
|
||||
self.fillCopy.setIcon(SHARED.theme.getIcon("project_copy", "green"))
|
||||
self.fillCopy.triggered.connect(self._setFillCopy)
|
||||
|
||||
@@ -675,7 +664,7 @@ class _NewProjectForm(QWidget):
|
||||
self.extraBox = QVBoxLayout()
|
||||
self.extraBox.addWidget(QLabel("<b>{0}</b>".format(self.tr("Chapters and Scenes")), self))
|
||||
self.extraBox.addLayout(self.novelForm)
|
||||
self.extraBox.addSpacing(sPx)
|
||||
self.extraBox.addSpacing(16)
|
||||
self.extraBox.addWidget(QLabel("<b>{0}</b>".format(self.tr("Project Notes")), self))
|
||||
self.extraBox.addLayout(self.notesForm)
|
||||
self.extraBox.setContentsMargins(0, 0, 0, 0)
|
||||
@@ -687,7 +676,7 @@ class _NewProjectForm(QWidget):
|
||||
self.formBox = QVBoxLayout()
|
||||
self.formBox.addWidget(QLabel("<b>{0}</b>".format(self.tr("Create New Project")), self))
|
||||
self.formBox.addLayout(self.projectForm)
|
||||
self.formBox.addSpacing(sPx)
|
||||
self.formBox.addSpacing(16)
|
||||
self.formBox.addWidget(self.extraWidget)
|
||||
self.formBox.addStretch(1)
|
||||
|
||||
|
||||
@@ -82,26 +82,18 @@ class GuiWritingStats(NToolDialog):
|
||||
pOptions = SHARED.project.options
|
||||
|
||||
self.setWindowTitle(self.tr("Writing Statistics"))
|
||||
self.setMinimumWidth(CONFIG.pxInt(420))
|
||||
self.setMinimumHeight(CONFIG.pxInt(400))
|
||||
self.setMinimumWidth(420)
|
||||
self.setMinimumHeight(400)
|
||||
self.resize(
|
||||
CONFIG.pxInt(pOptions.getInt("GuiWritingStats", "winWidth", 550)),
|
||||
CONFIG.pxInt(pOptions.getInt("GuiWritingStats", "winHeight", 500))
|
||||
pOptions.getInt("GuiWritingStats", "winWidth", 550),
|
||||
pOptions.getInt("GuiWritingStats", "winHeight", 500),
|
||||
)
|
||||
|
||||
# List Box
|
||||
wCol0 = CONFIG.pxInt(
|
||||
pOptions.getInt("GuiWritingStats", "widthCol0", 180)
|
||||
)
|
||||
wCol1 = CONFIG.pxInt(
|
||||
pOptions.getInt("GuiWritingStats", "widthCol1", 80)
|
||||
)
|
||||
wCol2 = CONFIG.pxInt(
|
||||
pOptions.getInt("GuiWritingStats", "widthCol2", 80)
|
||||
)
|
||||
wCol3 = CONFIG.pxInt(
|
||||
pOptions.getInt("GuiWritingStats", "widthCol3", 80)
|
||||
)
|
||||
wCol0 = pOptions.getInt("GuiWritingStats", "widthCol0", 180)
|
||||
wCol1 = pOptions.getInt("GuiWritingStats", "widthCol1", 80)
|
||||
wCol2 = pOptions.getInt("GuiWritingStats", "widthCol2", 80)
|
||||
wCol3 = pOptions.getInt("GuiWritingStats", "widthCol3", 80)
|
||||
|
||||
self.listBox = QTreeWidget(self)
|
||||
self.listBox.setHeaderLabels([
|
||||
@@ -133,7 +125,6 @@ class GuiWritingStats(NToolDialog):
|
||||
|
||||
# Word Bar
|
||||
self.barHeight = int(round(0.5*SHARED.theme.fontPixelSize))
|
||||
self.barWidth = CONFIG.pxInt(200)
|
||||
self.barImage = QPixmap(self.barHeight, self.barHeight)
|
||||
self.barImage.fill(self.palette().highlight().color())
|
||||
|
||||
@@ -262,25 +253,27 @@ class GuiWritingStats(NToolDialog):
|
||||
self.optsBox.addWidget(self.histMax, 0)
|
||||
|
||||
# Buttons
|
||||
self.saveJSON = QAction(self.tr("JSON Data File (.json)"), self)
|
||||
self.saveJSON.triggered.connect(qtLambda(self._saveData, self.FMT_JSON))
|
||||
|
||||
self.saveCSV = QAction(self.tr("CSV Data File (.csv)"), self)
|
||||
self.saveCSV.triggered.connect(qtLambda(self._saveData, self.FMT_CSV))
|
||||
|
||||
self.saveMenu = QMenu(self)
|
||||
self.saveMenu.addAction(self.saveJSON)
|
||||
self.saveMenu.addAction(self.saveCSV)
|
||||
|
||||
self.buttonBox = QDialogButtonBox(self)
|
||||
self.buttonBox.rejected.connect(self._doClose)
|
||||
|
||||
self.btnClose = self.buttonBox.addButton(QtDialogClose)
|
||||
self.btnClose.setAutoDefault(False)
|
||||
if self.btnClose:
|
||||
self.btnClose.setAutoDefault(False)
|
||||
|
||||
self.btnSave = self.buttonBox.addButton(self.tr("Save As"), QtRoleAction)
|
||||
self.btnSave.setAutoDefault(False)
|
||||
|
||||
self.saveMenu = QMenu(self)
|
||||
self.btnSave.setMenu(self.saveMenu)
|
||||
|
||||
self.saveJSON = QAction(self.tr("JSON Data File (.json)"), self)
|
||||
self.saveJSON.triggered.connect(qtLambda(self._saveData, self.FMT_JSON))
|
||||
self.saveMenu.addAction(self.saveJSON)
|
||||
|
||||
self.saveCSV = QAction(self.tr("CSV Data File (.csv)"), self)
|
||||
self.saveCSV.triggered.connect(qtLambda(self._saveData, self.FMT_CSV))
|
||||
self.saveMenu.addAction(self.saveCSV)
|
||||
if self.btnSave:
|
||||
self.btnSave.setAutoDefault(False)
|
||||
self.btnSave.setMenu(self.saveMenu)
|
||||
|
||||
# Assemble
|
||||
self.outerBox = QGridLayout()
|
||||
@@ -328,14 +321,10 @@ class GuiWritingStats(NToolDialog):
|
||||
"""Save the state of the window, clear cache, end close."""
|
||||
self.logData = []
|
||||
|
||||
winWidth = CONFIG.rpxInt(self.width())
|
||||
winHeight = CONFIG.rpxInt(self.height())
|
||||
widthCol0 = CONFIG.rpxInt(self.listBox.columnWidth(0))
|
||||
widthCol1 = CONFIG.rpxInt(self.listBox.columnWidth(1))
|
||||
widthCol2 = CONFIG.rpxInt(self.listBox.columnWidth(2))
|
||||
widthCol3 = CONFIG.rpxInt(self.listBox.columnWidth(3))
|
||||
header = self.listBox.header()
|
||||
|
||||
sortCol = self.listBox.sortColumn()
|
||||
sortOrder = self.listBox.header().sortIndicatorOrder()
|
||||
sortOrder = header.sortIndicatorOrder() if header else 0
|
||||
incNovel = self.incNovel.isChecked()
|
||||
incNotes = self.incNotes.isChecked()
|
||||
hideZeros = self.hideZeros.isChecked()
|
||||
@@ -346,12 +335,12 @@ class GuiWritingStats(NToolDialog):
|
||||
|
||||
logger.debug("Saving State: GuiWritingStats")
|
||||
pOptions = SHARED.project.options
|
||||
pOptions.setValue("GuiWritingStats", "winWidth", winWidth)
|
||||
pOptions.setValue("GuiWritingStats", "winHeight", winHeight)
|
||||
pOptions.setValue("GuiWritingStats", "widthCol0", widthCol0)
|
||||
pOptions.setValue("GuiWritingStats", "widthCol1", widthCol1)
|
||||
pOptions.setValue("GuiWritingStats", "widthCol2", widthCol2)
|
||||
pOptions.setValue("GuiWritingStats", "widthCol3", widthCol3)
|
||||
pOptions.setValue("GuiWritingStats", "winWidth", self.width())
|
||||
pOptions.setValue("GuiWritingStats", "winHeight", self.height())
|
||||
pOptions.setValue("GuiWritingStats", "widthCol0", self.listBox.columnWidth(0))
|
||||
pOptions.setValue("GuiWritingStats", "widthCol1", self.listBox.columnWidth(1))
|
||||
pOptions.setValue("GuiWritingStats", "widthCol2", self.listBox.columnWidth(2))
|
||||
pOptions.setValue("GuiWritingStats", "widthCol3", self.listBox.columnWidth(3))
|
||||
pOptions.setValue("GuiWritingStats", "sortCol", sortCol)
|
||||
pOptions.setValue("GuiWritingStats", "sortOrder", sortOrder)
|
||||
pOptions.setValue("GuiWritingStats", "incNovel", incNovel)
|
||||
|
||||
Reference in New Issue
Block a user