Replaced Help button with descriptive tooltips instead.
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
<h1>Help!</h1>
|
||||
<p><i>A brief guide to make the most out of the Build Novel Project tool.</i></p>
|
||||
|
||||
<h2>Novel Title Formats</h2>
|
||||
<p>The format of the various title levels in the files under the Novel folder can be customised in
|
||||
these settings. The actual title given in the headings of your files will for instance replace
|
||||
all occurrences of the keyword <mark>%title%</mark>. Any static text will be left as-is in the
|
||||
final title. An empty field means the title isn't written out at all.</p>
|
||||
<p>The available formatting keywords are:</p>
|
||||
<p><mark>%title%</mark> – This is replaced with the text you put in your headings in your
|
||||
documents</p>
|
||||
<p><mark>%ch%</mark> – This is replaced with the chapter number of your chapter type
|
||||
headings. These are generated automaticall starting from 1, but ignoring chapter headings in
|
||||
files with "Unnumbered" layout.</p>
|
||||
<p><mark>%chw%</mark> – This is replaced with the chapter number, but instead of an
|
||||
arabic number, the word for it is used, e.g. One, Two, Fifteen, Twenty-Five, etc.</p>
|
||||
<p><mark>%sc%</mark> – This is replaced with the scene number. The number is reset to one
|
||||
for each new chapter, so it is the scene number within the current chapter.</p>
|
||||
<p><mark>%sca%</mark> – This is replaced with the absolute scene number. That is, the
|
||||
number is counted from the first scene in the novel, and not reset for each chapter.</p>
|
||||
<p><mark>\\</mark> – Two backslashes are replaced by a line break.</p>
|
||||
<p><b>Note:</b> The Scene and Section formats are treated slightly differently than the other title
|
||||
formats. If the format is a constant text, that is, contains no <mark>%keyword%</mark> tags, it
|
||||
will be treated as a separator instead. Scene and Section separators are centred, and for
|
||||
scenes, not shown if placed directly after the chapter heading. For instance, it you want the
|
||||
classic three asterisk <mark>* * *</mark> separator between scenes, just put that into the
|
||||
scene format box, and nothing else.</p>
|
||||
|
||||
<h2>Build Overrides</h2>
|
||||
<p><b>Novel Outline Mode:</b> This option will build an outline version of the novel rather than the
|
||||
full thing. It overrides the title format settings without changing them. Each title will be
|
||||
written out, and the synopsis text will appear instead of the body text of the files. Some of
|
||||
the other options are still available in Outline Mode.</p>
|
||||
|
||||
<h2>Include Non-Text Elements</h2>
|
||||
<p><b>Include Synopsis:</b> This will add the synopsis comment as the first paragraph after each
|
||||
heading.</p>
|
||||
<p><b>Include Comments:</b> This will include any comments as additional paragraphs in the text.</p>
|
||||
<p><b>Include Keywords:</b> This will include any keywords and tags as clickable links after each
|
||||
heading.</p>
|
||||
|
||||
<h2>Additional Options</h2>
|
||||
<p><b>Include Novel Files:</b> This means all files that don't have a layout of type "Note" will be
|
||||
included. This is the normal mode when exporting the novel itself without the notes.</p>
|
||||
<p><b>Include Note Files:</b> This means all files with a layout of type "Note" <i>will</i> be
|
||||
included. Titles in note files are always left as they appear.</p>
|
||||
<p><b>Ignore Export Flag:</b> Each file in the project tree has an "Include when building project"
|
||||
option set, which is indicated by a little check mark in the "Flags" column. Files without This
|
||||
tick will normally be skipped during build, but can be included if this option is enabled.</p>
|
||||
+48
-24
@@ -39,7 +39,7 @@ from PyQt5.QtGui import (
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QVBoxLayout, QHBoxLayout, QTextBrowser, QPushButton, QLabel,
|
||||
QLineEdit, QGroupBox, QGridLayout, QProgressBar, QMenu, QAction,
|
||||
QFileDialog, QFontComboBox, QSpinBox
|
||||
QFileDialog, QFontComboBox, QSpinBox, QDialogButtonBox
|
||||
)
|
||||
|
||||
from nw.gui.additions import QSwitch
|
||||
@@ -75,7 +75,7 @@ class GuiBuildNovel(QDialog):
|
||||
self.nwdText = [] # List of markdown documents
|
||||
|
||||
self.setWindowTitle("Build Novel Project")
|
||||
self.setMinimumWidth(800)
|
||||
self.setMinimumWidth(900)
|
||||
self.setMinimumHeight(800)
|
||||
|
||||
self.resize(
|
||||
@@ -95,9 +95,26 @@ class GuiBuildNovel(QDialog):
|
||||
self.titleForm = QGridLayout(self)
|
||||
self.titleGroup.setLayout(self.titleForm)
|
||||
|
||||
fmtHelp = (
|
||||
r"<b>Formatting Codes:</b><br>"
|
||||
r"%title% for the title as set in the document<br>"
|
||||
r"%ch% for chapter number (1, 2, 3)<br>"
|
||||
r"%chw% for chapter number as a word (one, two)<br>"
|
||||
r"%sc% for scene number within chapter<br>"
|
||||
r"%sca% for scene number within novel"
|
||||
)
|
||||
fmtScHelp = (
|
||||
r"<br><br>"
|
||||
r"Leave blank to skip this heading, or set to a static text, like "
|
||||
r"for instance '* * *', to make a separator. The separator will "
|
||||
r"be centred automatically and only appear between sections of "
|
||||
r"the same type."
|
||||
)
|
||||
|
||||
self.fmtTitle = QLineEdit()
|
||||
self.fmtTitle.setMaxLength(200)
|
||||
self.fmtTitle.setFixedWidth(220)
|
||||
self.fmtTitle.setToolTip(fmtHelp)
|
||||
self.fmtTitle.setText(
|
||||
self._reFmtCodes(self.theProject.titleFormat["title"])
|
||||
)
|
||||
@@ -105,6 +122,7 @@ class GuiBuildNovel(QDialog):
|
||||
self.fmtChapter = QLineEdit()
|
||||
self.fmtChapter.setMaxLength(200)
|
||||
self.fmtChapter.setFixedWidth(220)
|
||||
self.fmtChapter.setToolTip(fmtHelp)
|
||||
self.fmtChapter.setText(
|
||||
self._reFmtCodes(self.theProject.titleFormat["chapter"])
|
||||
)
|
||||
@@ -112,6 +130,7 @@ class GuiBuildNovel(QDialog):
|
||||
self.fmtUnnumbered = QLineEdit()
|
||||
self.fmtUnnumbered.setMaxLength(200)
|
||||
self.fmtUnnumbered.setFixedWidth(220)
|
||||
self.fmtUnnumbered.setToolTip(fmtHelp)
|
||||
self.fmtUnnumbered.setText(
|
||||
self._reFmtCodes(self.theProject.titleFormat["unnumbered"])
|
||||
)
|
||||
@@ -119,6 +138,7 @@ class GuiBuildNovel(QDialog):
|
||||
self.fmtScene = QLineEdit()
|
||||
self.fmtScene.setMaxLength(200)
|
||||
self.fmtScene.setFixedWidth(220)
|
||||
self.fmtScene.setToolTip(fmtHelp + fmtScHelp)
|
||||
self.fmtScene.setText(
|
||||
self._reFmtCodes(self.theProject.titleFormat["scene"])
|
||||
)
|
||||
@@ -126,6 +146,7 @@ class GuiBuildNovel(QDialog):
|
||||
self.fmtSection = QLineEdit()
|
||||
self.fmtSection.setMaxLength(200)
|
||||
self.fmtSection.setFixedWidth(220)
|
||||
self.fmtSection.setToolTip(fmtHelp + fmtScHelp)
|
||||
self.fmtSection.setText(
|
||||
self._reFmtCodes(self.theProject.titleFormat["section"])
|
||||
)
|
||||
@@ -152,6 +173,7 @@ class GuiBuildNovel(QDialog):
|
||||
|
||||
self.textFont = QFontComboBox()
|
||||
self.textFont.setFixedWidth(220)
|
||||
self.textFont.setToolTip("The font is used for PDF and printing. Other formats have no font set.")
|
||||
self.textFont.setCurrentFont(
|
||||
QFont(self.optState.getString("GuiBuildNovel", "textFont", self.mainConf.textFont))
|
||||
)
|
||||
@@ -161,11 +183,13 @@ class GuiBuildNovel(QDialog):
|
||||
self.textSize.setMinimum(5)
|
||||
self.textSize.setMaximum(48)
|
||||
self.textSize.setSingleStep(1)
|
||||
self.textSize.setToolTip("The size is used for PDF and printing. Other formats have no size set.")
|
||||
self.textSize.setValue(
|
||||
self.optState.getInt("GuiBuildNovel", "textSize", self.mainConf.textSize)
|
||||
)
|
||||
|
||||
self.justifyText = QSwitch()
|
||||
self.justifyText.setToolTip("Applies to PDF, printing, HTML, and Open Document exports.")
|
||||
self.justifyText.setChecked(
|
||||
self.optState.getBool("GuiBuildNovel", "justifyText", False)
|
||||
)
|
||||
@@ -187,12 +211,15 @@ class GuiBuildNovel(QDialog):
|
||||
self.includeGroup.setLayout(self.includeForm)
|
||||
|
||||
self.includeSynopsis = QSwitch()
|
||||
self.includeSynopsis.setToolTip("Include synopsis type comments in the output.")
|
||||
self.includeSynopsis.setChecked(self.theProject.titleFormat["withSynopsis"])
|
||||
|
||||
self.includeComments = QSwitch()
|
||||
self.includeComments.setToolTip("Include plain comments in the output.")
|
||||
self.includeComments.setChecked(self.theProject.titleFormat["withComments"])
|
||||
|
||||
self.includeKeywords = QSwitch()
|
||||
self.includeKeywords.setToolTip("Include meta keywords (tags, references) in the output.")
|
||||
self.includeKeywords.setChecked(self.theProject.titleFormat["withKeywords"])
|
||||
|
||||
self.includeForm.addWidget(QLabel("Include synopsis"), 0, 0, 1, 1, Qt.AlignLeft)
|
||||
@@ -212,21 +239,34 @@ class GuiBuildNovel(QDialog):
|
||||
self.addsGroup.setLayout(self.addsForm)
|
||||
|
||||
self.novelFiles = QSwitch()
|
||||
self.novelFiles.setToolTip(
|
||||
"Include files with layouts 'Book', 'Page', 'Partition', "
|
||||
"'Chapter', 'Unnumbered', and 'Scene'."
|
||||
)
|
||||
self.novelFiles.setChecked(
|
||||
self.optState.getBool("GuiBuildNovel", "addNovel", True)
|
||||
)
|
||||
|
||||
self.noteFiles = QSwitch()
|
||||
self.noteFiles.setToolTip("Include files with layout 'Note'.")
|
||||
self.noteFiles.setChecked(
|
||||
self.optState.getBool("GuiBuildNovel", "addNotes", False)
|
||||
)
|
||||
|
||||
self.ignoreFlag = QSwitch()
|
||||
self.ignoreFlag.setToolTip(
|
||||
"Ignore the 'Include when building project' setting and include "
|
||||
"all files in the output."
|
||||
)
|
||||
self.ignoreFlag.setChecked(
|
||||
self.optState.getBool("GuiBuildNovel", "ignoreFlag", False)
|
||||
)
|
||||
|
||||
self.excludeBody = QSwitch()
|
||||
self.excludeBody.setToolTip(
|
||||
"Exclude body text in the output. Combine with 'Include synopsis' "
|
||||
"for making outline."
|
||||
)
|
||||
self.excludeBody.setChecked(
|
||||
self.optState.getBool("GuiBuildNovel", "excludeBody", False)
|
||||
)
|
||||
@@ -289,13 +329,12 @@ class GuiBuildNovel(QDialog):
|
||||
self.saveTXT.triggered.connect(lambda: self._saveDocument(self.FMT_TXT))
|
||||
self.saveMenu.addAction(self.saveTXT)
|
||||
|
||||
self.btnClose = QPushButton("Close")
|
||||
self.btnClose.clicked.connect(self._doClose)
|
||||
|
||||
self.buttonForm.addWidget(self.btnHelp, 0, 0)
|
||||
self.buttonForm.addWidget(self.btnSave, 0, 0)
|
||||
self.buttonForm.addWidget(self.btnPrint, 0, 1)
|
||||
self.buttonForm.addWidget(self.btnSave, 1, 0)
|
||||
self.buttonForm.addWidget(self.btnClose, 1, 1)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Close)
|
||||
self.buttonBox.rejected.connect(self._doClose)
|
||||
|
||||
# Assemble GUI
|
||||
# ============
|
||||
@@ -313,6 +352,7 @@ class GuiBuildNovel(QDialog):
|
||||
self.innerBox.addWidget(self.docView)
|
||||
|
||||
self.outerBox.addLayout(self.innerBox)
|
||||
self.outerBox.addWidget(self.buttonBox)
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
self.innerBox.setStretch(0, 0)
|
||||
@@ -671,22 +711,6 @@ class GuiBuildNovel(QDialog):
|
||||
|
||||
return
|
||||
|
||||
def _showHelp(self):
|
||||
"""Generate a help text and show it in the document window.
|
||||
"""
|
||||
docName = "exportHelp_%s.htm" % self.mainConf.guiLang
|
||||
docPath = path.join(self.mainConf.assetPath, "text", docName)
|
||||
if path.isfile(docPath):
|
||||
with open(docPath, mode="r", encoding="utf8") as inFile:
|
||||
helpText = inFile.read()
|
||||
self.docView.setStyleSheet()
|
||||
self.docView.setContent(helpText)
|
||||
else:
|
||||
self.theParent.makeAlert(
|
||||
"Could not open help text file for Build Project.", nwAlert.ERROR
|
||||
)
|
||||
return
|
||||
|
||||
def _reFmtCodes(self, theFormat):
|
||||
"""Translates old formatting codes to new ones.
|
||||
"""
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<novelWriterXML appVersion="0.6.1" hexVersion="0x000601f0" fileVersion="1.0" saveCount="172" autoCount="27" timeStamp="2020-05-28 00:29:31">
|
||||
<novelWriterXML appVersion="0.6.1" hexVersion="0x000601f0" fileVersion="1.0" saveCount="186" autoCount="28" timeStamp="2020-05-28 09:59:15">
|
||||
<project>
|
||||
<name>Sample Project</name>
|
||||
<title>Sample Project</title>
|
||||
|
||||
Reference in New Issue
Block a user