diff --git a/nw/assets/text/exportHelp_en.htm b/nw/assets/text/exportHelp_en.htm deleted file mode 100644 index 8287f7e9..00000000 --- a/nw/assets/text/exportHelp_en.htm +++ /dev/null @@ -1,49 +0,0 @@ -

Help!

-

A brief guide to make the most out of the Build Novel Project tool.

- -

Novel Title Formats

-

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 %title%. Any static text will be left as-is in the - final title. An empty field means the title isn't written out at all.

-

The available formatting keywords are:

-

%title% – This is replaced with the text you put in your headings in your - documents

-

%ch% – 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.

-

%chw% – 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.

-

%sc% – 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.

-

%sca% – 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.

-

\\ – Two backslashes are replaced by a line break.

-

Note: 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 %keyword% 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 * * * separator between scenes, just put that into the - scene format box, and nothing else.

- -

Build Overrides

-

Novel Outline Mode: 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.

- -

Include Non-Text Elements

-

Include Synopsis: This will add the synopsis comment as the first paragraph after each - heading.

-

Include Comments: This will include any comments as additional paragraphs in the text.

-

Include Keywords: This will include any keywords and tags as clickable links after each - heading.

- -

Additional Options

-

Include Novel Files: 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.

-

Include Note Files: This means all files with a layout of type "Note" will be - included. Titles in note files are always left as they appear.

-

Ignore Export Flag: 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.

diff --git a/nw/gui/build.py b/nw/gui/build.py index 5d37add6..6a7c99cc 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -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"Formatting Codes:
" + r"%title% for the title as set in the document
" + r"%ch% for chapter number (1, 2, 3)
" + r"%chw% for chapter number as a word (one, two)
" + r"%sc% for scene number within chapter
" + r"%sca% for scene number within novel" + ) + fmtScHelp = ( + r"

" + 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. """ diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 04c40574..80465ec6 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project