Merge branch 'main' into release_1.0b1

This commit is contained in:
Veronica K. B. Olsen
2020-08-28 16:32:28 +02:00
35 changed files with 925 additions and 397 deletions
+2
View File
@@ -233,6 +233,7 @@ class nwUnicode:
U_ENDASH = "\u2013" # Short dash
U_EMDASH = "\u2014" # Long dash
U_HELLIP = "\u2026" # Ellipsis
U_MAPOSS = "\u02bc" # Modifier letter single apostrophe
## Spaces and Lines
U_NBSP = "\u00a0" # Non-breaking space
@@ -283,6 +284,7 @@ class nwUnicode:
H_ENDASH = "–"
H_EMDASH = "—"
H_HELLIP = "…"
H_MAPOSS = "ʼ"
## Spaces
H_NBSP = " "
+1
View File
@@ -112,6 +112,7 @@ class nwDocInsert(Enum):
QUOTE_RS = 9
QUOTE_LD = 10
QUOTE_RD = 11
MODAPOS_S = 12
# END Enum nwDocInsert
+1
View File
@@ -54,6 +54,7 @@ class ToHtml(Tokenizer):
nwUnicode.U_NBSP : nwUnicode.H_NBSP,
nwUnicode.U_THNSP : nwUnicode.H_THNSP,
nwUnicode.U_THNBSP : nwUnicode.H_THNBSP,
nwUnicode.U_MAPOSS : nwUnicode.H_RSQUO,
}
self.revDict = {}
self.reReplace = []
+2
View File
@@ -612,6 +612,8 @@ class GuiDocEditor(QTextEdit):
theText = nwUnicode.U_EMDASH
elif theInsert == nwDocInsert.ELLIPSIS:
theText = nwUnicode.U_HELLIP
elif theInsert == nwDocInsert.MODAPOS_S:
theText = nwUnicode.U_MAPOSS
elif theInsert == nwDocInsert.QUOTE_LS:
theText = self.typSQOpen
elif theInsert == nwDocInsert.QUOTE_RS:
+4 -4
View File
@@ -143,17 +143,17 @@ class GuiDocHighlighter(QSyntaxHighlighter):
# Quoted Strings
if self.mainConf.highlightQuotes:
self.hRules.append((
"{:s}(.+?){:s}".format('"', '"'), {
"\\B{:s}(.*?){:s}\\B".format('"', '"'), {
0 : self.hStyles["dialogue1"],
}
))
self.hRules.append((
"{:s}(.+?){:s}".format(*self.mainConf.fmtDoubleQuotes), {
"\\B{:s}(.*?){:s}\\B".format(*self.mainConf.fmtDoubleQuotes), {
0 : self.hStyles["dialogue2"],
}
))
self.hRules.append((
"{:s}(.+?){:s}".format(*self.mainConf.fmtSingleQuotes), {
"\\B{:s}(.*?){:s}\\B".format(*self.mainConf.fmtSingleQuotes), {
0 : self.hStyles["dialogue3"],
}
))
@@ -198,7 +198,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
# Build a QRegExp for spell checker
# Include additional characters that the highlighter should
# consider to be word separators
wordSep = r"_\+"
wordSep = r"_\+/"
wordSep += nwUnicode.U_ENDASH
wordSep += nwUnicode.U_EMDASH
self.spellRx = QRegularExpression(r"\b[^\s"+wordSep+r"]+\b")
+10
View File
@@ -554,6 +554,16 @@ class GuiMainMenu(QMenuBar):
# Insert > Separator
self.insertMenu.addSeparator()
# Insert > Alternative Apostrophe
self.aInsMSApos = QAction("Alternative Apostrophe", self)
self.aInsMSApos.setStatusTip("Insert unicode modifier letter single apostrophe")
self.aInsMSApos.setShortcut("Ctrl+K, '")
self.aInsMSApos.triggered.connect(lambda: self._docInsert(nwDocInsert.MODAPOS_S))
self.insertMenu.addAction(self.aInsMSApos)
# Insert > Separator
self.insertMenu.addSeparator()
# Insert > Hard Line Break
self.aInsHardBreak = QAction("Hard Line Break", self)
self.aInsHardBreak.setStatusTip("Insert a hard line break")
+1
View File
@@ -1039,6 +1039,7 @@ class GuiMain(QMainWindow):
self.addAction(self.mainMenu.aInsQuoteRS)
self.addAction(self.mainMenu.aInsQuoteLD)
self.addAction(self.mainMenu.aInsQuoteRD)
self.addAction(self.mainMenu.aInsMSApos)
self.addAction(self.mainMenu.aInsHardBreak)
self.addAction(self.mainMenu.aInsNBSpace)
self.addAction(self.mainMenu.aInsThinSpace)