From f719266846d96773979ea73164d0ef0772fb8995 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Thu, 30 May 2019 22:09:08 +0200 Subject: [PATCH] Added colour for tag errors --- nw/gui/dochighlight.py | 3 ++- nw/project/index.py | 4 ++-- nw/theme.py | 2 ++ nw/themes/default/theme.conf | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/nw/gui/dochighlight.py b/nw/gui/dochighlight.py index a4f61a68..c99fa3ba 100644 --- a/nw/gui/dochighlight.py +++ b/nw/gui/dochighlight.py @@ -44,6 +44,7 @@ class GuiDocHighlighter(QSyntaxHighlighter): self.colKey = QColor(*self.theTheme.colKey) self.colVal = QColor(*self.theTheme.colVal) self.colSpell = QColor(*self.theTheme.colSpell) + self.colTagErr = QColor(*self.theTheme.colTagErr) self.hStyles = { "header1" : self._makeFormat(self.colHead, "bold",1.8), @@ -197,7 +198,7 @@ class GuiDocHighlighter(QSyntaxHighlighter): self.setFormat(xPos, xLen, self.hStyles["value"]) else: kwFmt = self.format(xPos) - kwFmt.setUnderlineColor(self.colSpell) + kwFmt.setUnderlineColor(self.colTagErr) kwFmt.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline) self.setFormat(xPos, xLen, kwFmt) diff --git a/nw/project/index.py b/nw/project/index.py index 56baf52b..86a3ad57 100644 --- a/nw/project/index.py +++ b/nw/project/index.py @@ -266,7 +266,7 @@ class NWIndex(): if nBits == 0: return [] - # If we have a tag, the first value is always OK, rest is ignored + # If we have a tag, only the first value is accepted, the rest is ignored if theBits[0] == self.TAG_KEY and nBits > 1: isGood[0] = True if theBits[1] in self.tagIndex.keys(): @@ -278,7 +278,7 @@ class NWIndex(): isGood[1] = True return isGood - # If we're still here, we better check the references + # If we're still here, we better check that the references exist if tItem.itemClass == nwItemClass.NOVEL: isGood[0] = theBits[0] in self.NOVEL_KEYS else: diff --git a/nw/theme.py b/nw/theme.py index cab4c302..a34a2895 100644 --- a/nw/theme.py +++ b/nw/theme.py @@ -37,6 +37,7 @@ class Theme: self.colKey = [0,0,0] self.colVal = [0,0,0] self.colSpell = [0,0,0] + self.colTagErr = [0,0,0] # Changeable Settings self.guiTheme = None @@ -94,6 +95,7 @@ class Theme: self.colKey = self._loadColour(confParser,cnfSec,"keyword") self.colVal = self._loadColour(confParser,cnfSec,"value") self.colSpell = self._loadColour(confParser,cnfSec,"spellcheckline") + self.colTagErr = self._loadColour(confParser,cnfSec,"tagerror") return True diff --git a/nw/themes/default/theme.conf b/nw/themes/default/theme.conf index 117f53ea..bac88942 100644 --- a/nw/themes/default/theme.conf +++ b/nw/themes/default/theme.conf @@ -9,3 +9,4 @@ hidden = 150, 150, 150 keyword = 200, 46, 0 value = 184, 200, 0 spellcheckline = 200, 46, 0 +tagerror = 46, 200, 0