diff --git a/novelwriter/core/buildsettings.py b/novelwriter/core/buildsettings.py
index a6880525..f914ce46 100644
--- a/novelwriter/core/buildsettings.py
+++ b/novelwriter/core/buildsettings.py
@@ -75,7 +75,7 @@ SETTINGS_LABELS = {
"headings": QT_TRANSLATE_NOOP("Builds", "Headings"),
"headings.fmtTitle": QT_TRANSLATE_NOOP("Builds", "Title Heading"),
"headings.fmtChapter": QT_TRANSLATE_NOOP("Builds", "Chapter Heading"),
- "headings.fmtUnnumbered": QT_TRANSLATE_NOOP("Builds", "Alt. Chapter Heading"),
+ "headings.fmtUnnumbered": QT_TRANSLATE_NOOP("Builds", "Unnumbered Heading"),
"headings.fmtScene": QT_TRANSLATE_NOOP("Builds", "Scene Heading"),
"headings.fmtSection": QT_TRANSLATE_NOOP("Builds", "Section Heading"),
"headings.hideScene": QT_TRANSLATE_NOOP("Builds", "Hide Scene"),
@@ -296,6 +296,7 @@ class BuildSettings:
def pack(self):
"""Pack all content into a JSON compatible dictionary.
"""
+ logger.debug("Collecting build setting for '%s'", self._name)
return {
"name": self._name,
"uuid": self._uuid,
diff --git a/novelwriter/core/projectdata.py b/novelwriter/core/projectdata.py
index 58667ee3..ad376cd1 100644
--- a/novelwriter/core/projectdata.py
+++ b/novelwriter/core/projectdata.py
@@ -22,7 +22,6 @@ General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
"""
-
from __future__ import annotations
import uuid
diff --git a/novelwriter/tools/manusbuild.py b/novelwriter/tools/manusbuild.py
index 6f1fc7f8..53418d90 100644
--- a/novelwriter/tools/manusbuild.py
+++ b/novelwriter/tools/manusbuild.py
@@ -22,9 +22,13 @@ General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
"""
+from __future__ import annotations
import logging
+from typing import TYPE_CHECKING
+
+from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import (
QDialog, QGridLayout, QPushButton, QSplitter, QTextBrowser, QVBoxLayout,
QWidget, qApp
@@ -33,12 +37,15 @@ from PyQt5.QtWidgets import (
from novelwriter import CONFIG
from novelwriter.tools.manussettings import GuiBuildSettings
+if TYPE_CHECKING:
+ from novelwriter.guimain import GuiMain
+
logger = logging.getLogger(__name__)
class GuiBuildManuscript(QDialog):
- def __init__(self, mainGui):
+ def __init__(self, mainGui: GuiMain):
super().__init__(parent=mainGui)
self.mainGui = mainGui
@@ -110,6 +117,7 @@ class GuiBuildManuscript(QDialog):
# Private Slots
##
+ @pyqtSlot()
def _createNewBuild(self):
"""Open the build settings dialog for a new build.
"""
@@ -121,9 +129,17 @@ class GuiBuildManuscript(QDialog):
dlgSettings.raise_()
qApp.processEvents()
dlgSettings.loadContent()
+ dlgSettings.newSettingsReady.connect(self._processNewSettings)
return
+ @pyqtSlot(dict)
+ def _processNewSettings(self, data: dict):
+ """
+ """
+ print(data)
+ return
+
##
# Internal Functions
##
diff --git a/novelwriter/tools/manussettings.py b/novelwriter/tools/manussettings.py
index 7ae2f770..dcca1851 100644
--- a/novelwriter/tools/manussettings.py
+++ b/novelwriter/tools/manussettings.py
@@ -29,11 +29,12 @@ import logging
from typing import TYPE_CHECKING
from PyQt5.QtGui import QIcon
-from PyQt5.QtCore import QEvent, QSize, Qt, pyqtSlot
+from PyQt5.QtCore import QEvent, QSize, Qt, pyqtSignal, pyqtSlot
from PyQt5.QtWidgets import (
- QAbstractItemView, QDialog, QGridLayout, QHBoxLayout, QHeaderView, QLabel,
- QLineEdit, QPushButton, QSplitter, QStackedWidget, QToolButton,
- QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
+ QAbstractButton, QAbstractItemView, QDialog, QDialogButtonBox, QGridLayout,
+ QHBoxLayout, QHeaderView, QLabel, QLineEdit, QPushButton, QSplitter,
+ QStackedWidget, QToolButton, QTreeWidget, QTreeWidgetItem, QVBoxLayout,
+ QWidget
)
from novelwriter import CONFIG
@@ -58,6 +59,8 @@ class GuiBuildSettings(QDialog):
BLD_MARKDOWN = 6
BLD_ODT = 7
+ newSettingsReady = pyqtSignal(dict)
+
def __init__(self, mainGui: GuiMain, buildData: dict):
super().__init__(parent=mainGui)
@@ -129,10 +132,20 @@ class GuiBuildSettings(QDialog):
self.toolStack.addWidget(self.buildTabMarkdown)
self.toolStack.addWidget(self.buildTabODT)
- # Main Settings
- # =============
+ # Main Settings + Buttons
+ # =======================
- self.lblTitle = QLabel()
+ self.lblBuildName = QLabel(self.tr("Name"))
+ self.editBuildName = QLineEdit()
+ self.dlgButtons = QDialogButtonBox(
+ QDialogButtonBox.Apply | QDialogButtonBox.Save | QDialogButtonBox.Close
+ )
+ self.dlgButtons.clicked.connect(self._dialogButtonClicked)
+
+ self.buttonBox = QHBoxLayout()
+ self.buttonBox.addWidget(self.lblBuildName)
+ self.buttonBox.addWidget(self.editBuildName)
+ self.buttonBox.addWidget(self.dlgButtons)
# Assemble GUI
# ============
@@ -140,9 +153,12 @@ class GuiBuildSettings(QDialog):
self.mainBox = QHBoxLayout()
self.mainBox.addWidget(self.optSideBar)
self.mainBox.addWidget(self.toolStack)
+ self.mainBox.setContentsMargins(0, 0, 0, 0)
self.outerBox = QVBoxLayout()
self.outerBox.addLayout(self.mainBox)
+ self.outerBox.addLayout(self.buttonBox)
+ self.outerBox.setSpacing(CONFIG.pxInt(12))
self.setLayout(self.outerBox)
@@ -156,6 +172,7 @@ class GuiBuildSettings(QDialog):
def loadContent(self):
"""Populate the child widgets.
"""
+ self.editBuildName.setText(self._build.name)
self.optTabSelect.loadContent(self._build)
return
@@ -183,6 +200,22 @@ class GuiBuildSettings(QDialog):
self.toolStack.setCurrentWidget(self.buildTabODT)
return
+ @pyqtSlot("QAbstractButton*")
+ def _dialogButtonClicked(self, button: QAbstractButton):
+ """Handle button clicks from the dialog button box.
+ """
+ role = self.dlgButtons.buttonRole(button)
+ if role in (QDialogButtonBox.ApplyRole, QDialogButtonBox.AcceptRole):
+ self._build.setName(self.editBuildName.text())
+ self.newSettingsReady.emit(self._build.pack())
+
+ if role == QDialogButtonBox.AcceptRole:
+ self.accept()
+ elif role == QDialogButtonBox.RejectRole:
+ self.reject()
+
+ return
+
##
# Events
##
@@ -329,6 +362,7 @@ class GuiBuildFilterTab(QWidget):
self.outerBox = QHBoxLayout()
self.outerBox.addWidget(self.mainSplit)
+ self.outerBox.setContentsMargins(0, 0, 0, 0)
self.setLayout(self.outerBox)