From 02bb15f59880689ecf12a4d5c3e3b9ab67f20b56 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 25 May 2020 09:56:56 +0200 Subject: [PATCH 1/2] Fixed copy/paste error in docs about title line breaks in exports --- docs/source/export.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/export.txt b/docs/source/export.txt index a125a2a7..0cb9d05b 100644 --- a/docs/source/export.txt +++ b/docs/source/export.txt @@ -22,7 +22,7 @@ Likewise, the keywords ``%scnum%`` and ``%scabsnum%`` are number counters for sc 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. -If you want to insert a line break in you=r title format, add two backslashes ``%\\%``. +If you want to insert a line break in you=r title format, add two backslashes ``\\``. .. note:: Header formatting only applies to novel files. From a71b4047175379ac57ca8c61485db8668b257ce7 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 25 May 2020 09:57:12 +0200 Subject: [PATCH 2/2] Fix the justify text setting in build project --- nw/gui/build.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/nw/gui/build.py b/nw/gui/build.py index b31ec8c9..093d5975 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -357,6 +357,7 @@ class GuiBuildNovel(QDialog): self.htmlStyle = makeHtml.getStyleSheet() # Load the preview document with the html data + self.docView.setJustify(justifyText) self.docView.setStyleSheet(self.htmlStyle) self.docView.setContent(self.htmlText) @@ -663,11 +664,6 @@ class GuiBuildNovelDocView(QTextBrowser): theFont.setPointSize(self.mainConf.textSize) self.setFont(theFont) - theOpt = QTextOption() - if self.mainConf.doJustify: - theOpt.setAlignment(Qt.AlignJustify) - self.qDocument.setDefaultTextOption(theOpt) - docPalette = self.palette() docPalette.setColor(QPalette.Base, QColor(255, 255, 255)) docPalette.setColor(QPalette.Text, QColor( 0, 0, 0)) @@ -681,6 +677,17 @@ class GuiBuildNovelDocView(QTextBrowser): return + def setJustify(self, doJustify): + """Set the justify text option. + """ + theOpt = self.qDocument.defaultTextOption() + if doJustify: + theOpt.setAlignment(Qt.AlignJustify) + else: + theOpt.setAlignment(Qt.AlignAbsolute) + self.qDocument.setDefaultTextOption(theOpt) + return + def setContent(self, theText): """Set the content, either from text or list of text. """