From 2c98683aff6b9e04b349064c2de04e2f7c53232e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 27 May 2020 23:43:16 +0200 Subject: [PATCH 1/7] Path should be read only, not disabled --- nw/gui/dialogs/projectload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nw/gui/dialogs/projectload.py b/nw/gui/dialogs/projectload.py index 3b64848b..f5513ea0 100644 --- a/nw/gui/dialogs/projectload.py +++ b/nw/gui/dialogs/projectload.py @@ -93,7 +93,7 @@ class GuiProjectLoad(QDialog): self.lblRecent = QLabel("Recently Opened Projects") self.lblPath = QLabel("Path") self.selPath = QLineEdit("") - self.selPath.setEnabled(False) + self.selPath.setReadOnly(True) self.browseButton = QPushButton("...") self.browseButton.setMaximumWidth(30) From 24f47c94465adc6d44f66b16fb1c31b83f92ed38 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 00:15:20 +0200 Subject: [PATCH 2/7] Make the title format boxes a bit bigger --- nw/gui/build.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nw/gui/build.py b/nw/gui/build.py index 7e5c00c8..d5313707 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -79,7 +79,7 @@ class GuiBuildNovel(QDialog): self.setMinimumHeight(800) self.resize( - self.optState.getInt("GuiBuildNovel", "winWidth", 800), + self.optState.getInt("GuiBuildNovel", "winWidth", 900), self.optState.getInt("GuiBuildNovel", "winHeight", 800) ) @@ -97,27 +97,27 @@ class GuiBuildNovel(QDialog): self.fmtTitle = QLineEdit() self.fmtTitle.setMaxLength(200) - self.fmtTitle.setFixedWidth(200) + self.fmtTitle.setFixedWidth(220) self.fmtTitle.setText(self.theProject.titleFormat["title"]) self.fmtChapter = QLineEdit() self.fmtChapter.setMaxLength(200) - self.fmtChapter.setFixedWidth(200) + self.fmtChapter.setFixedWidth(220) self.fmtChapter.setText(self.theProject.titleFormat["chapter"]) self.fmtUnnumbered = QLineEdit() self.fmtUnnumbered.setMaxLength(200) - self.fmtUnnumbered.setFixedWidth(200) + self.fmtUnnumbered.setFixedWidth(220) self.fmtUnnumbered.setText(self.theProject.titleFormat["unnumbered"]) self.fmtScene = QLineEdit() self.fmtScene.setMaxLength(200) - self.fmtScene.setFixedWidth(200) + self.fmtScene.setFixedWidth(220) self.fmtScene.setText(self.theProject.titleFormat["scene"]) self.fmtSection = QLineEdit() self.fmtSection.setMaxLength(200) - self.fmtSection.setFixedWidth(200) + self.fmtSection.setFixedWidth(220) self.fmtSection.setText(self.theProject.titleFormat["section"]) self.titleForm.addWidget(QLabel("Title"), 0, 0, 1, 1, Qt.AlignLeft) @@ -141,7 +141,7 @@ class GuiBuildNovel(QDialog): self.textGroup.setLayout(self.textForm) self.textFont = QFontComboBox() - self.textFont.setFixedWidth(200) + self.textFont.setFixedWidth(220) self.textFont.setCurrentFont( QFont(self.optState.getString("GuiBuildNovel", "textFont", self.mainConf.textFont)) ) From bfaddabf8d78089f72ff52e6a662eaa1d9a09f61 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 00:25:20 +0200 Subject: [PATCH 3/7] Changed the formatting codes for titles --- nw/core/tokenizer.py | 10 +++++----- nw/gui/build.py | 29 ++++++++++++++++++++++++----- sample/nwProject.nwx | 4 ++-- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/nw/core/tokenizer.py b/nw/core/tokenizer.py index 2fa784f5..9d820585 100644 --- a/nw/core/tokenizer.py +++ b/nw/core/tokenizer.py @@ -565,11 +565,11 @@ class Tokenizer(): def _formatHeading(self, theTitle, theText): """Replaces the %keyword% strings. """ - theTitle = theTitle.replace(r"%title%", theText) - theTitle = theTitle.replace(r"%chnum%", str(self.numChapter)) - theTitle = theTitle.replace(r"%scnum%", str(self.numChScene)) - theTitle = theTitle.replace(r"%scabsnum%", str(self.numAbsScene)) - theTitle = theTitle.replace(r"%chnumword%", numberToWord(self.numChapter,"en")) + theTitle = theTitle.replace(r"%title%", theText) + theTitle = theTitle.replace(r"%ch%", str(self.numChapter)) + theTitle = theTitle.replace(r"%sc1%", str(self.numChScene)) + theTitle = theTitle.replace(r"%sc2%", str(self.numAbsScene)) + theTitle = theTitle.replace(r"%chword%", numberToWord(self.numChapter,"en")) return theTitle # END Class Tokenizer diff --git a/nw/gui/build.py b/nw/gui/build.py index d5313707..af8f7d9e 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -98,27 +98,37 @@ class GuiBuildNovel(QDialog): self.fmtTitle = QLineEdit() self.fmtTitle.setMaxLength(200) self.fmtTitle.setFixedWidth(220) - self.fmtTitle.setText(self.theProject.titleFormat["title"]) + self.fmtTitle.setText( + self._reFmtCodes(self.theProject.titleFormat["title"]) + ) self.fmtChapter = QLineEdit() self.fmtChapter.setMaxLength(200) self.fmtChapter.setFixedWidth(220) - self.fmtChapter.setText(self.theProject.titleFormat["chapter"]) + self.fmtChapter.setText( + self._reFmtCodes(self.theProject.titleFormat["chapter"]) + ) self.fmtUnnumbered = QLineEdit() self.fmtUnnumbered.setMaxLength(200) self.fmtUnnumbered.setFixedWidth(220) - self.fmtUnnumbered.setText(self.theProject.titleFormat["unnumbered"]) + self.fmtUnnumbered.setText( + self._reFmtCodes(self.theProject.titleFormat["unnumbered"]) + ) self.fmtScene = QLineEdit() self.fmtScene.setMaxLength(200) self.fmtScene.setFixedWidth(220) - self.fmtScene.setText(self.theProject.titleFormat["scene"]) + self.fmtScene.setText( + self._reFmtCodes(self.theProject.titleFormat["scene"]) + ) self.fmtSection = QLineEdit() self.fmtSection.setMaxLength(200) self.fmtSection.setFixedWidth(220) - self.fmtSection.setText(self.theProject.titleFormat["section"]) + self.fmtSection.setText( + self._reFmtCodes(self.theProject.titleFormat["section"]) + ) self.titleForm.addWidget(QLabel("Title"), 0, 0, 1, 1, Qt.AlignLeft) self.titleForm.addWidget(self.fmtTitle, 0, 1, 1, 1, Qt.AlignRight) @@ -677,6 +687,15 @@ class GuiBuildNovel(QDialog): ) return + def _reFmtCodes(self, theFormat): + """Translates old formatting codes to new ones. + """ + theFormat = theFormat.replace(r"%chnum%", r"%ch%") + theFormat = theFormat.replace(r"%scnum%", r"%sc1%") + theFormat = theFormat.replace(r"%scabsnum%", r"%sc2%") + theFormat = theFormat.replace(r"%chnumword%", r"%chword%") + return theFormat + # END Class GuiBuildNovel class GuiBuildNovelDocView(QTextBrowser): diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index ad832035..5e29e0bd 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project @@ -20,7 +20,7 @@ %title% - Chapter %chnum%: %title% + Chapter %ch%: %title% %title% * * *
From 5be945b901b111f6dc5962cdc8f782682c262c53 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 00:25:33 +0200 Subject: [PATCH 4/7] Updated documentation --- docs/source/export.txt | 4 ++-- nw/assets/text/exportHelp_en.htm | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/source/export.txt b/docs/source/export.txt index 0cb9d05b..2c462c90 100644 --- a/docs/source/export.txt +++ b/docs/source/export.txt @@ -13,12 +13,12 @@ This is done through a series of keyword-replace steps. The keyword ``%title%`` will always be replaced by the text you put after the ``#`` characters in your document. -The keywords ``%chnum%`` and ``%chnumword%`` is replaced by a number, or a number word, respectively. +The keywords ``%ch%`` and ``%chword%`` is replaced by a number, or a number word, respectively. The number is incremented by one each time the build tool sees a new heading of level two in a file with layout "Chapter". If the file has layout "Unnumbered", the counter is not incremented. the latter is useful for for instance Prologue and Epilogue chapters. -Likewise, the keywords ``%scnum%`` and ``%scabsnum%`` are number counters for scene files. +Likewise, the keywords ``%sc1%`` and ``%sc2%`` are number counters for scene files. These are incremented each time a heading of level three is encountered. The former keyword is reset to one for each new chapter, while the latter is not reset but counts from first scene encountered. diff --git a/nw/assets/text/exportHelp_en.htm b/nw/assets/text/exportHelp_en.htm index e921f05d..3c6824a1 100644 --- a/nw/assets/text/exportHelp_en.htm +++ b/nw/assets/text/exportHelp_en.htm @@ -9,14 +9,14 @@

The available formatting keywords are:

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

-

%chnum% – This is replaced with the chapter number of your chapter type +

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

-

%chnumword% – This is replaced with the chapter number, but instead of an +

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

-

%scnum% – This is replaced with the scene number. The number is reset to one +

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

-

%scabsnum% – This is replaced with the absolute scene number. That is, the +

%sc2% – 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 From f9e2d57fa7330dacf57f3c3e5b9d9e17a4395e0e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 00:29:45 +0200 Subject: [PATCH 5/7] This is even better --- docs/source/export.txt | 4 ++-- nw/assets/text/exportHelp_en.htm | 6 +++--- nw/core/tokenizer.py | 10 +++++----- nw/gui/build.py | 6 +++--- sample/nwProject.nwx | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/source/export.txt b/docs/source/export.txt index 2c462c90..62e81e2f 100644 --- a/docs/source/export.txt +++ b/docs/source/export.txt @@ -13,12 +13,12 @@ This is done through a series of keyword-replace steps. The keyword ``%title%`` will always be replaced by the text you put after the ``#`` characters in your document. -The keywords ``%ch%`` and ``%chword%`` is replaced by a number, or a number word, respectively. +The keywords ``%ch%`` and ``%chw%`` is replaced by a number, or a number word, respectively. The number is incremented by one each time the build tool sees a new heading of level two in a file with layout "Chapter". If the file has layout "Unnumbered", the counter is not incremented. the latter is useful for for instance Prologue and Epilogue chapters. -Likewise, the keywords ``%sc1%`` and ``%sc2%`` are number counters for scene files. +Likewise, the keywords ``%sc%`` and ``%sca%`` are number counters for scene files. These are incremented each time a heading of level three is encountered. The former keyword is reset to one for each new chapter, while the latter is not reset but counts from first scene encountered. diff --git a/nw/assets/text/exportHelp_en.htm b/nw/assets/text/exportHelp_en.htm index 3c6824a1..8287f7e9 100644 --- a/nw/assets/text/exportHelp_en.htm +++ b/nw/assets/text/exportHelp_en.htm @@ -12,11 +12,11 @@

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

-

%chword% – This is replaced with the chapter number, but instead of an +

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

-

%sc1% – This is replaced with the scene number. The number is reset to one +

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

-

%sc2% – This is replaced with the absolute scene number. That is, the +

%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 diff --git a/nw/core/tokenizer.py b/nw/core/tokenizer.py index 9d820585..8de64118 100644 --- a/nw/core/tokenizer.py +++ b/nw/core/tokenizer.py @@ -565,11 +565,11 @@ class Tokenizer(): def _formatHeading(self, theTitle, theText): """Replaces the %keyword% strings. """ - theTitle = theTitle.replace(r"%title%", theText) - theTitle = theTitle.replace(r"%ch%", str(self.numChapter)) - theTitle = theTitle.replace(r"%sc1%", str(self.numChScene)) - theTitle = theTitle.replace(r"%sc2%", str(self.numAbsScene)) - theTitle = theTitle.replace(r"%chword%", numberToWord(self.numChapter,"en")) + theTitle = theTitle.replace(r"%title%", theText) + theTitle = theTitle.replace(r"%ch%", str(self.numChapter)) + theTitle = theTitle.replace(r"%sc%", str(self.numChScene)) + theTitle = theTitle.replace(r"%sca%", str(self.numAbsScene)) + theTitle = theTitle.replace(r"%chw%", numberToWord(self.numChapter,"en")) return theTitle # END Class Tokenizer diff --git a/nw/gui/build.py b/nw/gui/build.py index af8f7d9e..5d37add6 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -691,9 +691,9 @@ class GuiBuildNovel(QDialog): """Translates old formatting codes to new ones. """ theFormat = theFormat.replace(r"%chnum%", r"%ch%") - theFormat = theFormat.replace(r"%scnum%", r"%sc1%") - theFormat = theFormat.replace(r"%scabsnum%", r"%sc2%") - theFormat = theFormat.replace(r"%chnumword%", r"%chword%") + theFormat = theFormat.replace(r"%scnum%", r"%sc%") + theFormat = theFormat.replace(r"%scabsnum%", r"%sca%") + theFormat = theFormat.replace(r"%chnumword%", r"%chw%") return theFormat # END Class GuiBuildNovel diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 5e29e0bd..04c40574 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project @@ -22,7 +22,7 @@ %title% Chapter %ch%: %title% %title% - * * * + Scene %ch%.%sc%: %title%

True True From 9809e57e26911969c81c7c27e6599c0cbfdb166b Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 10:02:14 +0200 Subject: [PATCH 6/7] Replaced Help button with descriptive tooltips instead. --- nw/assets/text/exportHelp_en.htm | 49 ---------------------- nw/gui/build.py | 72 +++++++++++++++++++++----------- sample/nwProject.nwx | 2 +- 3 files changed, 49 insertions(+), 74 deletions(-) delete mode 100644 nw/assets/text/exportHelp_en.htm 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 From 6487352787c82d981240b49bc5fee5048053c80f Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 10:08:18 +0200 Subject: [PATCH 7/7] Updated changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44965876..c12bd392 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # novelWriter ChangeLog -## Not Yet Released +## Version 0.6.2 [2020-xx-xx] **Bugfixes** @@ -11,6 +11,8 @@ * Renamed the "Generate Preview" button on the "Build Novel Project" tool to "Build Novel Project". You must actually click this to be able to export or print. Issue #237, PR #238. * Added font family and font size selectors to the "Build Novel Project" tool. You may want a different print font than used in the editor itself. Issue #230, PR #238. +* Removed the "Help" feature in "Build Novel Project" and instead written detailed tooltips. Issue #250, PR #249. +* Changed the title formnatting codes for "Build Novel Project" to something less verbose. The old codes are translated automatically. Issue #247, PR #249. * A margin of the viewport (outside the document) has been added to the document editor and viewer to make room for the document title bar. Previously, the title bar would sit on top of the document top margin, which would sometimes hide text that would otherwise be visible. PR #236. * Fixed some alignment issue for the status icon on the project tree details panel. Mentioned in #235, PR #239. * Removed the `Xo` icon for NO_LAYOUT in the project tree details panel. Mentioned in #235, PR #239.