Add a new Manuscript Build tool
This commit is contained in:
@@ -63,6 +63,9 @@ VALID_MAP = {
|
|||||||
"GuiBuildSettings": {
|
"GuiBuildSettings": {
|
||||||
"winWidth", "winHeight", "treeWidth", "filterWidth"
|
"winWidth", "winHeight", "treeWidth", "filterWidth"
|
||||||
},
|
},
|
||||||
|
"GuiBuildManuscript": {
|
||||||
|
"winWidth", "winHeight", "optsWidth", "viewWidth"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ 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.projwizard import GuiProjectWizard
|
from novelwriter.tools.projwizard import GuiProjectWizard
|
||||||
from novelwriter.tools.writingstats import GuiWritingStats
|
from novelwriter.tools.writingstats import GuiWritingStats
|
||||||
from novelwriter.tools.manussettings import GuiBuildSettings
|
|
||||||
from novelwriter.core.project import NWProject
|
from novelwriter.core.project import NWProject
|
||||||
from novelwriter.core.coretools import ProjectBuilder
|
from novelwriter.core.coretools import ProjectBuilder
|
||||||
|
|
||||||
@@ -1021,10 +1021,10 @@ class GuiMain(QMainWindow):
|
|||||||
logger.error("No project open")
|
logger.error("No project open")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
dlgBuild = getGuiItem("GuiBuildSettings")
|
dlgBuild = getGuiItem("GuiBuildManuscript")
|
||||||
if dlgBuild is None:
|
if dlgBuild is None:
|
||||||
dlgBuild = GuiBuildSettings(self)
|
dlgBuild = GuiBuildManuscript(self)
|
||||||
assert isinstance(dlgBuild, GuiBuildSettings)
|
assert isinstance(dlgBuild, GuiBuildManuscript)
|
||||||
|
|
||||||
dlgBuild.setModal(False)
|
dlgBuild.setModal(False)
|
||||||
dlgBuild.show()
|
dlgBuild.show()
|
||||||
|
|||||||
@@ -0,0 +1,141 @@
|
|||||||
|
"""
|
||||||
|
novelWriter – GUI Build Manuscript
|
||||||
|
==================================
|
||||||
|
GUI classes for the Manuscript Build Tool
|
||||||
|
|
||||||
|
File History:
|
||||||
|
Created: 2023-05-13 [2.1b1]
|
||||||
|
|
||||||
|
This file is a part of novelWriter
|
||||||
|
Copyright 2018–2023, Veronica Berglyd Olsen
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
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 <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
import novelwriter
|
||||||
|
|
||||||
|
from PyQt5.QtWidgets import QDialog, QGridLayout, QSplitter, QTextBrowser, QVBoxLayout, QWidget
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class GuiBuildManuscript(QDialog):
|
||||||
|
|
||||||
|
def __init__(self, mainGui):
|
||||||
|
super().__init__(parent=mainGui)
|
||||||
|
|
||||||
|
self.mainConf = novelwriter.CONFIG
|
||||||
|
self.mainGui = mainGui
|
||||||
|
self.mainTheme = mainGui.mainTheme
|
||||||
|
self.theProject = mainGui.theProject
|
||||||
|
|
||||||
|
self.setWindowTitle(self.tr("Build Manuscript"))
|
||||||
|
self.setMinimumWidth(self.mainConf.pxInt(600))
|
||||||
|
self.setMinimumHeight(self.mainConf.pxInt(500))
|
||||||
|
|
||||||
|
wWin = self.mainConf.pxInt(900)
|
||||||
|
hWin = self.mainConf.pxInt(600)
|
||||||
|
|
||||||
|
pOptions = self.theProject.options
|
||||||
|
self.resize(
|
||||||
|
self.mainConf.pxInt(pOptions.getInt("GuiBuildManuscript", "winWidth", wWin)),
|
||||||
|
self.mainConf.pxInt(pOptions.getInt("GuiBuildManuscript", "winHeight", hWin))
|
||||||
|
)
|
||||||
|
|
||||||
|
# Controls
|
||||||
|
# ========
|
||||||
|
|
||||||
|
self.optsGrid = QGridLayout()
|
||||||
|
|
||||||
|
self.manPreview = GuiManuscriptPreview(self)
|
||||||
|
|
||||||
|
# Assemble GUI
|
||||||
|
# ============
|
||||||
|
|
||||||
|
self.optsWidget = QWidget()
|
||||||
|
self.optsWidget.setLayout(self.optsGrid)
|
||||||
|
|
||||||
|
self.mainSplit = QSplitter()
|
||||||
|
self.mainSplit.addWidget(self.optsWidget)
|
||||||
|
self.mainSplit.addWidget(self.manPreview)
|
||||||
|
self.mainSplit.setSizes([
|
||||||
|
self.mainConf.pxInt(pOptions.getInt("GuiBuildManuscript", "optsWidth", wWin//3)),
|
||||||
|
self.mainConf.pxInt(pOptions.getInt("GuiBuildManuscript", "viewWidth", 2*wWin//3)),
|
||||||
|
])
|
||||||
|
|
||||||
|
self.outerBox = QVBoxLayout()
|
||||||
|
self.outerBox.addWidget(self.mainSplit)
|
||||||
|
|
||||||
|
self.setLayout(self.outerBox)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
def loadContent(self):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
return
|
||||||
|
|
||||||
|
##
|
||||||
|
# Events
|
||||||
|
##
|
||||||
|
|
||||||
|
def closeEvent(self, event):
|
||||||
|
"""Capture the user closing the window so we can save settings.
|
||||||
|
"""
|
||||||
|
self._saveSettings()
|
||||||
|
event.accept()
|
||||||
|
return
|
||||||
|
|
||||||
|
##
|
||||||
|
# Internal Functions
|
||||||
|
##
|
||||||
|
|
||||||
|
def _saveSettings(self):
|
||||||
|
"""Save the various user settings.
|
||||||
|
"""
|
||||||
|
logger.debug("Saving GuiBuildManuscript settings")
|
||||||
|
|
||||||
|
winWidth = self.mainConf.rpxInt(self.width())
|
||||||
|
winHeight = self.mainConf.rpxInt(self.height())
|
||||||
|
|
||||||
|
mainSplit = self.mainSplit.sizes()
|
||||||
|
optsWidth = mainSplit[0]
|
||||||
|
viewWidth = mainSplit[1]
|
||||||
|
|
||||||
|
pOptions = self.theProject.options
|
||||||
|
pOptions.setValue("GuiBuildManuscript", "winWidth", winWidth)
|
||||||
|
pOptions.setValue("GuiBuildManuscript", "winHeight", winHeight)
|
||||||
|
pOptions.setValue("GuiBuildManuscript", "optsWidth", optsWidth)
|
||||||
|
pOptions.setValue("GuiBuildManuscript", "viewWidth", viewWidth)
|
||||||
|
pOptions.saveSettings()
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
# END Class GuiBuildManuscript
|
||||||
|
|
||||||
|
|
||||||
|
class GuiManuscriptPreview(QTextBrowser):
|
||||||
|
|
||||||
|
def __init__(self, mainGui):
|
||||||
|
super().__init__(parent=mainGui)
|
||||||
|
|
||||||
|
self.mainConf = novelwriter.CONFIG
|
||||||
|
self.mainGui = mainGui
|
||||||
|
self.mainTheme = mainGui.mainTheme
|
||||||
|
self.theProject = mainGui.theProject
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
# END Class GuiManuscriptPreview
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
novelWriter – GUI Build Manuscript
|
novelWriter – GUI Build Settings
|
||||||
==================================
|
================================
|
||||||
GUI classes for the Manuscript Build Tool
|
GUI classes for editing Manuscript Build Settings
|
||||||
|
|
||||||
File History:
|
File History:
|
||||||
Created: 2023-02-13 [2.1b1]
|
Created: 2023-02-13 [2.1b1]
|
||||||
@@ -24,7 +24,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import novelwriter
|
import novelwriter
|
||||||
|
|
||||||
from PyQt5.QtGui import QIcon
|
from PyQt5.QtGui import QIcon
|
||||||
@@ -67,18 +66,17 @@ class GuiBuildSettings(QDialog):
|
|||||||
"filter": {},
|
"filter": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
self.setWindowTitle(self.tr("Build Manuscript"))
|
self.setWindowTitle(self.tr("Manuscript Build Settings"))
|
||||||
self.setMinimumWidth(self.mainConf.pxInt(700))
|
self.setMinimumWidth(self.mainConf.pxInt(700))
|
||||||
self.setMinimumHeight(self.mainConf.pxInt(400))
|
self.setMinimumHeight(self.mainConf.pxInt(400))
|
||||||
|
|
||||||
# Style
|
|
||||||
mPx = self.mainConf.pxInt(150)
|
mPx = self.mainConf.pxInt(150)
|
||||||
wWin = self.mainConf.pxInt(900)
|
wWin = self.mainConf.pxInt(900)
|
||||||
hWin = self.mainConf.pxInt(600)
|
hWin = self.mainConf.pxInt(600)
|
||||||
|
|
||||||
pOptions = self.theProject.options
|
pOptions = self.theProject.options
|
||||||
self.resize(
|
self.resize(
|
||||||
self.mainConf.pxInt(pOptions.getInt("GuiBuildSettings", "winWidth", wWin)),
|
self.mainConf.pxInt(pOptions.getInt("GuiBuildSettings", "winWidth", wWin)),
|
||||||
self.mainConf.pxInt(pOptions.getInt("GuiBuildSettings", "winHeight", hWin))
|
self.mainConf.pxInt(pOptions.getInt("GuiBuildSettings", "winHeight", hWin))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user