Merge pull request #357 from vkbo/option_highlight_emph
Optional Colour Highlighting of Emphasised Text
This commit is contained in:
@@ -126,6 +126,7 @@ class Config:
|
|||||||
self.bigDocLimit = 800
|
self.bigDocLimit = 800
|
||||||
self.showFullPath = True
|
self.showFullPath = True
|
||||||
self.highlightQuotes = True
|
self.highlightQuotes = True
|
||||||
|
self.highlightEmph = True
|
||||||
|
|
||||||
self.fmtApostrophe = nwUnicode.U_RSQUO
|
self.fmtApostrophe = nwUnicode.U_RSQUO
|
||||||
self.fmtSingleQuotes = [nwUnicode.U_LSQUO, nwUnicode.U_RSQUO]
|
self.fmtSingleQuotes = [nwUnicode.U_LSQUO, nwUnicode.U_RSQUO]
|
||||||
@@ -469,6 +470,9 @@ class Config:
|
|||||||
self.highlightQuotes = self._parseLine(
|
self.highlightQuotes = self._parseLine(
|
||||||
cnfParse, cnfSec, "highlightquotes", self.CNF_BOOL, self.highlightQuotes
|
cnfParse, cnfSec, "highlightquotes", self.CNF_BOOL, self.highlightQuotes
|
||||||
)
|
)
|
||||||
|
self.highlightEmph = self._parseLine(
|
||||||
|
cnfParse, cnfSec, "highlightemph", self.CNF_BOOL, self.highlightEmph
|
||||||
|
)
|
||||||
|
|
||||||
## Backup
|
## Backup
|
||||||
cnfSec = "Backup"
|
cnfSec = "Backup"
|
||||||
@@ -590,6 +594,7 @@ class Config:
|
|||||||
cnfParse.set(cnfSec,"bigdoclimit", str(self.bigDocLimit))
|
cnfParse.set(cnfSec,"bigdoclimit", str(self.bigDocLimit))
|
||||||
cnfParse.set(cnfSec,"showfullpath", str(self.showFullPath))
|
cnfParse.set(cnfSec,"showfullpath", str(self.showFullPath))
|
||||||
cnfParse.set(cnfSec,"highlightquotes", str(self.highlightQuotes))
|
cnfParse.set(cnfSec,"highlightquotes", str(self.highlightQuotes))
|
||||||
|
cnfParse.set(cnfSec,"highlightemph", str(self.highlightEmph))
|
||||||
|
|
||||||
## Backup
|
## Backup
|
||||||
cnfSec = "Backup"
|
cnfSec = "Backup"
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
|
|
||||||
self.colHead = QColor(*self.theTheme.colHead)
|
self.colHead = QColor(*self.theTheme.colHead)
|
||||||
self.colHeadH = QColor(*self.theTheme.colHeadH)
|
self.colHeadH = QColor(*self.theTheme.colHeadH)
|
||||||
self.colEmph = QColor(*self.theTheme.colEmph)
|
|
||||||
self.colDialN = QColor(*self.theTheme.colDialN)
|
self.colDialN = QColor(*self.theTheme.colDialN)
|
||||||
self.colDialD = QColor(*self.theTheme.colDialD)
|
self.colDialD = QColor(*self.theTheme.colDialD)
|
||||||
self.colDialS = QColor(*self.theTheme.colDialS)
|
self.colDialS = QColor(*self.theTheme.colDialS)
|
||||||
@@ -96,6 +95,11 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
self.colTrail = QColor(*self.theTheme.colEmph)
|
self.colTrail = QColor(*self.theTheme.colEmph)
|
||||||
self.colTrail.setAlpha(64)
|
self.colTrail.setAlpha(64)
|
||||||
|
|
||||||
|
if self.mainConf.highlightEmph:
|
||||||
|
self.colEmph = QColor(*self.theTheme.colEmph)
|
||||||
|
else:
|
||||||
|
self.colEmph = None
|
||||||
|
|
||||||
self.hStyles = {
|
self.hStyles = {
|
||||||
"header1" : self._makeFormat(self.colHead, "bold", 1.8),
|
"header1" : self._makeFormat(self.colHead, "bold", 1.8),
|
||||||
"header2" : self._makeFormat(self.colHead, "bold", 1.6),
|
"header2" : self._makeFormat(self.colHead, "bold", 1.6),
|
||||||
|
|||||||
+58
-47
@@ -494,26 +494,6 @@ class GuiConfigEditLayoutTab(QWidget):
|
|||||||
theUnit="px"
|
theUnit="px"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Writing Guides
|
|
||||||
# ==============
|
|
||||||
self.mainForm.addGroupLabel("Writing Guides")
|
|
||||||
|
|
||||||
## Show Tabs and Spaces
|
|
||||||
self.showTabsNSpaces = QSwitch()
|
|
||||||
self.showTabsNSpaces.setChecked(self.mainConf.showTabsNSpaces)
|
|
||||||
self.mainForm.addRow(
|
|
||||||
"Show tabs and spaces",
|
|
||||||
self.showTabsNSpaces
|
|
||||||
)
|
|
||||||
|
|
||||||
## Show Line Endings
|
|
||||||
self.showLineEndings = QSwitch()
|
|
||||||
self.showLineEndings.setChecked(self.mainConf.showLineEndings)
|
|
||||||
self.mainForm.addRow(
|
|
||||||
"Show line endings",
|
|
||||||
self.showLineEndings
|
|
||||||
)
|
|
||||||
|
|
||||||
# Render Options
|
# Render Options
|
||||||
# ==============
|
# ==============
|
||||||
self.mainForm.addGroupLabel("Render Text")
|
self.mainForm.addGroupLabel("Render Text")
|
||||||
@@ -541,33 +521,29 @@ class GuiConfigEditLayoutTab(QWidget):
|
|||||||
validEntries = True
|
validEntries = True
|
||||||
needsRestart = False
|
needsRestart = False
|
||||||
|
|
||||||
textFont = self.textStyleFont.text()
|
textFont = self.textStyleFont.text()
|
||||||
textSize = self.textStyleSize.value()
|
textSize = self.textStyleSize.value()
|
||||||
textWidth = self.textFlowMax.value()
|
textWidth = self.textFlowMax.value()
|
||||||
zenWidth = self.zenDocWidth.value()
|
zenWidth = self.zenDocWidth.value()
|
||||||
textFixedW = not self.textFlowFixed.isChecked()
|
textFixedW = not self.textFlowFixed.isChecked()
|
||||||
hideZenFooter = self.hideZenFooter.isChecked()
|
hideZenFooter = self.hideZenFooter.isChecked()
|
||||||
doJustify = self.textJustify.isChecked()
|
doJustify = self.textJustify.isChecked()
|
||||||
textMargin = self.textMargin.value()
|
textMargin = self.textMargin.value()
|
||||||
tabWidth = self.tabWidth.value()
|
tabWidth = self.tabWidth.value()
|
||||||
showTabsNSpaces = self.showTabsNSpaces.isChecked()
|
viewComments = self.viewComments.isChecked()
|
||||||
showLineEndings = self.showLineEndings.isChecked()
|
viewSynopsis = self.viewSynopsis.isChecked()
|
||||||
viewComments = self.viewComments.isChecked()
|
|
||||||
viewSynopsis = self.viewSynopsis.isChecked()
|
|
||||||
|
|
||||||
self.mainConf.textFont = textFont
|
self.mainConf.textFont = textFont
|
||||||
self.mainConf.textSize = textSize
|
self.mainConf.textSize = textSize
|
||||||
self.mainConf.textWidth = textWidth
|
self.mainConf.textWidth = textWidth
|
||||||
self.mainConf.zenWidth = zenWidth
|
self.mainConf.zenWidth = zenWidth
|
||||||
self.mainConf.textFixedW = textFixedW
|
self.mainConf.textFixedW = textFixedW
|
||||||
self.mainConf.hideZenFooter = hideZenFooter
|
self.mainConf.hideZenFooter = hideZenFooter
|
||||||
self.mainConf.doJustify = doJustify
|
self.mainConf.doJustify = doJustify
|
||||||
self.mainConf.textMargin = textMargin
|
self.mainConf.textMargin = textMargin
|
||||||
self.mainConf.tabWidth = tabWidth
|
self.mainConf.tabWidth = tabWidth
|
||||||
self.mainConf.showTabsNSpaces = showTabsNSpaces
|
self.mainConf.viewComments = viewComments
|
||||||
self.mainConf.showLineEndings = showLineEndings
|
self.mainConf.viewSynopsis = viewSynopsis
|
||||||
self.mainConf.viewComments = viewComments
|
|
||||||
self.mainConf.viewSynopsis = viewSynopsis
|
|
||||||
|
|
||||||
self.mainConf.confChanged = True
|
self.mainConf.confChanged = True
|
||||||
|
|
||||||
@@ -629,7 +605,16 @@ class GuiConfigEditEditingTab(QWidget):
|
|||||||
self.highlightQuotes.setChecked(self.mainConf.highlightQuotes)
|
self.highlightQuotes.setChecked(self.mainConf.highlightQuotes)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Highlight text wrapped in quotes",
|
"Highlight text wrapped in quotes",
|
||||||
self.highlightQuotes
|
self.highlightQuotes,
|
||||||
|
helpText="Applies to single, double and straight quotes."
|
||||||
|
)
|
||||||
|
|
||||||
|
self.highlightEmph = QSwitch()
|
||||||
|
self.highlightEmph.setChecked(self.mainConf.highlightEmph)
|
||||||
|
self.mainForm.addRow(
|
||||||
|
"Add highlight colour to emphasised text",
|
||||||
|
self.highlightEmph,
|
||||||
|
helpText="Applies to emphasis, strong and strikethrough."
|
||||||
)
|
)
|
||||||
|
|
||||||
# Spell Checking
|
# Spell Checking
|
||||||
@@ -678,6 +663,26 @@ class GuiConfigEditEditingTab(QWidget):
|
|||||||
theUnit="kB"
|
theUnit="kB"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Writing Guides
|
||||||
|
# ==============
|
||||||
|
self.mainForm.addGroupLabel("Writing Guides")
|
||||||
|
|
||||||
|
## Show Tabs and Spaces
|
||||||
|
self.showTabsNSpaces = QSwitch()
|
||||||
|
self.showTabsNSpaces.setChecked(self.mainConf.showTabsNSpaces)
|
||||||
|
self.mainForm.addRow(
|
||||||
|
"Show tabs and spaces",
|
||||||
|
self.showTabsNSpaces
|
||||||
|
)
|
||||||
|
|
||||||
|
## Show Line Endings
|
||||||
|
self.showLineEndings = QSwitch()
|
||||||
|
self.showLineEndings.setChecked(self.mainConf.showLineEndings)
|
||||||
|
self.mainForm.addRow(
|
||||||
|
"Show line endings",
|
||||||
|
self.showLineEndings
|
||||||
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def saveValues(self):
|
def saveValues(self):
|
||||||
@@ -687,15 +692,21 @@ class GuiConfigEditEditingTab(QWidget):
|
|||||||
|
|
||||||
guiSyntax = self.selectSyntax.currentData()
|
guiSyntax = self.selectSyntax.currentData()
|
||||||
highlightQuotes = self.highlightQuotes.isChecked()
|
highlightQuotes = self.highlightQuotes.isChecked()
|
||||||
|
highlightEmph = self.highlightEmph.isChecked()
|
||||||
spellTool = self.spellToolList.currentData()
|
spellTool = self.spellToolList.currentData()
|
||||||
spellLanguage = self.spellLangList.currentData()
|
spellLanguage = self.spellLangList.currentData()
|
||||||
bigDocLimit = self.bigDocLimit.value()
|
bigDocLimit = self.bigDocLimit.value()
|
||||||
|
showTabsNSpaces = self.showTabsNSpaces.isChecked()
|
||||||
|
showLineEndings = self.showLineEndings.isChecked()
|
||||||
|
|
||||||
self.mainConf.guiSyntax = guiSyntax
|
self.mainConf.guiSyntax = guiSyntax
|
||||||
self.mainConf.highlightQuotes = highlightQuotes
|
self.mainConf.highlightQuotes = highlightQuotes
|
||||||
|
self.mainConf.highlightEmph = highlightEmph
|
||||||
self.mainConf.spellTool = spellTool
|
self.mainConf.spellTool = spellTool
|
||||||
self.mainConf.spellLanguage = spellLanguage
|
self.mainConf.spellLanguage = spellLanguage
|
||||||
self.mainConf.bigDocLimit = bigDocLimit
|
self.mainConf.bigDocLimit = bigDocLimit
|
||||||
|
self.mainConf.showTabsNSpaces = showTabsNSpaces
|
||||||
|
self.mainConf.showLineEndings = showLineEndings
|
||||||
|
|
||||||
self.mainConf.confChanged = True
|
self.mainConf.confChanged = True
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[Main]
|
[Main]
|
||||||
timestamp = 2020-06-27 21:21:19
|
timestamp = 2020-06-29 17:34:15
|
||||||
theme = default
|
theme = default
|
||||||
syntax = default_light
|
syntax = default_light
|
||||||
icons = typicons_colour_light
|
icons = typicons_colour_light
|
||||||
@@ -46,6 +46,7 @@ showlineendings = False
|
|||||||
bigdoclimit = 800
|
bigdoclimit = 800
|
||||||
showfullpath = True
|
showfullpath = True
|
||||||
highlightquotes = True
|
highlightquotes = True
|
||||||
|
highlightemph = True
|
||||||
|
|
||||||
[Backup]
|
[Backup]
|
||||||
backuppath =
|
backuppath =
|
||||||
|
|||||||
Reference in New Issue
Block a user