From 22a34be21a60c2c008b640513fec0da9dacbc24f Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:08:35 +0200 Subject: [PATCH] Fix note colour in viewer and fix tests --- novelwriter/core/tohtml.py | 2 +- novelwriter/gui/docviewer.py | 8 +++++--- tests/test_core/test_core_tohtml.py | 4 ++-- tests/test_gui/test_gui_theme.py | 16 ++++++++-------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/novelwriter/core/tohtml.py b/novelwriter/core/tohtml.py index 960f8ace..8fe97628 100644 --- a/novelwriter/core/tohtml.py +++ b/novelwriter/core/tohtml.py @@ -500,7 +500,7 @@ class ToHtml(Tokenizer): else: sSynop = self._localLookup("Short Description") if self._genMode == self.M_PREVIEW: - return f"
{sSynop}: {text}
\n" + return f"{sSynop}: {text}
\n" else: return f"{sSynop}: {text}
\n" diff --git a/novelwriter/gui/docviewer.py b/novelwriter/gui/docviewer.py index daa4566a..99ac941f 100644 --- a/novelwriter/gui/docviewer.py +++ b/novelwriter/gui/docviewer.py @@ -30,7 +30,7 @@ import logging from enum import Enum -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QPoint, Qt, QUrl +from PyQt5.QtCore import QPoint, Qt, QUrl, pyqtSignal, pyqtSlot from PyQt5.QtGui import ( QCursor, QFont, QMouseEvent, QPalette, QResizeEvent, QTextCursor, QTextOption @@ -44,7 +44,7 @@ from novelwriter import CONFIG, SHARED from novelwriter.common import cssCol from novelwriter.constants import nwHeaders, nwUnicode from novelwriter.core.tohtml import ToHtml -from novelwriter.enum import nwItemType, nwDocAction, nwDocMode +from novelwriter.enum import nwDocAction, nwDocMode, nwItemType from novelwriter.error import logException from novelwriter.extensions.eventfilters import WheelEventFilter from novelwriter.extensions.modified import NIconToolButton @@ -479,6 +479,7 @@ class GuiDocViewer(QTextBrowser): colKeys = cssCol(SHARED.theme.colKey) colOpts = cssCol(SHARED.theme.colOpt) colHide = cssCol(SHARED.theme.colHidden) + colNote = cssCol(SHARED.theme.colNote) colMods = cssCol(SHARED.theme.colMod) self.document().setDefaultStyleSheet( f"body {{color: {colText};}}\n" @@ -488,7 +489,8 @@ class GuiDocViewer(QTextBrowser): f".tags {{color: {colKeys};}}\n" f".optional {{color: {colOpts};}}\n" f".comment {{color: {colHide};}}\n" - f".synopsis {{color: {colMods};}}\n" + f".note {{color: {colNote};}}\n" + f".modifier {{color: {colMods};}}\n" ".title {text-align: center;}\n" ) diff --git a/tests/test_core/test_core_tohtml.py b/tests/test_core/test_core_tohtml.py index c2d6def1..b7420081 100644 --- a/tests/test_core/test_core_tohtml.py +++ b/tests/test_core/test_core_tohtml.py @@ -702,10 +702,10 @@ def testCoreToHtml_Format(mockGUI): html.setPreview(True) assert html._formatSynopsis("synopsis text", True) == ( - "Synopsis: synopsis text
\n" + "Synopsis: synopsis text
\n" ) assert html._formatSynopsis("short text", False) == ( - "Short Description: short text
\n" + "Short Description: short text
\n" ) assert html._formatComments("comment text") == ( "comment text
\n" diff --git a/tests/test_gui/test_gui_theme.py b/tests/test_gui/test_gui_theme.py index 0490eabf..1402e309 100644 --- a/tests/test_gui/test_gui_theme.py +++ b/tests/test_gui/test_gui_theme.py @@ -20,20 +20,20 @@ along with this program. If not, see