Add optional padding to single and double quotes
This commit is contained in:
@@ -164,6 +164,9 @@ class Config:
|
|||||||
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]
|
||||||
self.fmtDoubleQuotes = [nwUnicode.U_LDQUO, nwUnicode.U_RDQUO]
|
self.fmtDoubleQuotes = [nwUnicode.U_LDQUO, nwUnicode.U_RDQUO]
|
||||||
|
self.fmtPadSingle = False
|
||||||
|
self.fmtPadDouble = False
|
||||||
|
self.fmtPadThin = True
|
||||||
|
|
||||||
## Spell Checking
|
## Spell Checking
|
||||||
self.spellTool = None
|
self.spellTool = None
|
||||||
@@ -578,6 +581,15 @@ class Config:
|
|||||||
self.fmtDoubleQuotes = self._parseLine(
|
self.fmtDoubleQuotes = self._parseLine(
|
||||||
cnfParse, cnfSec, "fmtdoublequote", self.CNF_S_LST, self.fmtDoubleQuotes
|
cnfParse, cnfSec, "fmtdoublequote", self.CNF_S_LST, self.fmtDoubleQuotes
|
||||||
)
|
)
|
||||||
|
self.fmtPadSingle = self._parseLine(
|
||||||
|
cnfParse, cnfSec, "fmtpadsingle", self.CNF_BOOL, self.fmtPadSingle
|
||||||
|
)
|
||||||
|
self.fmtPadDouble = self._parseLine(
|
||||||
|
cnfParse, cnfSec, "fmtpaddouble", self.CNF_BOOL, self.fmtPadDouble
|
||||||
|
)
|
||||||
|
self.fmtPadThin = self._parseLine(
|
||||||
|
cnfParse, cnfSec, "fmtpadthin", self.CNF_BOOL, self.fmtPadThin
|
||||||
|
)
|
||||||
self.spellTool = self._parseLine(
|
self.spellTool = self._parseLine(
|
||||||
cnfParse, cnfSec, "spelltool", self.CNF_STR, self.spellTool
|
cnfParse, cnfSec, "spelltool", self.CNF_STR, self.spellTool
|
||||||
)
|
)
|
||||||
@@ -746,6 +758,9 @@ class Config:
|
|||||||
cnfParse.set(cnfSec, "autoscrollpos", str(self.autoScrollPos))
|
cnfParse.set(cnfSec, "autoscrollpos", str(self.autoScrollPos))
|
||||||
cnfParse.set(cnfSec, "fmtsinglequote", self._packList(self.fmtSingleQuotes))
|
cnfParse.set(cnfSec, "fmtsinglequote", self._packList(self.fmtSingleQuotes))
|
||||||
cnfParse.set(cnfSec, "fmtdoublequote", self._packList(self.fmtDoubleQuotes))
|
cnfParse.set(cnfSec, "fmtdoublequote", self._packList(self.fmtDoubleQuotes))
|
||||||
|
cnfParse.set(cnfSec, "fmtpadsingle", str(self.fmtPadSingle))
|
||||||
|
cnfParse.set(cnfSec, "fmtpaddouble", str(self.fmtPadDouble))
|
||||||
|
cnfParse.set(cnfSec, "fmtpadthin", str(self.fmtPadThin))
|
||||||
cnfParse.set(cnfSec, "spelltool", str(self.spellTool))
|
cnfParse.set(cnfSec, "spelltool", str(self.spellTool))
|
||||||
cnfParse.set(cnfSec, "spellcheck", str(self.spellLanguage))
|
cnfParse.set(cnfSec, "spellcheck", str(self.spellLanguage))
|
||||||
cnfParse.set(cnfSec, "showtabsnspaces", str(self.showTabsNSpaces))
|
cnfParse.set(cnfSec, "showtabsnspaces", str(self.showTabsNSpaces))
|
||||||
|
|||||||
+25
-4
@@ -98,10 +98,10 @@ class GuiDocEditor(QTextEdit):
|
|||||||
self.queuePos = None # Used for delayed change of cursor position
|
self.queuePos = None # Used for delayed change of cursor position
|
||||||
|
|
||||||
# Typography
|
# Typography
|
||||||
self.typDQOpen = self.mainConf.fmtDoubleQuotes[0]
|
self.typDQOpen = '"'
|
||||||
self.typDQClose = self.mainConf.fmtDoubleQuotes[1]
|
self.typDQClose = '"'
|
||||||
self.typSQOpen = self.mainConf.fmtSingleQuotes[0]
|
self.typSQOpen = "'"
|
||||||
self.typSQClose = self.mainConf.fmtSingleQuotes[1]
|
self.typSQClose = "'"
|
||||||
|
|
||||||
# Core Elements and Signals
|
# Core Elements and Signals
|
||||||
self.qDocument = self.document()
|
self.qDocument = self.document()
|
||||||
@@ -197,6 +197,26 @@ class GuiDocEditor(QTextEdit):
|
|||||||
self.nonWord += "".join(self.mainConf.fmtDoubleQuotes)
|
self.nonWord += "".join(self.mainConf.fmtDoubleQuotes)
|
||||||
self.nonWord += "".join(self.mainConf.fmtSingleQuotes)
|
self.nonWord += "".join(self.mainConf.fmtSingleQuotes)
|
||||||
|
|
||||||
|
# Typography
|
||||||
|
if self.mainConf.fmtPadThin:
|
||||||
|
padChar = nwUnicode.U_THNBSP
|
||||||
|
else:
|
||||||
|
padChar = nwUnicode.U_NBSP
|
||||||
|
|
||||||
|
if self.mainConf.fmtPadSingle:
|
||||||
|
self.typSQOpen = self.mainConf.fmtSingleQuotes[0] + padChar
|
||||||
|
self.typSQClose = padChar + self.mainConf.fmtSingleQuotes[1]
|
||||||
|
else:
|
||||||
|
self.typSQOpen = self.mainConf.fmtSingleQuotes[0]
|
||||||
|
self.typSQClose = self.mainConf.fmtSingleQuotes[1]
|
||||||
|
|
||||||
|
if self.mainConf.fmtPadDouble:
|
||||||
|
self.typDQOpen = self.mainConf.fmtDoubleQuotes[0] + padChar
|
||||||
|
self.typDQClose = padChar + self.mainConf.fmtDoubleQuotes[1]
|
||||||
|
else:
|
||||||
|
self.typDQOpen = self.mainConf.fmtDoubleQuotes[0]
|
||||||
|
self.typDQClose = self.mainConf.fmtDoubleQuotes[1]
|
||||||
|
|
||||||
# Reload spell check and dictionaries
|
# Reload spell check and dictionaries
|
||||||
self._setupSpellChecking()
|
self._setupSpellChecking()
|
||||||
self.setDictionaries()
|
self.setDictionaries()
|
||||||
@@ -206,6 +226,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
if self.mainConf.textFont is None:
|
if self.mainConf.textFont is None:
|
||||||
# If none is defined, set the default back to config
|
# If none is defined, set the default back to config
|
||||||
self.mainConf.textFont = self.qDocument.defaultFont().family()
|
self.mainConf.textFont = self.qDocument.defaultFont().family()
|
||||||
|
|
||||||
theFont.setFamily(self.mainConf.textFont)
|
theFont.setFamily(self.mainConf.textFont)
|
||||||
theFont.setPointSize(self.mainConf.textSize)
|
theFont.setPointSize(self.mainConf.textSize)
|
||||||
self.setFont(theFont)
|
self.setFont(theFont)
|
||||||
|
|||||||
Reference in New Issue
Block a user