Clean up flags in all GUI classes
This commit is contained in:
@@ -61,8 +61,12 @@ class Config:
|
||||
self.appHandle = "novelwriter"
|
||||
|
||||
# Set Paths
|
||||
confRoot = Path(QStandardPaths.writableLocation(QStandardPaths.ConfigLocation))
|
||||
dataRoot = Path(QStandardPaths.writableLocation(QStandardPaths.AppDataLocation))
|
||||
confRoot = Path(QStandardPaths.writableLocation(
|
||||
QStandardPaths.StandardLocation.ConfigLocation)
|
||||
)
|
||||
dataRoot = Path(QStandardPaths.writableLocation(
|
||||
QStandardPaths.StandardLocation.AppDataLocation)
|
||||
)
|
||||
|
||||
self._confPath = confRoot.absolute() / self.appHandle # The user config location
|
||||
self._dataPath = dataRoot.absolute() / self.appHandle # The user data location
|
||||
@@ -83,7 +87,7 @@ class Config:
|
||||
# Localisation
|
||||
# Note that these paths must be strings
|
||||
self._nwLangPath = self._appPath / "assets" / "i18n"
|
||||
self._qtLangPath = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
|
||||
self._qtLangPath = QLibraryInfo.location(QLibraryInfo.LibraryLocation.TranslationsPath)
|
||||
|
||||
hasLocale = (self._nwLangPath / f"nw_{QLocale.system().name()}.qm").exists()
|
||||
self._qLocale = QLocale.system() if hasLocale else QLocale("en_GB")
|
||||
@@ -369,7 +373,7 @@ class Config:
|
||||
elif self.osDarwin and "Helvetica" in fontFam:
|
||||
self.textFont = "Helvetica"
|
||||
else:
|
||||
self.textFont = fontDB.systemFont(QFontDatabase.GeneralFont).family()
|
||||
self.textFont = fontDB.systemFont(QFontDatabase.SystemFont.GeneralFont).family()
|
||||
else:
|
||||
self.textFont = family
|
||||
return
|
||||
|
||||
@@ -32,7 +32,7 @@ from PyQt5.QtWidgets import (
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import readTextFile
|
||||
from novelwriter.common import cssCol, readTextFile
|
||||
from novelwriter.extensions.configlayout import NColourLabel
|
||||
from novelwriter.extensions.versioninfo import VersionInfoWidget
|
||||
from novelwriter.types import QtAlignRightTop, QtDialogClose
|
||||
@@ -70,7 +70,7 @@ class GuiAbout(QDialog):
|
||||
|
||||
self.nwLicence = QLabel(self.tr("This application is licenced under {0}").format(
|
||||
"<a href='https://www.gnu.org/licenses/gpl-3.0.html'>GPL v3.0</a>"
|
||||
))
|
||||
), self)
|
||||
self.nwLicence.setOpenExternalLinks(True)
|
||||
|
||||
# Credits
|
||||
@@ -147,10 +147,10 @@ class GuiAbout(QDialog):
|
||||
|
||||
def _setStyleSheet(self) -> None:
|
||||
"""Set stylesheet for all browser tabs."""
|
||||
baseCol = self.palette().window().color()
|
||||
self.txtCredits.setStyleSheet((
|
||||
"QTextBrowser {{border: none; background: rgb({r},{g},{b});}} "
|
||||
).format(r=baseCol.red(), g=baseCol.green(), b=baseCol.blue()))
|
||||
baseCol = cssCol(self.palette().window().color())
|
||||
self.txtCredits.setStyleSheet(
|
||||
f"QTextBrowser {{border: none; background: {baseCol};}} "
|
||||
)
|
||||
return
|
||||
|
||||
# END Class GuiAbout
|
||||
|
||||
@@ -54,7 +54,8 @@ class GuiDocMerge(QDialog):
|
||||
|
||||
self._data = {}
|
||||
|
||||
self.headLabel = QLabel("<b>{0}</b>".format(self.tr("Documents to Merge")))
|
||||
self.headLabel = QLabel(self.tr("Documents to Merge"), self)
|
||||
self.headLabel.setFont(SHARED.theme.guiFontB)
|
||||
self.helpLabel = NColourLabel(
|
||||
self.tr("Drag and drop items to change the order, or uncheck to exclude."),
|
||||
SHARED.theme.helpText, parent=self, wrap=True
|
||||
@@ -70,12 +71,12 @@ class GuiDocMerge(QDialog):
|
||||
self.listBox.setIconSize(iSz)
|
||||
self.listBox.setMinimumWidth(CONFIG.pxInt(400))
|
||||
self.listBox.setMinimumHeight(CONFIG.pxInt(180))
|
||||
self.listBox.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
self.listBox.setSelectionMode(QAbstractItemView.SingleSelection)
|
||||
self.listBox.setDragDropMode(QAbstractItemView.InternalMove)
|
||||
self.listBox.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
|
||||
self.listBox.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
self.listBox.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
|
||||
|
||||
# Merge Options
|
||||
self.trashLabel = QLabel(self.tr("Move merged items to Trash"))
|
||||
self.trashLabel = QLabel(self.tr("Move merged items to Trash"), self)
|
||||
self.trashSwitch = NSwitch(self, height=iPx)
|
||||
|
||||
self.optBox = QGridLayout()
|
||||
@@ -85,7 +86,7 @@ class GuiDocMerge(QDialog):
|
||||
self.optBox.setColumnStretch(2, 1)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel)
|
||||
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
|
||||
self.buttonBox.accepted.connect(self.accept)
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
|
||||
|
||||
@@ -58,7 +58,8 @@ class GuiDocSplit(QDialog):
|
||||
|
||||
self.setWindowTitle(self.tr("Split Document"))
|
||||
|
||||
self.headLabel = QLabel("<b>{0}</b>".format(self.tr("Document Headings")))
|
||||
self.headLabel = QLabel(self.tr("Document Headings"), self)
|
||||
self.headLabel.setFont(SHARED.theme.guiFontB)
|
||||
self.helpLabel = NColourLabel(
|
||||
self.tr("Select the maximum level to split into files."),
|
||||
SHARED.theme.helpText, parent=self, wrap=True
|
||||
@@ -76,8 +77,8 @@ class GuiDocSplit(QDialog):
|
||||
docHierarchy = pOptions.getBool("GuiDocSplit", "docHierarchy", True)
|
||||
|
||||
# Heading Selection
|
||||
self.listBox = QListWidget()
|
||||
self.listBox.setDragDropMode(QAbstractItemView.NoDragDrop)
|
||||
self.listBox = QListWidget(self)
|
||||
self.listBox.setDragDropMode(QAbstractItemView.DragDropMode.NoDragDrop)
|
||||
self.listBox.setMinimumWidth(CONFIG.pxInt(400))
|
||||
self.listBox.setMinimumHeight(CONFIG.pxInt(180))
|
||||
|
||||
@@ -92,15 +93,15 @@ class GuiDocSplit(QDialog):
|
||||
self.splitLevel.currentIndexChanged.connect(self._reloadList)
|
||||
|
||||
# Split Options
|
||||
self.folderLabel = QLabel(self.tr("Split into a new folder"))
|
||||
self.folderLabel = QLabel(self.tr("Split into a new folder"), self)
|
||||
self.folderSwitch = NSwitch(self, height=iPx)
|
||||
self.folderSwitch.setChecked(intoFolder)
|
||||
|
||||
self.hierarchyLabel = QLabel(self.tr("Create document hierarchy"))
|
||||
self.hierarchyLabel = QLabel(self.tr("Create document hierarchy"), self)
|
||||
self.hierarchySwitch = NSwitch(self, height=iPx)
|
||||
self.hierarchySwitch.setChecked(docHierarchy)
|
||||
|
||||
self.trashLabel = QLabel(self.tr("Move split document to Trash"))
|
||||
self.trashLabel = QLabel(self.tr("Move split document to Trash"), self)
|
||||
self.trashSwitch = NSwitch(self, height=iPx)
|
||||
|
||||
self.optBox = QGridLayout()
|
||||
@@ -115,7 +116,7 @@ class GuiDocSplit(QDialog):
|
||||
self.optBox.setColumnStretch(3, 1)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel)
|
||||
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
|
||||
self.buttonBox.accepted.connect(self.accept)
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
|
||||
|
||||
@@ -56,13 +56,13 @@ class GuiEditLabel(QDialog):
|
||||
self.labelValue.selectAll()
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel)
|
||||
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
|
||||
self.buttonBox.accepted.connect(self.accept)
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
|
||||
# Assemble
|
||||
self.innerBox = QHBoxLayout()
|
||||
self.innerBox.addWidget(QLabel(self.tr("Label")), 0)
|
||||
self.innerBox.addWidget(QLabel(self.tr("Label"), self), 0)
|
||||
self.innerBox.addWidget(self.labelValue, 1)
|
||||
self.innerBox.setSpacing(mSp)
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class GuiPreferences(QDialog):
|
||||
self.mainForm.setHelpTextStyle(SHARED.theme.helpText)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QtDialogApply | QtDialogSave | QtDialogClose)
|
||||
self.buttonBox = QDialogButtonBox(QtDialogApply | QtDialogSave | QtDialogClose, self)
|
||||
self.buttonBox.clicked.connect(self._dialogButtonClicked)
|
||||
|
||||
# Assemble
|
||||
@@ -811,7 +811,7 @@ class GuiPreferences(QDialog):
|
||||
"""Open a dialog to select the backup folder."""
|
||||
if path := QFileDialog.getExistingDirectory(
|
||||
self, self.tr("Backup Directory"), str(self.backupPath) or "",
|
||||
options=QFileDialog.ShowDirsOnly
|
||||
options=QFileDialog.Option.ShowDirsOnly
|
||||
):
|
||||
self.backupPath = path
|
||||
self.mainForm.setHelpText("backupPath", self.tr("Path: {0}").format(path))
|
||||
|
||||
@@ -84,7 +84,7 @@ class GuiProjectSettings(QDialog):
|
||||
self.sidebar.buttonClicked.connect(self._sidebarClicked)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QtDialogSave | QtDialogCancel)
|
||||
self.buttonBox = QDialogButtonBox(QtDialogSave | QtDialogCancel, self)
|
||||
self.buttonBox.accepted.connect(self._doSave)
|
||||
self.buttonBox.rejected.connect(self.close)
|
||||
|
||||
@@ -603,7 +603,7 @@ class _ReplacePage(NFixedPage):
|
||||
)
|
||||
|
||||
# List Box
|
||||
self.listBox = QTreeWidget()
|
||||
self.listBox = QTreeWidget(self)
|
||||
self.listBox.setHeaderLabels([self.tr("Keyword"), self.tr("Replace With")])
|
||||
self.listBox.setColumnWidth(self.COL_KEY, wCol0)
|
||||
self.listBox.setIndentation(0)
|
||||
|
||||
@@ -66,14 +66,14 @@ class GuiQuoteSelect(QDialog):
|
||||
lblFont.setPointSizeF(4*lblFont.pointSizeF())
|
||||
|
||||
# Preview Label
|
||||
self.previewLabel = QLabel(current)
|
||||
self.previewLabel = QLabel(current, self)
|
||||
self.previewLabel.setFont(lblFont)
|
||||
self.previewLabel.setFixedSize(QSize(pxW, pxH))
|
||||
self.previewLabel.setAlignment(QtAlignCenter)
|
||||
self.previewLabel.setFrameStyle(QFrame.Box | QFrame.Plain)
|
||||
self.previewLabel.setFrameStyle(QFrame.Shape.Box | QFrame.Shadow.Plain)
|
||||
|
||||
# Quote Symbols
|
||||
self.listBox = QListWidget()
|
||||
self.listBox = QListWidget(self)
|
||||
self.listBox.itemSelectionChanged.connect(self._selectedSymbol)
|
||||
|
||||
minSize = 100
|
||||
@@ -90,7 +90,7 @@ class GuiQuoteSelect(QDialog):
|
||||
self.listBox.setMinimumHeight(CONFIG.pxInt(150))
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel)
|
||||
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
|
||||
self.buttonBox.accepted.connect(self.accept)
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class GuiWordList(QDialog):
|
||||
|
||||
# List Box
|
||||
self.listBox = QListWidget(self)
|
||||
self.listBox.setDragDropMode(QAbstractItemView.NoDragDrop)
|
||||
self.listBox.setDragDropMode(QAbstractItemView.DragDropMode.NoDragDrop)
|
||||
self.listBox.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.listBox.setSortingEnabled(True)
|
||||
|
||||
@@ -111,7 +111,7 @@ class GuiWordList(QDialog):
|
||||
self.editBox.addWidget(self.delButton, 0)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QtDialogSave | QtDialogClose)
|
||||
self.buttonBox = QDialogButtonBox(QtDialogSave | QtDialogClose, self)
|
||||
self.buttonBox.accepted.connect(self._doSave)
|
||||
self.buttonBox.rejected.connect(self.close)
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class NProgressCircle(QProgressBar):
|
||||
bar=self.palette().highlight().color(),
|
||||
text=self.palette().text().color()
|
||||
)
|
||||
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
||||
self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
|
||||
self.setFixedWidth(size)
|
||||
self.setFixedHeight(size)
|
||||
return
|
||||
|
||||
@@ -59,7 +59,7 @@ class NPagedSideBar(QToolBar):
|
||||
self.setOrientation(Qt.Orientation.Vertical)
|
||||
|
||||
stretch = QWidget(self)
|
||||
stretch.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||
stretch.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||
self._stretchAction = self.addWidget(stretch)
|
||||
|
||||
return
|
||||
@@ -119,7 +119,7 @@ class _NPagedToolButton(QToolButton):
|
||||
def __init__(self, parent: QWidget) -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
|
||||
self.setCheckable(True)
|
||||
|
||||
fH = self.fontMetrics().height()
|
||||
@@ -197,7 +197,7 @@ class _NPagedToolLabel(QLabel):
|
||||
def __init__(self, parent: QWidget, textColor: QColor | None = None) -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
|
||||
|
||||
fH = self.fontMetrics().height()
|
||||
self._bH = round(fH * 1.7)
|
||||
|
||||
@@ -46,7 +46,7 @@ class NSwitch(QAbstractButton):
|
||||
self._rR = self._xR - self._rB
|
||||
|
||||
self.setCheckable(True)
|
||||
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
||||
self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
|
||||
self.setFixedWidth(self._xW)
|
||||
self.setFixedHeight(self._xH)
|
||||
self._offset = self._xR
|
||||
|
||||
@@ -58,8 +58,8 @@ class NSwitchBox(QScrollArea):
|
||||
self._content = QGridLayout()
|
||||
self._content.setColumnStretch(1, 1)
|
||||
|
||||
self._widget = QWidget()
|
||||
self._widget.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)
|
||||
self._widget = QWidget(self)
|
||||
self._widget.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Minimum)
|
||||
self._widget.setLayout(self._content)
|
||||
|
||||
self.setWidgetResizable(True)
|
||||
@@ -69,7 +69,7 @@ class NSwitchBox(QScrollArea):
|
||||
|
||||
def addLabel(self, text: str) -> None:
|
||||
"""Add a header label to the content box."""
|
||||
label = QLabel(text)
|
||||
label = QLabel(text, self)
|
||||
font = label.font()
|
||||
font.setBold(True)
|
||||
label.setFont(font)
|
||||
@@ -80,12 +80,12 @@ class NSwitchBox(QScrollArea):
|
||||
|
||||
def addItem(self, qIcon: QIcon, text: str, identifier: str, default: bool = False) -> None:
|
||||
"""Add an item to the content box."""
|
||||
icon = QLabel("")
|
||||
icon = QLabel("", self)
|
||||
icon.setAlignment(QtAlignRightMiddle)
|
||||
icon.setPixmap(qIcon.pixmap(self._sIcon, self._sIcon))
|
||||
self._content.addWidget(icon, self._index, 0, QtAlignLeft)
|
||||
|
||||
label = QLabel(text)
|
||||
label = QLabel(text, self)
|
||||
self._content.addWidget(label, self._index, 1, QtAlignLeft)
|
||||
|
||||
switch = NSwitch(self, height=self._hSwitch)
|
||||
@@ -100,7 +100,7 @@ class NSwitchBox(QScrollArea):
|
||||
|
||||
def addSeparator(self) -> None:
|
||||
"""Add a blank entry in the content box."""
|
||||
spacer = QWidget()
|
||||
spacer = QWidget(self)
|
||||
spacer.setFixedHeight(int(0.5*self._sIcon))
|
||||
self._content.addWidget(spacer, self._index, 0, 1, 3, QtAlignLeft)
|
||||
self._widgets.append(spacer)
|
||||
|
||||
@@ -65,7 +65,8 @@ from novelwriter.text.counting import standardCounter
|
||||
from novelwriter.tools.lipsum import GuiLipsum
|
||||
from novelwriter.types import (
|
||||
QtAlignCenterTop, QtAlignJustify, QtAlignLeft, QtAlignLeftTop,
|
||||
QtAlignRight, QtModCtrl, QtMouseLeft, QtModeNone, QtModShift
|
||||
QtAlignRight, QtKeepAnchor, QtModCtrl, QtMouseLeft, QtModeNone, QtModShift,
|
||||
QtMoveAnchor, QtMoveLeft, QtMoveRight
|
||||
)
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
@@ -656,8 +657,8 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
"""Make a text selection."""
|
||||
if start >= 0 and length > 0:
|
||||
cursor = self.textCursor()
|
||||
cursor.setPosition(start, QTextCursor.MoveMode.MoveAnchor)
|
||||
cursor.setPosition(start + length, QTextCursor.MoveMode.KeepAnchor)
|
||||
cursor.setPosition(start, QtMoveAnchor)
|
||||
cursor.setPosition(start + length, QtKeepAnchor)
|
||||
self.setTextCursor(cursor)
|
||||
return
|
||||
|
||||
@@ -1092,8 +1093,8 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
block = cursor.block()
|
||||
if block.isValid():
|
||||
pos += block.position()
|
||||
cursor.setPosition(pos, QTextCursor.MoveMode.MoveAnchor)
|
||||
cursor.setPosition(pos + length, QTextCursor.MoveMode.KeepAnchor)
|
||||
cursor.setPosition(pos, QtMoveAnchor)
|
||||
cursor.setPosition(pos + length, QtKeepAnchor)
|
||||
cursor.insertText(text)
|
||||
self._completer.hide()
|
||||
return
|
||||
@@ -1153,9 +1154,7 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
block = pCursor.block()
|
||||
sCursor = self.textCursor()
|
||||
sCursor.setPosition(block.position() + cPos)
|
||||
sCursor.movePosition(
|
||||
QTextCursor.MoveOperation.Right, QTextCursor.MoveMode.KeepAnchor, cLen
|
||||
)
|
||||
sCursor.movePosition(QtMoveRight, QtKeepAnchor, cLen)
|
||||
if suggest:
|
||||
ctxMenu.addSeparator()
|
||||
ctxMenu.addAction(self.tr("Spelling Suggestion(s)"))
|
||||
@@ -1351,8 +1350,8 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
else:
|
||||
resIdx = 0 if doLoop else maxIdx
|
||||
|
||||
cursor.setPosition(resS[resIdx], QTextCursor.MoveMode.MoveAnchor)
|
||||
cursor.setPosition(resE[resIdx], QTextCursor.MoveMode.KeepAnchor)
|
||||
cursor.setPosition(resS[resIdx], QtMoveAnchor)
|
||||
cursor.setPosition(resE[resIdx], QtKeepAnchor)
|
||||
self.setTextCursor(cursor)
|
||||
|
||||
self.docSearch.setResultCount(resIdx + 1, len(resS))
|
||||
@@ -1398,8 +1397,8 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
break
|
||||
|
||||
if hasSelection:
|
||||
cursor.setPosition(origA, QTextCursor.MoveMode.MoveAnchor)
|
||||
cursor.setPosition(origB, QTextCursor.MoveMode.KeepAnchor)
|
||||
cursor.setPosition(origA, QtMoveAnchor)
|
||||
cursor.setPosition(origB, QtKeepAnchor)
|
||||
else:
|
||||
cursor.setPosition(origA)
|
||||
|
||||
@@ -1502,8 +1501,8 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
if blockS != blockE:
|
||||
posE = blockS.position() + blockS.length() - 1
|
||||
cursor.clearSelection()
|
||||
cursor.setPosition(posS, QTextCursor.MoveMode.MoveAnchor)
|
||||
cursor.setPosition(posE, QTextCursor.MoveMode.KeepAnchor)
|
||||
cursor.setPosition(posS, QtMoveAnchor)
|
||||
cursor.setPosition(posE, QtKeepAnchor)
|
||||
self.setTextCursor(cursor)
|
||||
|
||||
numB = 0
|
||||
@@ -1580,8 +1579,8 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
if select == _SelectAction.MOVE_AFTER:
|
||||
cursor.setPosition(posE + len(before + after))
|
||||
elif select == _SelectAction.KEEP_SELECTION:
|
||||
cursor.setPosition(posE + len(before), QTextCursor.MoveMode.MoveAnchor)
|
||||
cursor.setPosition(posS + len(before), QTextCursor.MoveMode.KeepAnchor)
|
||||
cursor.setPosition(posE + len(before), QtMoveAnchor)
|
||||
cursor.setPosition(posS + len(before), QtKeepAnchor)
|
||||
elif select == _SelectAction.KEEP_POSITION:
|
||||
cursor.setPosition(posO + len(before))
|
||||
|
||||
@@ -1603,9 +1602,7 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
self._allowAutoReplace(False)
|
||||
for posC in range(posS, posE+1):
|
||||
cursor.setPosition(posC)
|
||||
cursor.movePosition(
|
||||
QTextCursor.MoveOperation.Left, QTextCursor.MoveMode.KeepAnchor, 2
|
||||
)
|
||||
cursor.movePosition(QtMoveLeft, QtKeepAnchor, 2)
|
||||
selText = cursor.selectedText()
|
||||
|
||||
nS = len(selText)
|
||||
@@ -1625,16 +1622,12 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
cursor.setPosition(posC)
|
||||
if pC in closeCheck:
|
||||
cursor.beginEditBlock()
|
||||
cursor.movePosition(
|
||||
QTextCursor.MoveOperation.Left, QTextCursor.MoveMode.KeepAnchor, 1
|
||||
)
|
||||
cursor.movePosition(QtMoveLeft, QtKeepAnchor, 1)
|
||||
cursor.insertText(oQuote)
|
||||
cursor.endEditBlock()
|
||||
else:
|
||||
cursor.beginEditBlock()
|
||||
cursor.movePosition(
|
||||
QTextCursor.MoveOperation.Left, QTextCursor.MoveMode.KeepAnchor, 1
|
||||
)
|
||||
cursor.movePosition(QtMoveLeft, QtKeepAnchor, 1)
|
||||
cursor.insertText(cQuote)
|
||||
cursor.endEditBlock()
|
||||
|
||||
@@ -1850,9 +1843,7 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
cursor.beginEditBlock()
|
||||
cursor.clearSelection()
|
||||
cursor.setPosition(rS)
|
||||
cursor.movePosition(
|
||||
QTextCursor.MoveOperation.Right, QTextCursor.MoveMode.KeepAnchor, rE-rS
|
||||
)
|
||||
cursor.movePosition(QtMoveRight, QtKeepAnchor, rE-rS)
|
||||
cursor.insertText(cleanText.rstrip() + "\n")
|
||||
cursor.endEditBlock()
|
||||
|
||||
@@ -2018,9 +2009,7 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
tInsert = tInsert + self._typPadChar
|
||||
|
||||
if nDelete > 0:
|
||||
cursor.movePosition(
|
||||
QTextCursor.MoveOperation.Left, QTextCursor.MoveMode.KeepAnchor, nDelete
|
||||
)
|
||||
cursor.movePosition(QtMoveLeft, QtKeepAnchor, nDelete)
|
||||
cursor.insertText(tInsert)
|
||||
|
||||
return
|
||||
@@ -2076,8 +2065,8 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
return cursor
|
||||
|
||||
cursor.clearSelection()
|
||||
cursor.setPosition(sPos, QTextCursor.MoveMode.MoveAnchor)
|
||||
cursor.setPosition(ePos, QTextCursor.MoveMode.KeepAnchor)
|
||||
cursor.setPosition(sPos, QtMoveAnchor)
|
||||
cursor.setPosition(ePos, QtKeepAnchor)
|
||||
|
||||
self.setTextCursor(cursor)
|
||||
|
||||
@@ -2101,8 +2090,8 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
posE = cursor.selectionEnd()
|
||||
selTxt = cursor.selectedText()
|
||||
if selTxt.startswith(nwUnicode.U_PSEP):
|
||||
cursor.setPosition(posS+1, QTextCursor.MoveMode.MoveAnchor)
|
||||
cursor.setPosition(posE, QTextCursor.MoveMode.KeepAnchor)
|
||||
cursor.setPosition(posS+1, QtMoveAnchor)
|
||||
cursor.setPosition(posE, QtKeepAnchor)
|
||||
|
||||
self.setTextCursor(cursor)
|
||||
|
||||
@@ -2441,11 +2430,11 @@ class GuiDocEditSearch(QFrame):
|
||||
self.searchOpt.setIconSize(iSz)
|
||||
self.searchOpt.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.searchLabel = QLabel(self.tr("Search"))
|
||||
self.searchLabel = QLabel(self.tr("Search"), self)
|
||||
self.searchLabel.setFont(self.boxFont)
|
||||
self.searchLabel.setIndent(CONFIG.pxInt(6))
|
||||
|
||||
self.resultLabel = QLabel("?/?")
|
||||
self.resultLabel = QLabel("?/?", self)
|
||||
self.resultLabel.setFont(self.boxFont)
|
||||
self.resultLabel.setMinimumWidth(SHARED.theme.getTextWidth("?/?", self.boxFont))
|
||||
|
||||
@@ -3047,7 +3036,7 @@ class GuiDocEditFooter(QWidget):
|
||||
self.statusIcon.setFixedHeight(iPx)
|
||||
self.statusIcon.setAlignment(QtAlignLeftTop)
|
||||
|
||||
self.statusText = QLabel(self.tr("Status"))
|
||||
self.statusText = QLabel(self.tr("Status"), self)
|
||||
self.statusText.setIndent(0)
|
||||
self.statusText.setMargin(0)
|
||||
self.statusText.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
@@ -116,7 +116,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
# Cache Spell Error Format
|
||||
self._spellErr = QTextCharFormat()
|
||||
self._spellErr.setUnderlineColor(SHARED.theme.colSpell)
|
||||
self._spellErr.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline)
|
||||
self._spellErr.setUnderlineStyle(QTextCharFormat.UnderlineStyle.SpellCheckUnderline)
|
||||
|
||||
# Multiple or Trailing Spaces
|
||||
if CONFIG.showMultiSpaces:
|
||||
|
||||
@@ -49,7 +49,9 @@ from novelwriter.error import logException
|
||||
from novelwriter.extensions.eventfilters import WheelEventFilter
|
||||
from novelwriter.extensions.modified import NIconToolButton
|
||||
from novelwriter.gui.theme import STYLES_MIN_TOOLBUTTON
|
||||
from novelwriter.types import QtAlignCenterTop, QtAlignJustify, QtMouseLeft
|
||||
from novelwriter.types import (
|
||||
QtAlignCenterTop, QtAlignJustify, QtKeepAnchor, QtMouseLeft, QtMoveAnchor
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -452,8 +454,8 @@ class GuiDocViewer(QTextBrowser):
|
||||
posE = cursor.selectionEnd()
|
||||
selTxt = cursor.selectedText()
|
||||
if selTxt.startswith(nwUnicode.U_PSEP):
|
||||
cursor.setPosition(posS+1, QTextCursor.MoveMode.MoveAnchor)
|
||||
cursor.setPosition(posE, QTextCursor.MoveMode.KeepAnchor)
|
||||
cursor.setPosition(posS+1, QtMoveAnchor)
|
||||
cursor.setPosition(posE, QtKeepAnchor)
|
||||
|
||||
self.setTextCursor(cursor)
|
||||
|
||||
@@ -635,7 +637,7 @@ class GuiDocViewHeader(QWidget):
|
||||
self.setAutoFillBackground(True)
|
||||
|
||||
# Title Label
|
||||
self.itemTitle = QLabel()
|
||||
self.itemTitle = QLabel(self)
|
||||
self.itemTitle.setText("")
|
||||
self.itemTitle.setIndent(0)
|
||||
self.itemTitle.setMargin(0)
|
||||
|
||||
@@ -115,25 +115,25 @@ class GuiItemDetails(QWidget):
|
||||
self.cCountName.setFont(fntLabel)
|
||||
self.cCountName.setAlignment(QtAlignRight)
|
||||
|
||||
self.cCountData = QLabel("")
|
||||
self.cCountData = QLabel("", self)
|
||||
self.cCountData.setFont(fntValue)
|
||||
self.cCountData.setAlignment(QtAlignRight)
|
||||
|
||||
# Word Count
|
||||
self.wCountName = QLabel(" "+self.tr("Words"))
|
||||
self.wCountName = QLabel(" "+self.tr("Words"), self)
|
||||
self.wCountName.setFont(fntLabel)
|
||||
self.wCountName.setAlignment(QtAlignRight)
|
||||
|
||||
self.wCountData = QLabel("")
|
||||
self.wCountData = QLabel("", self)
|
||||
self.wCountData.setFont(fntValue)
|
||||
self.wCountData.setAlignment(QtAlignRight)
|
||||
|
||||
# Paragraph Count
|
||||
self.pCountName = QLabel(" "+self.tr("Paragraphs"))
|
||||
self.pCountName = QLabel(" "+self.tr("Paragraphs"), self)
|
||||
self.pCountName.setFont(fntLabel)
|
||||
self.pCountName.setAlignment(QtAlignRight)
|
||||
|
||||
self.pCountData = QLabel("")
|
||||
self.pCountData = QLabel("", self)
|
||||
self.pCountData.setFont(fntValue)
|
||||
self.pCountData.setAlignment(QtAlignRight)
|
||||
|
||||
|
||||
+35
-35
@@ -70,7 +70,7 @@ class GuiOutlineView(QWidget):
|
||||
self.outlineBar = GuiOutlineToolBar(self)
|
||||
self.outlineBar.setEnabled(False)
|
||||
|
||||
self.splitOutline = QSplitter(Qt.Orientation.Vertical)
|
||||
self.splitOutline = QSplitter(Qt.Orientation.Vertical, self)
|
||||
self.splitOutline.addWidget(self.outlineTree)
|
||||
self.splitOutline.addWidget(self.outlineData)
|
||||
self.splitOutline.setOpaqueResize(False)
|
||||
@@ -220,7 +220,7 @@ class GuiOutlineToolBar(QToolBar):
|
||||
stretch.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||
|
||||
# Novel Selector
|
||||
self.novelLabel = QLabel(self.tr("Outline of"))
|
||||
self.novelLabel = QLabel(self.tr("Outline of"), self)
|
||||
self.novelLabel.setContentsMargins(0, 0, mPx, 0)
|
||||
|
||||
self.novelValue = NovelSelector(self)
|
||||
@@ -803,12 +803,12 @@ class GuiOutlineDetails(QScrollArea):
|
||||
bFont = SHARED.theme.guiFontB
|
||||
|
||||
# Details Area
|
||||
self.titleLabel = QLabel(self.tr("Title"))
|
||||
self.fileLabel = QLabel(self.tr("Document"))
|
||||
self.itemLabel = QLabel(self.tr("Status"))
|
||||
self.titleValue = QLabel("")
|
||||
self.fileValue = QLabel("")
|
||||
self.itemValue = QLabel("")
|
||||
self.titleLabel = QLabel(self.tr("Title"), self)
|
||||
self.fileLabel = QLabel(self.tr("Document"), self)
|
||||
self.itemLabel = QLabel(self.tr("Status"), self)
|
||||
self.titleValue = QLabel("", self)
|
||||
self.fileValue = QLabel("", self)
|
||||
self.itemValue = QLabel("", self)
|
||||
|
||||
self.titleLabel.setFont(bFont)
|
||||
self.fileLabel.setFont(bFont)
|
||||
@@ -822,12 +822,12 @@ class GuiOutlineDetails(QScrollArea):
|
||||
self.itemValue.setMaximumWidth(maxTitle)
|
||||
|
||||
# Stats Area
|
||||
self.cCLabel = QLabel(self.tr("Characters"))
|
||||
self.wCLabel = QLabel(self.tr("Words"))
|
||||
self.pCLabel = QLabel(self.tr("Paragraphs"))
|
||||
self.cCValue = QLabel("")
|
||||
self.wCValue = QLabel("")
|
||||
self.pCValue = QLabel("")
|
||||
self.cCLabel = QLabel(self.tr("Characters"), self)
|
||||
self.wCLabel = QLabel(self.tr("Words"), self)
|
||||
self.pCLabel = QLabel(self.tr("Paragraphs"), self)
|
||||
self.cCValue = QLabel("", self)
|
||||
self.wCValue = QLabel("", self)
|
||||
self.pCValue = QLabel("", self)
|
||||
|
||||
self.cCLabel.setFont(bFont)
|
||||
self.wCLabel.setFont(bFont)
|
||||
@@ -841,10 +841,10 @@ class GuiOutlineDetails(QScrollArea):
|
||||
self.pCValue.setAlignment(QtAlignRight)
|
||||
|
||||
# Synopsis
|
||||
self.synopLabel = QLabel(self.tr("Synopsis"))
|
||||
self.synopLabel = QLabel(self.tr("Synopsis"), self)
|
||||
self.synopLabel.setFont(bFont)
|
||||
|
||||
self.synopValue = QLabel("")
|
||||
self.synopValue = QLabel("", self)
|
||||
self.synopValue.setWordWrap(True)
|
||||
self.synopValue.setAlignment(QtAlignLeftTop)
|
||||
|
||||
@@ -852,15 +852,15 @@ class GuiOutlineDetails(QScrollArea):
|
||||
self.synopLWrap.addWidget(self.synopValue, 1)
|
||||
|
||||
# Tags
|
||||
self.povKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.POV_KEY]))
|
||||
self.focKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.FOCUS_KEY]))
|
||||
self.chrKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.CHAR_KEY]))
|
||||
self.pltKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.PLOT_KEY]))
|
||||
self.timKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.TIME_KEY]))
|
||||
self.wldKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.WORLD_KEY]))
|
||||
self.objKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.OBJECT_KEY]))
|
||||
self.entKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.ENTITY_KEY]))
|
||||
self.cstKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.CUSTOM_KEY]))
|
||||
self.povKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.POV_KEY]), self)
|
||||
self.focKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.FOCUS_KEY]), self)
|
||||
self.chrKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.CHAR_KEY]), self)
|
||||
self.pltKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.PLOT_KEY]), self)
|
||||
self.timKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.TIME_KEY]), self)
|
||||
self.wldKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.WORLD_KEY]), self)
|
||||
self.objKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.OBJECT_KEY]), self)
|
||||
self.entKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.ENTITY_KEY]), self)
|
||||
self.cstKeyLabel = QLabel(trConst(nwLabels.KEY_NAME[nwKeyWords.CUSTOM_KEY]), self)
|
||||
|
||||
self.povKeyLabel.setFont(bFont)
|
||||
self.focKeyLabel.setFont(bFont)
|
||||
@@ -882,15 +882,15 @@ class GuiOutlineDetails(QScrollArea):
|
||||
self.entKeyLWrap = QHBoxLayout()
|
||||
self.cstKeyLWrap = QHBoxLayout()
|
||||
|
||||
self.povKeyValue = QLabel("")
|
||||
self.focKeyValue = QLabel("")
|
||||
self.chrKeyValue = QLabel("")
|
||||
self.pltKeyValue = QLabel("")
|
||||
self.timKeyValue = QLabel("")
|
||||
self.wldKeyValue = QLabel("")
|
||||
self.objKeyValue = QLabel("")
|
||||
self.entKeyValue = QLabel("")
|
||||
self.cstKeyValue = QLabel("")
|
||||
self.povKeyValue = QLabel("", self)
|
||||
self.focKeyValue = QLabel("", self)
|
||||
self.chrKeyValue = QLabel("", self)
|
||||
self.pltKeyValue = QLabel("", self)
|
||||
self.timKeyValue = QLabel("", self)
|
||||
self.wldKeyValue = QLabel("", self)
|
||||
self.objKeyValue = QLabel("", self)
|
||||
self.entKeyValue = QLabel("", self)
|
||||
self.cstKeyValue = QLabel("", self)
|
||||
|
||||
self.povKeyValue.setWordWrap(True)
|
||||
self.focKeyValue.setWordWrap(True)
|
||||
@@ -977,7 +977,7 @@ class GuiOutlineDetails(QScrollArea):
|
||||
self.tagsForm.setVerticalSpacing(vSpace)
|
||||
|
||||
# Assemble
|
||||
self.outerWidget = QWidget()
|
||||
self.outerWidget = QWidget(self)
|
||||
self.outerBox = QHBoxLayout()
|
||||
self.outerBox.addWidget(self.mainGroup, 0)
|
||||
self.outerBox.addWidget(self.tagsGroup, 1)
|
||||
|
||||
@@ -271,7 +271,7 @@ class GuiProjectToolBar(QWidget):
|
||||
self.setAutoFillBackground(True)
|
||||
|
||||
# Widget Label
|
||||
self.viewLabel = QLabel(self.tr("Project Content"))
|
||||
self.viewLabel = QLabel(self.tr("Project Content"), self)
|
||||
self.viewLabel.setFont(SHARED.theme.guiFontB)
|
||||
self.viewLabel.setContentsMargins(0, 0, 0, 0)
|
||||
self.viewLabel.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||
|
||||
@@ -71,7 +71,7 @@ class GuiProjectSearch(QWidget):
|
||||
self._map: dict[str, tuple[int, float]] = {}
|
||||
|
||||
# Header
|
||||
self.viewLabel = QLabel(self.tr("Project Search"))
|
||||
self.viewLabel = QLabel(self.tr("Project Search"), self)
|
||||
self.viewLabel.setFont(SHARED.theme.guiFontB)
|
||||
self.viewLabel.setContentsMargins(mPx, tPx, 0, mPx)
|
||||
|
||||
|
||||
@@ -66,8 +66,8 @@ class GuiMainStatus(QStatusBar):
|
||||
xM = CONFIG.pxInt(8)
|
||||
|
||||
# The Spell Checker Language
|
||||
self.langIcon = QLabel("")
|
||||
self.langText = QLabel(self.tr("None"))
|
||||
self.langIcon = QLabel("", self)
|
||||
self.langText = QLabel(self.tr("None"), self)
|
||||
self.langIcon.setContentsMargins(0, 0, 0, 0)
|
||||
self.langText.setContentsMargins(0, 0, xM, 0)
|
||||
self.addPermanentWidget(self.langIcon)
|
||||
@@ -75,7 +75,7 @@ class GuiMainStatus(QStatusBar):
|
||||
|
||||
# The Editor Status
|
||||
self.docIcon = StatusLED(colNone, colSaved, colUnsaved, iPx, iPx, self)
|
||||
self.docText = QLabel(self.tr("Editor"))
|
||||
self.docText = QLabel(self.tr("Editor"), self)
|
||||
self.docIcon.setContentsMargins(0, 0, 0, 0)
|
||||
self.docText.setContentsMargins(0, 0, xM, 0)
|
||||
self.addPermanentWidget(self.docIcon)
|
||||
@@ -83,15 +83,15 @@ class GuiMainStatus(QStatusBar):
|
||||
|
||||
# The Project Status
|
||||
self.projIcon = StatusLED(colNone, colSaved, colUnsaved, iPx, iPx, self)
|
||||
self.projText = QLabel(self.tr("Project"))
|
||||
self.projText = QLabel(self.tr("Project"), self)
|
||||
self.projIcon.setContentsMargins(0, 0, 0, 0)
|
||||
self.projText.setContentsMargins(0, 0, xM, 0)
|
||||
self.addPermanentWidget(self.projIcon)
|
||||
self.addPermanentWidget(self.projText)
|
||||
|
||||
# The Project and Session Stats
|
||||
self.statsIcon = QLabel()
|
||||
self.statsText = QLabel("")
|
||||
self.statsIcon = QLabel(self)
|
||||
self.statsText = QLabel("", self)
|
||||
self.statsIcon.setContentsMargins(0, 0, 0, 0)
|
||||
self.statsText.setContentsMargins(0, 0, xM, 0)
|
||||
self.addPermanentWidget(self.statsIcon)
|
||||
@@ -99,8 +99,8 @@ class GuiMainStatus(QStatusBar):
|
||||
|
||||
# The Session Clock
|
||||
# Set the minimum width so the label doesn't rescale every second
|
||||
self.timeIcon = QLabel()
|
||||
self.timeText = QLabel("")
|
||||
self.timeIcon = QLabel(self)
|
||||
self.timeText = QLabel("", self)
|
||||
self.timeText.setToolTip(self.tr("Session Time"))
|
||||
self.timeText.setMinimumWidth(SHARED.theme.getTextWidth("00:00:00:"))
|
||||
self.timeIcon.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
@@ -171,7 +171,9 @@ class GuiTheme:
|
||||
# Monospace Font
|
||||
self.guiFontFixed = QFont()
|
||||
self.guiFontFixed.setPointSizeF(0.95*self.fontPointSize)
|
||||
self.guiFontFixed.setFamily(QFontDatabase.systemFont(QFontDatabase.FixedFont).family())
|
||||
self.guiFontFixed.setFamily(
|
||||
QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont).family()
|
||||
)
|
||||
|
||||
logger.debug("GUI Font Family: %s", self.guiFont.family())
|
||||
logger.debug("GUI Font Point Size: %.2f", self.fontPointSize)
|
||||
@@ -401,7 +403,7 @@ class GuiTheme:
|
||||
font.setFamily("Arial")
|
||||
font.setPointSize(10)
|
||||
else:
|
||||
font = fontDB.systemFont(QFontDatabase.GeneralFont)
|
||||
font = fontDB.systemFont(QFontDatabase.SystemFont.GeneralFont)
|
||||
CONFIG.guiFont = font.family()
|
||||
CONFIG.guiFontSize = font.pointSize()
|
||||
else:
|
||||
|
||||
@@ -71,7 +71,7 @@ class GuiDictionaries(QDialog):
|
||||
self.tr("Download a dictionary from one of the links, and add it below."),
|
||||
f" \u203a <a href='{foUrl}'>{foUrl}</a>",
|
||||
f" \u203a <a href='{loUrl}'>{loUrl}</a>",
|
||||
]))
|
||||
]), self)
|
||||
self.huInfo.setOpenExternalLinks(True)
|
||||
self.huInfo.setWordWrap(True)
|
||||
self.huInput = QLineEdit(self)
|
||||
@@ -90,7 +90,7 @@ class GuiDictionaries(QDialog):
|
||||
self.huAddBox.addWidget(self.huImport)
|
||||
|
||||
# Install Path
|
||||
self.inInfo = QLabel(self.tr("Dictionary install location"))
|
||||
self.inInfo = QLabel(self.tr("Dictionary install location"), self)
|
||||
self.inPath = QLineEdit(self)
|
||||
self.inPath.setReadOnly(True)
|
||||
self.inBrowse = NIconToolButton(self, iSz, "browse")
|
||||
@@ -108,7 +108,7 @@ class GuiDictionaries(QDialog):
|
||||
self.infoBox.setFrameStyle(QFrame.Shape.NoFrame)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QtDialogClose)
|
||||
self.buttonBox = QDialogButtonBox(QtDialogClose, self)
|
||||
self.buttonBox.rejected.connect(self._doClose)
|
||||
|
||||
# Assemble
|
||||
|
||||
@@ -61,7 +61,7 @@ class GuiLipsum(QDialog):
|
||||
self.innerBox.setSpacing(CONFIG.pxInt(16))
|
||||
|
||||
# Icon
|
||||
self.docIcon = QLabel()
|
||||
self.docIcon = QLabel(self)
|
||||
self.docIcon.setPixmap(SHARED.theme.getPixmap("proj_document", (nPx, nPx)))
|
||||
|
||||
self.leftBox = QVBoxLayout()
|
||||
@@ -71,15 +71,16 @@ class GuiLipsum(QDialog):
|
||||
self.innerBox.addLayout(self.leftBox)
|
||||
|
||||
# Form
|
||||
self.headLabel = QLabel("<b>{0}</b>".format(self.tr("Insert Lorem Ipsum Text")))
|
||||
self.headLabel = QLabel(self.tr("Insert Lorem Ipsum Text"))
|
||||
self.headLabel.setFont(SHARED.theme.guiFontB)
|
||||
|
||||
self.paraLabel = QLabel(self.tr("Number of paragraphs"))
|
||||
self.paraCount = QSpinBox()
|
||||
self.paraLabel = QLabel(self.tr("Number of paragraphs"), self)
|
||||
self.paraCount = QSpinBox(self)
|
||||
self.paraCount.setMinimum(1)
|
||||
self.paraCount.setMaximum(100)
|
||||
self.paraCount.setValue(5)
|
||||
|
||||
self.randLabel = QLabel(self.tr("Randomise order"))
|
||||
self.randLabel = QLabel(self.tr("Randomise order"), self)
|
||||
self.randSwitch = NSwitch(self)
|
||||
|
||||
self.formBox = QGridLayout()
|
||||
@@ -93,7 +94,7 @@ class GuiLipsum(QDialog):
|
||||
self.innerBox.addLayout(self.formBox)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox()
|
||||
self.buttonBox = QDialogButtonBox(self)
|
||||
self.buttonBox.rejected.connect(self.close)
|
||||
|
||||
self.btnClose = self.buttonBox.addButton(QtDialogClose)
|
||||
|
||||
@@ -90,8 +90,8 @@ class GuiManuscriptBuild(QDialog):
|
||||
# Output Format
|
||||
# =============
|
||||
|
||||
self.lblFormat = QLabel(self.tr("Output Format"))
|
||||
self.listFormats = QListWidget()
|
||||
self.lblFormat = QLabel(self.tr("Output Format"), self)
|
||||
self.listFormats = QListWidget(self)
|
||||
self.listFormats.setIconSize(iSz)
|
||||
current = None
|
||||
for key in nwBuildFmt:
|
||||
@@ -109,14 +109,14 @@ class GuiManuscriptBuild(QDialog):
|
||||
self.formatBox.addWidget(self.listFormats, 1)
|
||||
self.formatBox.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.formatWidget = QWidget()
|
||||
self.formatWidget = QWidget(self)
|
||||
self.formatWidget.setLayout(self.formatBox)
|
||||
self.formatWidget.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
# Table of Contents
|
||||
# =================
|
||||
|
||||
self.lblContent = QLabel(self.tr("Table of Contents"))
|
||||
self.lblContent = QLabel(self.tr("Table of Contents"), self)
|
||||
|
||||
self.listContent = QListWidget(self)
|
||||
self.listContent.setIconSize(iSz)
|
||||
@@ -127,7 +127,7 @@ class GuiManuscriptBuild(QDialog):
|
||||
self.contentBox.addWidget(self.listContent, 0)
|
||||
self.contentBox.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.contentWidget = QWidget()
|
||||
self.contentWidget = QWidget(self)
|
||||
self.contentWidget.setLayout(self.contentBox)
|
||||
self.contentWidget.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
@@ -139,12 +139,12 @@ class GuiManuscriptBuild(QDialog):
|
||||
font.setUnderline(True)
|
||||
font.setPointSizeF(1.5*font.pointSizeF())
|
||||
|
||||
self.lblMain = QLabel(self._build.name)
|
||||
self.lblMain = QLabel(self._build.name, self)
|
||||
self.lblMain.setWordWrap(True)
|
||||
self.lblMain.setFont(font)
|
||||
|
||||
# Build Path
|
||||
self.lblPath = QLabel(self.tr("Path"))
|
||||
self.lblPath = QLabel(self.tr("Path"), self)
|
||||
self.buildPath = QLineEdit(self)
|
||||
self.btnBrowse = NIconToolButton(self, iSz, "browse")
|
||||
|
||||
@@ -154,7 +154,7 @@ class GuiManuscriptBuild(QDialog):
|
||||
self.pathBox.setSpacing(sp8)
|
||||
|
||||
# Build Name
|
||||
self.lblName = QLabel(self.tr("File Name"))
|
||||
self.lblName = QLabel(self.tr("File Name"), self)
|
||||
self.buildName = QLineEdit(self)
|
||||
self.btnReset = NIconToolButton(self, iSz, "revert")
|
||||
self.btnReset.setToolTip(self.tr("Reset file name to default"))
|
||||
@@ -181,19 +181,19 @@ class GuiManuscriptBuild(QDialog):
|
||||
self.buildBox.setVerticalSpacing(sp4)
|
||||
|
||||
# Dialog Buttons
|
||||
self.btnOpen = QPushButton(SHARED.theme.getIcon("browse"), self.tr("Open Folder"))
|
||||
self.btnOpen = QPushButton(SHARED.theme.getIcon("browse"), self.tr("Open Folder"), self)
|
||||
self.btnOpen.setIconSize(bSz)
|
||||
self.btnBuild = QPushButton(SHARED.theme.getIcon("export"), self.tr("&Build"))
|
||||
self.btnBuild = QPushButton(SHARED.theme.getIcon("export"), self.tr("&Build"), self)
|
||||
self.btnBuild.setIconSize(bSz)
|
||||
|
||||
self.dlgButtons = QDialogButtonBox(QtDialogClose)
|
||||
self.dlgButtons = QDialogButtonBox(QtDialogClose, self)
|
||||
self.dlgButtons.addButton(self.btnOpen, QtRoleAction)
|
||||
self.dlgButtons.addButton(self.btnBuild, QtRoleAction)
|
||||
|
||||
# Assemble GUI
|
||||
# ============
|
||||
|
||||
self.mainSplit = QSplitter()
|
||||
self.mainSplit = QSplitter(self)
|
||||
self.mainSplit.addWidget(self.formatWidget)
|
||||
self.mainSplit.addWidget(self.contentWidget)
|
||||
self.mainSplit.setHandleWidth(sp16)
|
||||
|
||||
@@ -124,7 +124,7 @@ class GuiManuscript(QDialog):
|
||||
self.tbEdit.setStyleSheet(buttonStyle)
|
||||
self.tbEdit.clicked.connect(self._editSelectedBuild)
|
||||
|
||||
self.lblBuilds = QLabel("<b>{0}</b>".format(self.tr("Builds")))
|
||||
self.lblBuilds = QLabel("<b>{0}</b>".format(self.tr("Builds")), self)
|
||||
|
||||
self.listToolBox = QHBoxLayout()
|
||||
self.listToolBox.addWidget(self.lblBuilds)
|
||||
@@ -141,8 +141,8 @@ class GuiManuscript(QDialog):
|
||||
self.buildList.setIconSize(iSz)
|
||||
self.buildList.doubleClicked.connect(self._editSelectedBuild)
|
||||
self.buildList.currentItemChanged.connect(self._updateBuildDetails)
|
||||
self.buildList.setSelectionMode(QAbstractItemView.SingleSelection)
|
||||
self.buildList.setDragDropMode(QAbstractItemView.InternalMove)
|
||||
self.buildList.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
self.buildList.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
|
||||
|
||||
# Details Tabs
|
||||
# ============
|
||||
@@ -170,16 +170,16 @@ class GuiManuscript(QDialog):
|
||||
# Process Controls
|
||||
# ================
|
||||
|
||||
self.btnPreview = QPushButton(self.tr("Preview"))
|
||||
self.btnPreview = QPushButton(self.tr("Preview"), self)
|
||||
self.btnPreview.clicked.connect(self._generatePreview)
|
||||
|
||||
self.btnPrint = QPushButton(self.tr("Print"))
|
||||
self.btnPrint = QPushButton(self.tr("Print"), self)
|
||||
self.btnPrint.clicked.connect(self._printDocument)
|
||||
|
||||
self.btnBuild = QPushButton(self.tr("Build"))
|
||||
self.btnBuild = QPushButton(self.tr("Build"), self)
|
||||
self.btnBuild.clicked.connect(self._buildManuscript)
|
||||
|
||||
self.btnClose = QPushButton(self.tr("Close"))
|
||||
self.btnClose = QPushButton(self.tr("Close"), self)
|
||||
self.btnClose.clicked.connect(self.close)
|
||||
|
||||
self.processBox = QGridLayout()
|
||||
@@ -211,7 +211,7 @@ class GuiManuscript(QDialog):
|
||||
self.optsWidget = QWidget(self)
|
||||
self.optsWidget.setLayout(self.controlBox)
|
||||
|
||||
self.mainSplit = QSplitter()
|
||||
self.mainSplit = QSplitter(self)
|
||||
self.mainSplit.addWidget(self.optsWidget)
|
||||
self.mainSplit.addWidget(self.docWdiget)
|
||||
self.mainSplit.setCollapsible(0, False)
|
||||
@@ -906,7 +906,7 @@ class _PreviewWidget(QTextBrowser):
|
||||
def printPreview(self, printer: QPrinter) -> None:
|
||||
"""Connect the print preview painter to the document viewer."""
|
||||
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
|
||||
printer.setOrientation(QPrinter.Portrait)
|
||||
printer.setOrientation(QPrinter.Orientation.Portrait)
|
||||
self.document().print(printer)
|
||||
QApplication.restoreOverrideCursor()
|
||||
return
|
||||
@@ -1054,10 +1054,10 @@ class _StatsWidget(QWidget):
|
||||
"""Build the minimal stats page."""
|
||||
mPx = CONFIG.pxInt(8)
|
||||
|
||||
self.lblWordCount = QLabel(self.tr("Words"))
|
||||
self.lblWordCount = QLabel(self.tr("Words"), self)
|
||||
self.minWordCount = QLabel(self)
|
||||
|
||||
self.lblCharCount = QLabel(self.tr("Characters"))
|
||||
self.lblCharCount = QLabel(self.tr("Characters"), self)
|
||||
self.minCharCount = QLabel(self)
|
||||
|
||||
# Assemble
|
||||
|
||||
@@ -102,7 +102,7 @@ class GuiBuildSettings(QDialog):
|
||||
)
|
||||
|
||||
# Settings Name
|
||||
self.lblBuildName = QLabel(self.tr("Name"))
|
||||
self.lblBuildName = QLabel(self.tr("Name"), self)
|
||||
self.editBuildName = QLineEdit(self)
|
||||
|
||||
# SideBar
|
||||
@@ -134,7 +134,7 @@ class GuiBuildSettings(QDialog):
|
||||
self.toolStack.addWidget(self.optTabOutput)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QtDialogApply | QtDialogSave | QtDialogClose)
|
||||
self.buttonBox = QDialogButtonBox(QtDialogApply | QtDialogSave | QtDialogClose, self)
|
||||
self.buttonBox.clicked.connect(self._dialogButtonClicked)
|
||||
|
||||
# Assemble
|
||||
@@ -331,15 +331,15 @@ class _FilterTab(NFixedPage):
|
||||
treeHeader = self.optTree.header()
|
||||
treeHeader.setStretchLastSection(False)
|
||||
treeHeader.setMinimumSectionSize(iPx + cMg) # See Issue #1551
|
||||
treeHeader.setSectionResizeMode(self.C_NAME, QHeaderView.Stretch)
|
||||
treeHeader.setSectionResizeMode(self.C_ACTIVE, QHeaderView.Fixed)
|
||||
treeHeader.setSectionResizeMode(self.C_STATUS, QHeaderView.Fixed)
|
||||
treeHeader.setSectionResizeMode(self.C_NAME, QHeaderView.ResizeMode.Stretch)
|
||||
treeHeader.setSectionResizeMode(self.C_ACTIVE, QHeaderView.ResizeMode.Fixed)
|
||||
treeHeader.setSectionResizeMode(self.C_STATUS, QHeaderView.ResizeMode.Fixed)
|
||||
treeHeader.resizeSection(self.C_ACTIVE, iPx + cMg)
|
||||
treeHeader.resizeSection(self.C_STATUS, iPx + cMg)
|
||||
|
||||
self.optTree.setDragDropMode(QAbstractItemView.NoDragDrop)
|
||||
self.optTree.setSelectionMode(QAbstractItemView.ExtendedSelection)
|
||||
self.optTree.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
self.optTree.setDragDropMode(QAbstractItemView.DragDropMode.NoDragDrop)
|
||||
self.optTree.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.optTree.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
|
||||
|
||||
# Filters
|
||||
# =======
|
||||
@@ -359,7 +359,7 @@ class _FilterTab(NFixedPage):
|
||||
self.resetButton.clicked.connect(lambda: self._setSelectedMode(self.F_FILTERED))
|
||||
|
||||
self.modeBox = QHBoxLayout()
|
||||
self.modeBox.addWidget(QLabel(self.tr("Mark selection as")))
|
||||
self.modeBox.addWidget(QLabel(self.tr("Mark selection as"), self))
|
||||
self.modeBox.addStretch(1)
|
||||
self.modeBox.addWidget(self.includedButton)
|
||||
self.modeBox.addWidget(self.excludedButton)
|
||||
@@ -369,7 +369,7 @@ class _FilterTab(NFixedPage):
|
||||
# Filer Options
|
||||
self.filterOpt = NSwitchBox(self, iPx)
|
||||
self.filterOpt.switchToggled.connect(self._applyFilterSwitch)
|
||||
self.filterOpt.setFrameStyle(QFrame.NoFrame)
|
||||
self.filterOpt.setFrameStyle(QFrame.Shape.NoFrame)
|
||||
|
||||
# Assemble GUI
|
||||
# ============
|
||||
@@ -381,10 +381,10 @@ class _FilterTab(NFixedPage):
|
||||
self.selectionBox.addLayout(self.modeBox)
|
||||
self.selectionBox.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.selectionWidget = QWidget()
|
||||
self.selectionWidget = QWidget(self)
|
||||
self.selectionWidget.setLayout(self.selectionBox)
|
||||
|
||||
self.mainSplit = QSplitter()
|
||||
self.mainSplit = QSplitter(self)
|
||||
self.mainSplit.addWidget(self.selectionWidget)
|
||||
self.mainSplit.addWidget(self.filterOpt)
|
||||
self.mainSplit.setCollapsible(0, False)
|
||||
@@ -703,7 +703,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
# Edit Form
|
||||
# =========
|
||||
|
||||
self.lblEditForm = QLabel(self.tr("Editing: {0}").format(self.tr("None")))
|
||||
self.lblEditForm = QLabel(self.tr("Editing: {0}").format(self.tr("None")), self)
|
||||
|
||||
self.editTextBox = QPlainTextEdit(self)
|
||||
self.editTextBox.setFixedHeight(5*iPx)
|
||||
@@ -759,12 +759,12 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.layoutMatrix.addWidget(self.layoutHeading, 0, 0, 1, 5)
|
||||
|
||||
# Title Layout
|
||||
self.mtxTitle = QLabel(self._build.getLabel("headings.fmtTitle"))
|
||||
self.mtxTitle = QLabel(self._build.getLabel("headings.fmtTitle"), self)
|
||||
self.centerTitle = NSwitch(self, height=iPx)
|
||||
self.breakTitle = NSwitch(self, height=iPx)
|
||||
lblCenterT = QLabel(self.tr("Centre"))
|
||||
lblCenterT = QLabel(self.tr("Centre"), self)
|
||||
lblCenterT.setIndent(sSp)
|
||||
lblBreakT = QLabel(self.tr("Page Break"))
|
||||
lblBreakT = QLabel(self.tr("Page Break"), self)
|
||||
lblBreakT.setIndent(sSp)
|
||||
|
||||
self.layoutMatrix.addWidget(self.mtxTitle, 1, 0)
|
||||
@@ -774,12 +774,12 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.layoutMatrix.addWidget(self.breakTitle, 1, 4)
|
||||
|
||||
# Chapter Layout
|
||||
self.mtxChapter = QLabel(self._build.getLabel("headings.fmtChapter"))
|
||||
self.mtxChapter = QLabel(self._build.getLabel("headings.fmtChapter"), self)
|
||||
self.centerChapter = NSwitch(self, height=iPx)
|
||||
self.breakChapter = NSwitch(self, height=iPx)
|
||||
lblCenterC = QLabel(self.tr("Centre"))
|
||||
lblCenterC = QLabel(self.tr("Centre"), self)
|
||||
lblCenterC.setIndent(sSp)
|
||||
lblBreakC = QLabel(self.tr("Page Break"))
|
||||
lblBreakC = QLabel(self.tr("Page Break"), self)
|
||||
lblBreakC.setIndent(sSp)
|
||||
|
||||
self.layoutMatrix.addWidget(self.mtxChapter, 2, 0)
|
||||
@@ -789,12 +789,12 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.layoutMatrix.addWidget(self.breakChapter, 2, 4)
|
||||
|
||||
# Scene Layout
|
||||
self.mtxScene = QLabel(self._build.getLabel("headings.fmtScene"))
|
||||
self.mtxScene = QLabel(self._build.getLabel("headings.fmtScene"), self)
|
||||
self.centerScene = NSwitch(self, height=iPx)
|
||||
self.breakScene = NSwitch(self, height=iPx)
|
||||
lblCenterS = QLabel(self.tr("Centre"))
|
||||
lblCenterS = QLabel(self.tr("Centre"), self)
|
||||
lblCenterS.setIndent(sSp)
|
||||
lblBreakS = QLabel(self.tr("Page Break"))
|
||||
lblBreakS = QLabel(self.tr("Page Break"), self)
|
||||
lblBreakS.setIndent(sSp)
|
||||
|
||||
self.layoutMatrix.addWidget(self.mtxScene, 3, 0)
|
||||
|
||||
@@ -95,7 +95,7 @@ class GuiNovelDetails(QDialog):
|
||||
self.mainStack.addWidget(self.contentsPage)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QtDialogClose)
|
||||
self.buttonBox = QDialogButtonBox(QtDialogClose, self)
|
||||
self.buttonBox.rejected.connect(self.close)
|
||||
|
||||
# Assemble
|
||||
@@ -366,7 +366,7 @@ class _ContentsPage(NFixedPage):
|
||||
countFrom = options.getInt("GuiNovelDetails", "countFrom", 1)
|
||||
clearDouble = options.getBool("GuiNovelDetails", "clearDouble", True)
|
||||
|
||||
self.wpLabel = QLabel(self.tr("Words per page"))
|
||||
self.wpLabel = QLabel(self.tr("Words per page"), self)
|
||||
|
||||
self.wpValue = QSpinBox(self)
|
||||
self.wpValue.setMinimum(10)
|
||||
@@ -375,7 +375,7 @@ class _ContentsPage(NFixedPage):
|
||||
self.wpValue.setValue(wordsPerPage)
|
||||
self.wpValue.valueChanged.connect(self._populateTree)
|
||||
|
||||
self.poLabel = QLabel(self.tr("First page offset"))
|
||||
self.poLabel = QLabel(self.tr("First page offset"), self)
|
||||
|
||||
self.poValue = QSpinBox(self)
|
||||
self.poValue.setMinimum(1)
|
||||
@@ -384,7 +384,7 @@ class _ContentsPage(NFixedPage):
|
||||
self.poValue.setValue(countFrom)
|
||||
self.poValue.valueChanged.connect(self._populateTree)
|
||||
|
||||
self.dblLabel = QLabel(self.tr("Chapters on odd pages"))
|
||||
self.dblLabel = QLabel(self.tr("Chapters on odd pages"), self)
|
||||
|
||||
self.dblValue = NSwitch(self, height=iPx)
|
||||
self.dblValue.setChecked(clearDouble)
|
||||
|
||||
@@ -682,10 +682,10 @@ class _NewProjectForm(QWidget):
|
||||
# ========
|
||||
|
||||
self.extraBox = QVBoxLayout()
|
||||
self.extraBox.addWidget(QLabel("<b>{0}</b>".format(self.tr("Chapters and Scenes"))))
|
||||
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.addWidget(QLabel("<b>{0}</b>".format(self.tr("Project Notes"))))
|
||||
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)
|
||||
|
||||
@@ -694,7 +694,7 @@ class _NewProjectForm(QWidget):
|
||||
self.extraWidget.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.formBox = QVBoxLayout()
|
||||
self.formBox.addWidget(QLabel("<b>{0}</b>".format(self.tr("Create New Project"))))
|
||||
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.addWidget(self.extraWidget)
|
||||
@@ -738,7 +738,7 @@ class _NewProjectForm(QWidget):
|
||||
"""Select a project folder."""
|
||||
if projDir := QFileDialog.getExistingDirectory(
|
||||
self, self.tr("Select Project Folder"),
|
||||
str(self._basePath), options=QFileDialog.ShowDirsOnly
|
||||
str(self._basePath), options=QFileDialog.Option.ShowDirsOnly
|
||||
):
|
||||
self._basePath = Path(projDir)
|
||||
self._updateProjPath()
|
||||
|
||||
@@ -105,7 +105,7 @@ class GuiWritingStats(QDialog):
|
||||
pOptions.getInt("GuiWritingStats", "widthCol3", 80)
|
||||
)
|
||||
|
||||
self.listBox = QTreeWidget()
|
||||
self.listBox = QTreeWidget(self)
|
||||
self.listBox.setHeaderLabels([
|
||||
self.tr("Session Start"),
|
||||
self.tr("Length"),
|
||||
@@ -145,36 +145,36 @@ class GuiWritingStats(QDialog):
|
||||
self.infoForm = QGridLayout(self)
|
||||
self.infoBox.setLayout(self.infoForm)
|
||||
|
||||
self.labelTotal = QLabel(formatTime(0))
|
||||
self.labelTotal = QLabel(formatTime(0), self)
|
||||
self.labelTotal.setFont(SHARED.theme.guiFontFixed)
|
||||
self.labelTotal.setAlignment(QtAlignRightMiddle)
|
||||
|
||||
self.labelIdleT = QLabel(formatTime(0))
|
||||
self.labelIdleT = QLabel(formatTime(0), self)
|
||||
self.labelIdleT.setFont(SHARED.theme.guiFontFixed)
|
||||
self.labelIdleT.setAlignment(QtAlignRightMiddle)
|
||||
|
||||
self.labelFilter = QLabel(formatTime(0))
|
||||
self.labelFilter = QLabel(formatTime(0), self)
|
||||
self.labelFilter.setFont(SHARED.theme.guiFontFixed)
|
||||
self.labelFilter.setAlignment(QtAlignRightMiddle)
|
||||
|
||||
self.novelWords = QLabel("0")
|
||||
self.novelWords = QLabel("0", self)
|
||||
self.novelWords.setFont(SHARED.theme.guiFontFixed)
|
||||
self.novelWords.setAlignment(QtAlignRightMiddle)
|
||||
|
||||
self.notesWords = QLabel("0")
|
||||
self.notesWords = QLabel("0", self)
|
||||
self.notesWords.setFont(SHARED.theme.guiFontFixed)
|
||||
self.notesWords.setAlignment(QtAlignRightMiddle)
|
||||
|
||||
self.totalWords = QLabel("0")
|
||||
self.totalWords = QLabel("0", self)
|
||||
self.totalWords.setFont(SHARED.theme.guiFontFixed)
|
||||
self.totalWords.setAlignment(QtAlignRightMiddle)
|
||||
|
||||
lblTTime = QLabel(self.tr("Total Time:"))
|
||||
lblITime = QLabel(self.tr("Idle Time:"))
|
||||
lblFTime = QLabel(self.tr("Filtered Time:"))
|
||||
lblNvCount = QLabel(self.tr("Novel Word Count:"))
|
||||
lblNtCount = QLabel(self.tr("Notes Word Count:"))
|
||||
lblTtCount = QLabel(self.tr("Total Word Count:"))
|
||||
lblTTime = QLabel(self.tr("Total Time:"), self)
|
||||
lblITime = QLabel(self.tr("Idle Time:"), self)
|
||||
lblFTime = QLabel(self.tr("Filtered Time:"), self)
|
||||
lblNvCount = QLabel(self.tr("Novel Word Count:"), self)
|
||||
lblNtCount = QLabel(self.tr("Notes Word Count:"), self)
|
||||
lblTtCount = QLabel(self.tr("Total Word Count:"), self)
|
||||
|
||||
self.infoForm.addWidget(lblTTime, 0, 0)
|
||||
self.infoForm.addWidget(lblITime, 1, 0)
|
||||
@@ -235,12 +235,12 @@ class GuiWritingStats(QDialog):
|
||||
)
|
||||
self.showIdleTime.clicked.connect(self._updateListBox)
|
||||
|
||||
self.filterForm.addWidget(QLabel(self.tr("Count novel files")), 0, 0)
|
||||
self.filterForm.addWidget(QLabel(self.tr("Count note files")), 1, 0)
|
||||
self.filterForm.addWidget(QLabel(self.tr("Hide zero word count")), 2, 0)
|
||||
self.filterForm.addWidget(QLabel(self.tr("Hide negative word count")), 3, 0)
|
||||
self.filterForm.addWidget(QLabel(self.tr("Group entries by day")), 4, 0)
|
||||
self.filterForm.addWidget(QLabel(self.tr("Show idle time")), 5, 0)
|
||||
self.filterForm.addWidget(QLabel(self.tr("Count novel files"), self), 0, 0)
|
||||
self.filterForm.addWidget(QLabel(self.tr("Count note files"), self), 1, 0)
|
||||
self.filterForm.addWidget(QLabel(self.tr("Hide zero word count"), self), 2, 0)
|
||||
self.filterForm.addWidget(QLabel(self.tr("Hide negative word count"), self), 3, 0)
|
||||
self.filterForm.addWidget(QLabel(self.tr("Group entries by day"), self), 4, 0)
|
||||
self.filterForm.addWidget(QLabel(self.tr("Show idle time"), self), 5, 0)
|
||||
self.filterForm.addWidget(self.incNovel, 0, 1)
|
||||
self.filterForm.addWidget(self.incNotes, 1, 1)
|
||||
self.filterForm.addWidget(self.hideZeros, 2, 1)
|
||||
@@ -261,7 +261,7 @@ class GuiWritingStats(QDialog):
|
||||
|
||||
self.optsBox = QHBoxLayout()
|
||||
self.optsBox.addStretch(1)
|
||||
self.optsBox.addWidget(QLabel(self.tr("Word count cap for the histogram")), 0)
|
||||
self.optsBox.addWidget(QLabel(self.tr("Word count cap for the histogram"), self), 0)
|
||||
self.optsBox.addWidget(self.histMax, 0)
|
||||
|
||||
# Buttons
|
||||
|
||||
@@ -24,7 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from __future__ import annotations
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QColor, QPainter
|
||||
from PyQt5.QtGui import QColor, QPainter, QTextCursor
|
||||
from PyQt5.QtWidgets import QDialogButtonBox, QStyle
|
||||
|
||||
# Qt Alignment Flags
|
||||
@@ -81,3 +81,10 @@ QtRoleAccept = QDialogButtonBox.ButtonRole.AcceptRole
|
||||
QtRoleAction = QDialogButtonBox.ButtonRole.ActionRole
|
||||
QtRoleApply = QDialogButtonBox.ButtonRole.ApplyRole
|
||||
QtRoleReject = QDialogButtonBox.ButtonRole.RejectRole
|
||||
|
||||
# Cursor Types
|
||||
|
||||
QtKeepAnchor = QTextCursor.MoveMode.KeepAnchor
|
||||
QtMoveAnchor = QTextCursor.MoveMode.MoveAnchor
|
||||
QtMoveLeft = QTextCursor.MoveOperation.Left
|
||||
QtMoveRight = QTextCursor.MoveOperation.Right
|
||||
|
||||
@@ -37,7 +37,7 @@ from novelwriter.enum import (
|
||||
)
|
||||
from novelwriter.gui.doceditor import GuiDocEditor, GuiDocToolBar
|
||||
from novelwriter.text.counting import standardCounter
|
||||
from novelwriter.types import QtAlignJustify, QtAlignLeft, QtMouseLeft
|
||||
from novelwriter.types import QtAlignJustify, QtAlignLeft, QtKeepAnchor, QtMouseLeft, QtMoveRight
|
||||
|
||||
KEY_DELAY = 1
|
||||
|
||||
@@ -1413,7 +1413,7 @@ def testGuiEditor_MultiBlockFormatting(qtbot, nwGUI, projPath, ipsumText, mockRn
|
||||
# Toggle Comment
|
||||
cursor = nwGUI.docEditor.textCursor()
|
||||
cursor.setPosition(50)
|
||||
cursor.movePosition(QTextCursor.MoveOperation.Right, QTextCursor.MoveMode.KeepAnchor, 2000)
|
||||
cursor.movePosition(QtMoveRight, QtKeepAnchor, 2000)
|
||||
nwGUI.docEditor.setTextCursor(cursor)
|
||||
|
||||
nwGUI.docEditor._iterFormatBlocks(nwDocAction.BLOCK_COM)
|
||||
@@ -1434,7 +1434,7 @@ def testGuiEditor_MultiBlockFormatting(qtbot, nwGUI, projPath, ipsumText, mockRn
|
||||
# Un-toggle all
|
||||
cursor = nwGUI.docEditor.textCursor()
|
||||
cursor.setPosition(50)
|
||||
cursor.movePosition(QTextCursor.MoveOperation.Right, QTextCursor.MoveMode.KeepAnchor, 3000)
|
||||
cursor.movePosition(QtMoveRight, QtKeepAnchor, 3000)
|
||||
nwGUI.docEditor.setTextCursor(cursor)
|
||||
|
||||
nwGUI.docEditor._iterFormatBlocks(nwDocAction.BLOCK_COM)
|
||||
@@ -1445,7 +1445,7 @@ def testGuiEditor_MultiBlockFormatting(qtbot, nwGUI, projPath, ipsumText, mockRn
|
||||
# Toggle Ignore Text
|
||||
cursor = nwGUI.docEditor.textCursor()
|
||||
cursor.setPosition(50)
|
||||
cursor.movePosition(QTextCursor.MoveOperation.Right, QTextCursor.MoveMode.KeepAnchor, 2000)
|
||||
cursor.movePosition(QtMoveRight, QtKeepAnchor, 2000)
|
||||
nwGUI.docEditor.setTextCursor(cursor)
|
||||
|
||||
nwGUI.docEditor._iterFormatBlocks(nwDocAction.BLOCK_IGN)
|
||||
@@ -1456,7 +1456,7 @@ def testGuiEditor_MultiBlockFormatting(qtbot, nwGUI, projPath, ipsumText, mockRn
|
||||
# Clear all paragraphs
|
||||
cursor = nwGUI.docEditor.textCursor()
|
||||
cursor.setPosition(50)
|
||||
cursor.movePosition(QTextCursor.MoveOperation.Right, QTextCursor.MoveMode.KeepAnchor, 3000)
|
||||
cursor.movePosition(QtMoveRight, QtKeepAnchor, 3000)
|
||||
nwGUI.docEditor.setTextCursor(cursor)
|
||||
|
||||
nwGUI.docEditor._iterFormatBlocks(nwDocAction.BLOCK_TXT)
|
||||
|
||||
Reference in New Issue
Block a user