Merge branch 'main' into primary_count

This commit is contained in:
Veronica Berglyd Olsen
2025-05-12 19:41:33 +02:00
42 changed files with 490 additions and 278 deletions
+2 -1
View File
@@ -73,8 +73,9 @@ class GuiDocMerge(NDialog):
self.listBox.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
# Merge Options
self.trashLabel = QLabel(self.tr("Move merged items to Trash"), self)
self.trashSwitch = NSwitch(self, height=iPx)
self.trashLabel = QLabel(self.tr("Move merged items to Trash"), self)
self.trashLabel.setBuddy(self.trashSwitch)
self.optBox = QGridLayout()
self.optBox.addWidget(self.trashLabel, 0, 0)
+6 -3
View File
@@ -90,16 +90,19 @@ class GuiDocSplit(NDialog):
self.splitLevel.currentIndexChanged.connect(self._reloadList)
# Split Options
self.folderLabel = QLabel(self.tr("Split into a new folder"), self)
self.folderSwitch = NSwitch(self, height=iPx)
self.folderSwitch.setChecked(intoFolder)
self.folderLabel = QLabel(self.tr("Split into a new folder"), self)
self.folderLabel.setBuddy(self.folderSwitch)
self.hierarchyLabel = QLabel(self.tr("Create document hierarchy"), self)
self.hierarchySwitch = NSwitch(self, height=iPx)
self.hierarchySwitch.setChecked(docHierarchy)
self.hierarchyLabel = QLabel(self.tr("Create document hierarchy"), self)
self.hierarchyLabel.setBuddy(self.hierarchySwitch)
self.trashLabel = QLabel(self.tr("Move split document to Trash"), self)
self.trashSwitch = NSwitch(self, height=iPx)
self.trashLabel = QLabel(self.tr("Move split document to Trash"), self)
self.trashLabel.setBuddy(self.trashSwitch)
self.optBox = QGridLayout()
self.optBox.addWidget(self.folderLabel, 0, 0)
+11 -8
View File
@@ -43,11 +43,14 @@ class GuiEditLabel(NDialog):
self.setWindowTitle(self.tr("Item Label"))
# Item Label
self.labelValue = QLineEdit(self)
self.labelValue.setMinimumWidth(220)
self.labelValue.setMaxLength(200)
self.labelValue.setText(text)
self.labelValue.selectAll()
self.edtValue = QLineEdit(self)
self.edtValue.setMinimumWidth(220)
self.edtValue.setMaxLength(200)
self.edtValue.setText(text)
self.edtValue.selectAll()
self.lblValue = QLabel(self.tr("Label"), self)
self.lblValue.setBuddy(self.lblValue)
# Buttons
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
@@ -56,8 +59,8 @@ class GuiEditLabel(NDialog):
# Assemble
self.innerBox = QHBoxLayout()
self.innerBox.addWidget(QLabel(self.tr("Label"), self), 0)
self.innerBox.addWidget(self.labelValue, 1)
self.innerBox.addWidget(self.lblValue, 0)
self.innerBox.addWidget(self.edtValue, 1)
self.innerBox.setSpacing(12)
self.outerBox = QVBoxLayout()
@@ -77,7 +80,7 @@ class GuiEditLabel(NDialog):
@property
def itemLabel(self) -> str:
return self.labelValue.text()
return self.edtValue.text()
@classmethod
def getLabel(cls, parent: QWidget, text: str) -> tuple[str, bool]:
+16 -16
View File
@@ -34,9 +34,9 @@ from PyQt6.QtWidgets import (
)
from novelwriter import CONFIG, SHARED
from novelwriter.common import compact, describeFont, uniqueCompact
from novelwriter.common import compact, describeFont, processDialogSymbols, uniqueCompact
from novelwriter.config import DEF_GUI, DEF_ICONS, DEF_SYNTAX, DEF_TREECOL
from novelwriter.constants import nwLabels, nwUnicode, trConst
from novelwriter.constants import nwLabels, nwQuotes, nwUnicode, trConst
from novelwriter.dialogs.quotes import GuiQuoteSelect
from novelwriter.extensions.configlayout import NColorLabel, NScrollableForm
from novelwriter.extensions.modified import (
@@ -80,6 +80,7 @@ class GuiPreferences(NDialog):
# SideBar
self.sidebar = NPagedSideBar(self)
self.sidebar.setLabelColor(SHARED.theme.helpText)
self.sidebar.setAccessibleName(self.titleLabel.text())
self.sidebar.buttonClicked.connect(self._sidebarClicked)
# Form
@@ -644,21 +645,20 @@ class GuiPreferences(NDialog):
self.tr("Lines starting with any of these symbols are dialogue.")
)
self.narratorBreak = QLineEdit(self)
self.narratorBreak.setMaxLength(1)
self.narratorBreak.setFixedWidth(boxFixed)
self.narratorBreak.setAlignment(QtAlignCenter)
self.narratorBreak.setText(CONFIG.narratorBreak)
self.narratorBreak = NComboBox(self)
self.narratorDialog = NComboBox(self)
for key, value in nwQuotes.DASHES.items():
label = trConst(value)
self.narratorBreak.addItem(label, key)
self.narratorDialog.addItem(label, key)
self.narratorBreak.setCurrentData(CONFIG.narratorBreak, "")
self.narratorDialog.setCurrentData(CONFIG.narratorDialog, "")
self.mainForm.addRow(
self.tr("Narrator break symbol"), self.narratorBreak,
self.tr("Symbol to indicate a narrator break in dialogue.")
)
self.narratorDialog = QLineEdit(self)
self.narratorDialog.setMaxLength(1)
self.narratorDialog.setFixedWidth(boxFixed)
self.narratorDialog.setAlignment(QtAlignCenter)
self.narratorDialog.setText(CONFIG.narratorDialog)
self.mainForm.addRow(
self.tr("Alternating dialogue/narration symbol"), self.narratorDialog,
self.tr("Alternates dialogue highlighting within any paragraph.")
@@ -1045,9 +1045,9 @@ class GuiPreferences(NDialog):
# Text Highlighting
dialogueStyle = self.dialogStyle.currentData()
allowOpenDial = self.allowOpenDial.isChecked()
dialogueLine = uniqueCompact(self.dialogLine.text())
narratorBreak = self.narratorBreak.text().strip()
narratorDialog = self.narratorDialog.text().strip()
dialogueLine = processDialogSymbols(self.dialogLine.text())
narratorBreak = self.narratorBreak.currentData()
narratorDialog = self.narratorDialog.currentData()
altDialogOpen = compact(self.altDialogOpen.text())
altDialogClose = compact(self.altDialogClose.text())
highlightEmph = self.highlightEmph.isChecked()
+3
View File
@@ -86,6 +86,7 @@ class GuiProjectSettings(NDialog):
# SideBar
self.sidebar = NPagedSideBar(self)
self.sidebar.setLabelColor(SHARED.theme.helpText)
self.sidebar.setAccessibleName(self.titleLabel.text())
self.sidebar.addButton(self.tr("Settings"), self.PAGE_SETTINGS)
self.sidebar.addButton(self.tr("Status"), self.PAGE_STATUS)
self.sidebar.addButton(self.tr("Importance"), self.PAGE_IMPORT)
@@ -349,6 +350,7 @@ class _StatusPage(NFixedPage):
self.listBox.setHeaderLabels([self.tr("Label"), self.tr("Usage")])
self.listBox.setColumnWidth(self.C_LABEL, wCol0)
self.listBox.setIndentation(0)
self.listBox.setAccessibleName(pageLabel)
self.listBox.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
self.listBox.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
self.listBox.itemSelectionChanged.connect(self._onSelectionChanged)
@@ -686,6 +688,7 @@ class _ReplacePage(NFixedPage):
self.listBox.setHeaderLabels([self.tr("Keyword"), self.tr("Replace With")])
self.listBox.setColumnWidth(self.C_KEY, wCol0)
self.listBox.setIndentation(0)
self.listBox.setAccessibleName(self.pageTitle.text())
self.listBox.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
self.listBox.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
self.listBox.itemSelectionChanged.connect(self._onSelectionChanged)