Added highlighting for replace tags

This commit is contained in:
Veronica K. B. Olsen
2019-06-04 21:28:39 +02:00
parent 5ff56a2b4b
commit ec6937beeb
3 changed files with 11 additions and 0 deletions
+8
View File
@@ -45,6 +45,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
self.colVal = QColor(*self.theTheme.colVal)
self.colSpell = QColor(*self.theTheme.colSpell)
self.colTagErr = QColor(*self.theTheme.colTagErr)
self.colRepTag = QColor(*self.theTheme.colRepTag)
self.hStyles = {
"header1" : self._makeFormat(self.colHead, "bold",1.8),
@@ -62,6 +63,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
"dialogue1" : self._makeFormat(self.colDialN),
"dialogue2" : self._makeFormat(self.colDialD),
"dialogue3" : self._makeFormat(self.colDialS),
"replace" : self._makeFormat(self.colRepTag),
"hidden" : self._makeFormat(self.colComm),
"keyword" : self._makeFormat(self.colKey),
"value" : self._makeFormat(self.colVal),
@@ -148,6 +150,12 @@ class GuiDocHighlighter(QSyntaxHighlighter):
}
))
self.hRules.append((
"<(.+?)>", {
0 : self.hStyles["replace"],
}
))
# Build a QRegExp for each pattern and for the spell checker
self.rules = [(QRegularExpression(a),b) for (a,b) in self.hRules]
self.spellRx = QRegularExpression(r"\b[^\s]+\b")
+2
View File
@@ -38,6 +38,7 @@ class Theme:
self.colVal = [0,0,0]
self.colSpell = [0,0,0]
self.colTagErr = [0,0,0]
self.colRepTag = [0,0,0]
# Changeable Settings
self.guiTheme = None
@@ -96,6 +97,7 @@ class Theme:
self.colVal = self._loadColour(confParser,cnfSec,"value")
self.colSpell = self._loadColour(confParser,cnfSec,"spellcheckline")
self.colTagErr = self._loadColour(confParser,cnfSec,"tagerror")
self.colRepTag = self._loadColour(confParser,cnfSec,"replacetag")
return True
+1
View File
@@ -10,3 +10,4 @@ keyword = 200, 46, 0
value = 184, 200, 0
spellcheckline = 200, 46, 0
tagerror = 46, 200, 0
replacetag = 0, 184, 46