Fix note colour in viewer and fix tests
This commit is contained in:
@@ -500,7 +500,7 @@ class ToHtml(Tokenizer):
|
||||
else:
|
||||
sSynop = self._localLookup("Short Description")
|
||||
if self._genMode == self.M_PREVIEW:
|
||||
return f"<p class='comment'><span class='synopsis'>{sSynop}:</span> {text}</p>\n"
|
||||
return f"<p class='note'><span class='modifier'>{sSynop}:</span> {text}</p>\n"
|
||||
else:
|
||||
return f"<p class='synopsis'><strong>{sSynop}:</strong> {text}</p>\n"
|
||||
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
|
||||
@@ -702,10 +702,10 @@ def testCoreToHtml_Format(mockGUI):
|
||||
html.setPreview(True)
|
||||
|
||||
assert html._formatSynopsis("synopsis text", True) == (
|
||||
"<p class='comment'><span class='synopsis'>Synopsis:</span> synopsis text</p>\n"
|
||||
"<p class='note'><span class='modifier'>Synopsis:</span> synopsis text</p>\n"
|
||||
)
|
||||
assert html._formatSynopsis("short text", False) == (
|
||||
"<p class='comment'><span class='synopsis'>Short Description:</span> short text</p>\n"
|
||||
"<p class='note'><span class='modifier'>Short Description:</span> short text</p>\n"
|
||||
)
|
||||
assert html._formatComments("comment text") == (
|
||||
"<p class='comment'>comment text</p>\n"
|
||||
|
||||
@@ -20,20 +20,20 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from mocked import causeOSError
|
||||
from tools import writeFile
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QColor, QIcon, QPalette, QPixmap
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
|
||||
from novelwriter.common import NWConfigParser
|
||||
from novelwriter.constants import nwLabels
|
||||
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
|
||||
|
||||
from tests.mocked import causeOSError
|
||||
from tests.tools import writeFile
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
@@ -271,9 +271,9 @@ def testGuiTheme_Syntax(qtbot, monkeypatch, nwGUI):
|
||||
|
||||
# Check some values
|
||||
assert mainTheme.syntaxName == "Default Dark"
|
||||
assert mainTheme.colBack == QColor(54, 54, 54)
|
||||
assert mainTheme.colText == QColor(199, 207, 208)
|
||||
assert mainTheme.colLink == QColor(184, 200, 0)
|
||||
assert mainTheme.colBack == QColor(42, 42, 42)
|
||||
assert mainTheme.colText == QColor(204, 204, 204)
|
||||
assert mainTheme.colLink == QColor(102, 153, 204)
|
||||
|
||||
# qtbot.stop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user