Rename manuscript build tool file and add build dialog
This commit is contained in:
@@ -63,7 +63,7 @@ VALID_MAP = {
|
|||||||
"GuiBuildSettings": {
|
"GuiBuildSettings": {
|
||||||
"winWidth", "winHeight", "treeWidth", "filterWidth"
|
"winWidth", "winHeight", "treeWidth", "filterWidth"
|
||||||
},
|
},
|
||||||
"GuiBuildManuscript": {
|
"GuiManuscript": {
|
||||||
"winWidth", "winHeight", "optsWidth", "viewWidth"
|
"winWidth", "winHeight", "optsWidth", "viewWidth"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ novelWriter – Text Tokenizer
|
|||||||
Split novelWriter plain text into its elements
|
Split novelWriter plain text into its elements
|
||||||
|
|
||||||
File History:
|
File History:
|
||||||
Created: 2019-05-05 [0.0.1]
|
Created: 2019-05-05 [0.0.1] Tokenizer
|
||||||
|
Created: 2023-05-23 [2.1b1] HeadingFormatter
|
||||||
|
|
||||||
This file is a part of novelWriter
|
This file is a part of novelWriter
|
||||||
Copyright 2018–2023, Veronica Berglyd Olsen
|
Copyright 2018–2023, Veronica Berglyd Olsen
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ novelWriter – ODT Text Converter
|
|||||||
Extends the Tokenizer class to generate ODT and FODT files
|
Extends the Tokenizer class to generate ODT and FODT files
|
||||||
|
|
||||||
File History:
|
File History:
|
||||||
Created: 2021-01-26 [1.2b1]
|
Created: 2021-01-26 [1.2b1] ToOdt
|
||||||
|
Created: 2021-01-27 [1.2b1] ODTParagraphStyle
|
||||||
|
Created: 2021-01-27 [1.2b1] ODTTextStyle
|
||||||
|
Created: 2021-08-14 [1.5b1] XMLParagraph
|
||||||
|
|
||||||
This file is a part of novelWriter
|
This file is a part of novelWriter
|
||||||
Copyright 2018–2023, Veronica Berglyd Olsen
|
Copyright 2018–2023, Veronica Berglyd Olsen
|
||||||
@@ -1439,7 +1442,8 @@ class XMLParagraph:
|
|||||||
|
|
||||||
def checkError(self):
|
def checkError(self):
|
||||||
"""Check that the number of characters written matches the
|
"""Check that the number of characters written matches the
|
||||||
number of characters received."""
|
number of characters received.
|
||||||
|
"""
|
||||||
errMsg = ""
|
errMsg = ""
|
||||||
nMissed = len(self._rawTxt) - self._chrPos
|
nMissed = len(self._rawTxt) - self._chrPos
|
||||||
if nMissed != 0:
|
if nMissed != 0:
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ from novelwriter.dialogs.projdetails import GuiProjectDetails
|
|||||||
from novelwriter.dialogs.projsettings import GuiProjectSettings
|
from novelwriter.dialogs.projsettings import GuiProjectSettings
|
||||||
from novelwriter.tools.build import GuiBuildNovel
|
from novelwriter.tools.build import GuiBuildNovel
|
||||||
from novelwriter.tools.lipsum import GuiLipsum
|
from novelwriter.tools.lipsum import GuiLipsum
|
||||||
from novelwriter.tools.manusbuild import GuiBuildManuscript
|
from novelwriter.tools.manuscript import GuiManuscript
|
||||||
from novelwriter.tools.projwizard import GuiProjectWizard
|
from novelwriter.tools.projwizard import GuiProjectWizard
|
||||||
from novelwriter.tools.writingstats import GuiWritingStats
|
from novelwriter.tools.writingstats import GuiWritingStats
|
||||||
from novelwriter.core.project import NWProject
|
from novelwriter.core.project import NWProject
|
||||||
@@ -1020,10 +1020,10 @@ class GuiMain(QMainWindow):
|
|||||||
logger.error("No project open")
|
logger.error("No project open")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
dlgBuild = getGuiItem("GuiBuildManuscript")
|
dlgBuild = getGuiItem("GuiManuscript")
|
||||||
if dlgBuild is None:
|
if dlgBuild is None:
|
||||||
dlgBuild = GuiBuildManuscript(self)
|
dlgBuild = GuiManuscript(self)
|
||||||
assert isinstance(dlgBuild, GuiBuildManuscript)
|
assert isinstance(dlgBuild, GuiManuscript)
|
||||||
|
|
||||||
dlgBuild.setModal(False)
|
dlgBuild.setModal(False)
|
||||||
dlgBuild.show()
|
dlgBuild.show()
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ novelWriter – GUI Build Manuscript
|
|||||||
GUI classes for the Manuscript Build Tool
|
GUI classes for the Manuscript Build Tool
|
||||||
|
|
||||||
File History:
|
File History:
|
||||||
Created: 2023-05-13 [2.1b1]
|
Created: 2023-05-13 [2.1b1] GuiManuscript
|
||||||
|
Created: 2023-05-13 [2.1b1] GuiManuscriptPreview
|
||||||
|
Created: 2023-05-24 [2.1b1] GuiManuscriptBuild
|
||||||
|
|
||||||
This file is a part of novelWriter
|
This file is a part of novelWriter
|
||||||
Copyright 2018–2023, Veronica Berglyd Olsen
|
Copyright 2018–2023, Veronica Berglyd Olsen
|
||||||
@@ -44,11 +46,14 @@ if TYPE_CHECKING:
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class GuiBuildManuscript(QDialog):
|
class GuiManuscript(QDialog):
|
||||||
|
|
||||||
def __init__(self, mainGui: GuiMain):
|
def __init__(self, mainGui: GuiMain):
|
||||||
super().__init__(parent=mainGui)
|
super().__init__(parent=mainGui)
|
||||||
|
|
||||||
|
logger.debug("Initialising GuiManuscript ...")
|
||||||
|
self.setObjectName("GuiManuscript")
|
||||||
|
|
||||||
self.mainGui = mainGui
|
self.mainGui = mainGui
|
||||||
self.mainTheme = mainGui.mainTheme
|
self.mainTheme = mainGui.mainTheme
|
||||||
self.theProject = mainGui.theProject
|
self.theProject = mainGui.theProject
|
||||||
@@ -65,8 +70,8 @@ class GuiBuildManuscript(QDialog):
|
|||||||
|
|
||||||
pOptions = self.theProject.options
|
pOptions = self.theProject.options
|
||||||
self.resize(
|
self.resize(
|
||||||
CONFIG.pxInt(pOptions.getInt("GuiBuildManuscript", "winWidth", wWin)),
|
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "winWidth", wWin)),
|
||||||
CONFIG.pxInt(pOptions.getInt("GuiBuildManuscript", "winHeight", hWin))
|
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "winHeight", hWin))
|
||||||
)
|
)
|
||||||
|
|
||||||
# Build Controls
|
# Build Controls
|
||||||
@@ -110,6 +115,7 @@ class GuiBuildManuscript(QDialog):
|
|||||||
self.btnSave.setMenu(self.menuSave)
|
self.btnSave.setMenu(self.menuSave)
|
||||||
|
|
||||||
self.btnClose = QPushButton(self.tr("Close"))
|
self.btnClose = QPushButton(self.tr("Close"))
|
||||||
|
self.btnClose.clicked.connect(self._doClose)
|
||||||
|
|
||||||
# Assemble GUI
|
# Assemble GUI
|
||||||
# ============
|
# ============
|
||||||
@@ -139,8 +145,8 @@ class GuiBuildManuscript(QDialog):
|
|||||||
self.mainSplit.addWidget(self.optsWidget)
|
self.mainSplit.addWidget(self.optsWidget)
|
||||||
self.mainSplit.addWidget(self.manPreview)
|
self.mainSplit.addWidget(self.manPreview)
|
||||||
self.mainSplit.setSizes([
|
self.mainSplit.setSizes([
|
||||||
CONFIG.pxInt(pOptions.getInt("GuiBuildManuscript", "optsWidth", wWin//3)),
|
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "optsWidth", wWin//3)),
|
||||||
CONFIG.pxInt(pOptions.getInt("GuiBuildManuscript", "viewWidth", 2*wWin//3)),
|
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "viewWidth", 2*wWin//3)),
|
||||||
])
|
])
|
||||||
|
|
||||||
self.outerBox = QVBoxLayout()
|
self.outerBox = QVBoxLayout()
|
||||||
@@ -148,10 +154,12 @@ class GuiBuildManuscript(QDialog):
|
|||||||
|
|
||||||
self.setLayout(self.outerBox)
|
self.setLayout(self.outerBox)
|
||||||
|
|
||||||
|
logger.debug("GuiManuscript initialisation complete")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def loadContent(self):
|
def loadContent(self):
|
||||||
"""
|
"""Load dialog content from project data.
|
||||||
"""
|
"""
|
||||||
self._builds.loadCollection()
|
self._builds.loadCollection()
|
||||||
self._updateBuildsList()
|
self._updateBuildsList()
|
||||||
@@ -164,7 +172,7 @@ class GuiBuildManuscript(QDialog):
|
|||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
"""Capture the user closing the window so we can save settings.
|
"""Capture the user closing the window so we can save settings.
|
||||||
"""
|
"""
|
||||||
self._saveSettings()
|
self._beforeClose()
|
||||||
event.accept()
|
event.accept()
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -201,14 +209,36 @@ class GuiBuildManuscript(QDialog):
|
|||||||
self._updateBuildItem(build)
|
self._updateBuildItem(build)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def _doClose(self):
|
||||||
|
"""The close button has been clicked.
|
||||||
|
"""
|
||||||
|
self._beforeClose()
|
||||||
|
self.close()
|
||||||
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
# Internal Functions
|
# Internal Functions
|
||||||
##
|
##
|
||||||
|
|
||||||
|
def _saveManuscript(self, outFormat: int):
|
||||||
|
"""Save the manuscript file or files.
|
||||||
|
"""
|
||||||
|
return
|
||||||
|
|
||||||
|
def _beforeClose(self):
|
||||||
|
"""List of things to do before closing.
|
||||||
|
"""
|
||||||
|
self._saveSettings()
|
||||||
|
for qWidget in qApp.topLevelWidgets():
|
||||||
|
if qWidget.objectName() == "GuiBuildSettings":
|
||||||
|
qWidget.close()
|
||||||
|
return
|
||||||
|
|
||||||
def _saveSettings(self):
|
def _saveSettings(self):
|
||||||
"""Save the various user settings.
|
"""Save the various user settings.
|
||||||
"""
|
"""
|
||||||
logger.debug("Saving GuiBuildManuscript settings")
|
logger.debug("Saving GuiManuscript settings")
|
||||||
|
|
||||||
winWidth = CONFIG.rpxInt(self.width())
|
winWidth = CONFIG.rpxInt(self.width())
|
||||||
winHeight = CONFIG.rpxInt(self.height())
|
winHeight = CONFIG.rpxInt(self.height())
|
||||||
@@ -218,10 +248,10 @@ class GuiBuildManuscript(QDialog):
|
|||||||
viewWidth = mainSplit[1]
|
viewWidth = mainSplit[1]
|
||||||
|
|
||||||
pOptions = self.theProject.options
|
pOptions = self.theProject.options
|
||||||
pOptions.setValue("GuiBuildManuscript", "winWidth", winWidth)
|
pOptions.setValue("GuiManuscript", "winWidth", winWidth)
|
||||||
pOptions.setValue("GuiBuildManuscript", "winHeight", winHeight)
|
pOptions.setValue("GuiManuscript", "winHeight", winHeight)
|
||||||
pOptions.setValue("GuiBuildManuscript", "optsWidth", optsWidth)
|
pOptions.setValue("GuiManuscript", "optsWidth", optsWidth)
|
||||||
pOptions.setValue("GuiBuildManuscript", "viewWidth", viewWidth)
|
pOptions.setValue("GuiManuscript", "viewWidth", viewWidth)
|
||||||
pOptions.saveSettings()
|
pOptions.saveSettings()
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -260,7 +290,7 @@ class GuiBuildManuscript(QDialog):
|
|||||||
self._updateBuildsList()
|
self._updateBuildsList()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiBuildManuscript
|
# END Class GuiManuscript
|
||||||
|
|
||||||
|
|
||||||
class GuiManuscriptPreview(QTextBrowser):
|
class GuiManuscriptPreview(QTextBrowser):
|
||||||
@@ -275,3 +305,14 @@ class GuiManuscriptPreview(QTextBrowser):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiManuscriptPreview
|
# END Class GuiManuscriptPreview
|
||||||
|
|
||||||
|
|
||||||
|
class GuiManuscriptBuild(QDialog):
|
||||||
|
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent=parent)
|
||||||
|
self._manusGui = parent
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
# END Class GuiManuscriptBuild
|
||||||
@@ -238,7 +238,7 @@ class GuiBuildSettings(QDialog):
|
|||||||
"""
|
"""
|
||||||
if self._build.changed:
|
if self._build.changed:
|
||||||
return self.mainGui.askQuestion(
|
return self.mainGui.askQuestion(
|
||||||
self.tr("Close"),
|
self.tr("Build Settings"),
|
||||||
self.tr("There are unsaved changes. Close anyway?")
|
self.tr("There are unsaved changes. Close anyway?")
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user