Improve dialogue highlighting (#1864)
This commit is contained in:
@@ -168,9 +168,8 @@ A syntax theme ``.conf`` file consists of the following settings:
|
|||||||
headertext = 0, 0, 0
|
headertext = 0, 0, 0
|
||||||
headertag = 0, 0, 0
|
headertag = 0, 0, 0
|
||||||
emphasis = 0, 0, 0
|
emphasis = 0, 0, 0
|
||||||
straightquotes = 0, 0, 0
|
dialog = 0, 0, 0
|
||||||
doublequotes = 0, 0, 0
|
altdialog = 0, 0, 0
|
||||||
singlequotes = 0, 0, 0
|
|
||||||
note = 0, 0, 0
|
note = 0, 0, 0
|
||||||
hidden = 0, 0, 0
|
hidden = 0, 0, 0
|
||||||
shortcode = 0, 0, 0
|
shortcode = 0, 0, 0
|
||||||
@@ -201,4 +200,5 @@ Omitted syntax colours default to black, except ``background`` which defaults to
|
|||||||
The ``texthighlight`` syntax colour entry was added.
|
The ``texthighlight`` syntax colour entry was added.
|
||||||
|
|
||||||
.. versionadded:: 2.5
|
.. versionadded:: 2.5
|
||||||
The ``note`` and ``tag`` syntax colour entries were added.
|
The ``dialog``, ``altdialog``, ``note`` and ``tag`` syntax colour entries were added.
|
||||||
|
``straightquotes``, ``doublequotes`` and ``singlequotes`` were removed.
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ link = 77, 077, 255
|
|||||||
headertext = 255, 255, 255
|
headertext = 255, 255, 255
|
||||||
headertag = 50, 0, 180
|
headertag = 50, 0, 180
|
||||||
emphasis = 0, 255, 255
|
emphasis = 0, 255, 255
|
||||||
straightquotes = 7, 27, 219
|
dialog = 0, 255, 0
|
||||||
doublequotes = 0, 255, 0
|
altdialog = 0, 140, 255
|
||||||
singlequotes = 0, 140, 255
|
|
||||||
note = 150, 150, 150
|
note = 150, 150, 150
|
||||||
hidden = 77, 77, 100
|
hidden = 77, 77, 100
|
||||||
shortcode = 255, 255, 0
|
shortcode = 255, 255, 0
|
||||||
|
|||||||
@@ -26,9 +26,8 @@ link = 102, 153, 204
|
|||||||
headertext = 153, 204, 153
|
headertext = 153, 204, 153
|
||||||
headertag = 153, 204, 153, 160
|
headertag = 153, 204, 153, 160
|
||||||
emphasis = 249, 145, 87
|
emphasis = 249, 145, 87
|
||||||
straightquotes = 230, 66, 80
|
dialog = 102, 153, 204
|
||||||
doublequotes = 102, 153, 204
|
altdialog = 102, 153, 204
|
||||||
singlequotes = 102, 153, 204
|
|
||||||
note = 255, 255, 216
|
note = 255, 255, 216
|
||||||
hidden = 150, 150, 150
|
hidden = 150, 150, 150
|
||||||
shortcode = 153, 204, 153
|
shortcode = 153, 204, 153
|
||||||
|
|||||||
@@ -26,9 +26,8 @@ link = 0, 0, 200
|
|||||||
headertext = 0, 100, 0
|
headertext = 0, 100, 0
|
||||||
headertag = 0, 100, 0, 160
|
headertag = 0, 100, 0, 160
|
||||||
emphasis = 174, 110, 30
|
emphasis = 174, 110, 30
|
||||||
straightquotes = 200, 50, 50
|
dialog = 0, 0, 200
|
||||||
doublequotes = 0, 0, 200
|
altdialog = 0, 0, 200
|
||||||
singlequotes = 0, 0, 200
|
|
||||||
note = 100, 100, 0
|
note = 100, 100, 0
|
||||||
hidden = 100, 100, 100
|
hidden = 100, 100, 100
|
||||||
shortcode = 0, 100, 0
|
shortcode = 0, 100, 0
|
||||||
|
|||||||
@@ -28,9 +28,8 @@ link = 255, 121, 198
|
|||||||
headertext = 189, 147, 249
|
headertext = 189, 147, 249
|
||||||
headertag = 189, 147, 249, 160
|
headertag = 189, 147, 249, 160
|
||||||
emphasis = 255, 184, 108
|
emphasis = 255, 184, 108
|
||||||
straightquotes = 255, 85, 85
|
dialog = 80, 250, 123
|
||||||
doublequotes = 80, 250, 123
|
altdialog = 241, 250, 140
|
||||||
singlequotes = 241, 250, 140
|
|
||||||
note = 255, 204, 233
|
note = 255, 204, 233
|
||||||
hidden = 98, 114, 164
|
hidden = 98, 114, 164
|
||||||
shortcode = 139, 233, 253
|
shortcode = 139, 233, 253
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ link = 200, 200, 200
|
|||||||
headertext = 225, 225, 225
|
headertext = 225, 225, 225
|
||||||
headertag = 225, 225, 225, 160
|
headertag = 225, 225, 225, 160
|
||||||
emphasis = 200, 200, 200
|
emphasis = 200, 200, 200
|
||||||
straightquotes = 200, 200, 200
|
dialog = 200, 200, 200
|
||||||
doublequotes = 200, 200, 200
|
altdialog = 200, 200, 200
|
||||||
singlequotes = 200, 200, 200
|
|
||||||
note = 200, 200, 200
|
note = 200, 200, 200
|
||||||
hidden = 150, 150, 150
|
hidden = 150, 150, 150
|
||||||
shortcode = 225, 225, 225
|
shortcode = 225, 225, 225
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ link = 20, 20, 20
|
|||||||
headertext = 0, 0, 0
|
headertext = 0, 0, 0
|
||||||
headertag = 0, 0, 0, 160
|
headertag = 0, 0, 0, 160
|
||||||
emphasis = 20, 20, 20
|
emphasis = 20, 20, 20
|
||||||
straightquotes = 20, 20, 20
|
dialog = 20, 20, 20
|
||||||
doublequotes = 20, 20, 20
|
altdialog = 20, 20, 20
|
||||||
singlequotes = 20, 20, 20
|
|
||||||
note = 20, 20, 20
|
note = 20, 20, 20
|
||||||
hidden = 100, 100, 100
|
hidden = 100, 100, 100
|
||||||
shortcode = 0, 0, 0
|
shortcode = 0, 0, 0
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ link = 40, 142, 215
|
|||||||
headertext = 40, 142, 215
|
headertext = 40, 142, 215
|
||||||
headertag = 40, 142, 215, 160
|
headertag = 40, 142, 215, 160
|
||||||
emphasis = 224, 175, 5
|
emphasis = 224, 175, 5
|
||||||
straightquotes = 222, 61, 58
|
dialog = 8, 145, 106
|
||||||
doublequotes = 8, 145, 106
|
altdialog = 218, 170, 1
|
||||||
singlequotes = 218, 170, 1
|
|
||||||
note = 128, 118, 75
|
note = 128, 118, 75
|
||||||
hidden = 152, 159, 177
|
hidden = 152, 159, 177
|
||||||
shortcode = 40, 142, 215
|
shortcode = 40, 142, 215
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ link = 130, 170, 255
|
|||||||
headertext = 130, 170, 255
|
headertext = 130, 170, 255
|
||||||
headertag = 130, 170, 255, 160
|
headertag = 130, 170, 255, 160
|
||||||
emphasis = 236, 196, 141
|
emphasis = 236, 196, 141
|
||||||
straightquotes = 247, 140, 108
|
dialog = 173, 219, 103
|
||||||
doublequotes = 173, 219, 103
|
altdialog = 255, 235, 149
|
||||||
singlequotes = 255, 235, 149
|
|
||||||
note = 255, 249, 202
|
note = 255, 249, 202
|
||||||
hidden = 99, 119, 119
|
hidden = 99, 119, 119
|
||||||
shortcode = 130, 170, 255
|
shortcode = 130, 170, 255
|
||||||
|
|||||||
@@ -26,9 +26,8 @@ link = 9, 161, 237
|
|||||||
headertext = 45, 174, 88
|
headertext = 45, 174, 88
|
||||||
headertag = 45, 174, 88, 160
|
headertag = 45, 174, 88, 160
|
||||||
emphasis = 19, 187, 183
|
emphasis = 19, 187, 183
|
||||||
straightquotes = 255, 92, 87
|
dialog = 207, 156, 0
|
||||||
doublequotes = 207, 156, 0
|
altdialog = 207, 156, 0
|
||||||
singlequotes = 207, 156, 0
|
|
||||||
note = 120, 187, 185
|
note = 120, 187, 185
|
||||||
hidden = 145, 148, 162
|
hidden = 145, 148, 162
|
||||||
shortcode = 247, 103, 187
|
shortcode = 247, 103, 187
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ link = 38, 139, 210
|
|||||||
headertext = 147, 161, 161
|
headertext = 147, 161, 161
|
||||||
headertag = 42, 161, 152
|
headertag = 42, 161, 152
|
||||||
emphasis = 38, 139, 210
|
emphasis = 38, 139, 210
|
||||||
straightquotes = 211, 54, 130
|
dialog = 42, 161, 152
|
||||||
doublequotes = 42, 161, 152
|
altdialog = 42, 161, 152
|
||||||
singlequotes = 42, 161, 152
|
|
||||||
note = 101, 161, 156
|
note = 101, 161, 156
|
||||||
hidden = 147, 161, 161
|
hidden = 147, 161, 161
|
||||||
shortcode = 147, 161, 161
|
shortcode = 147, 161, 161
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ link = 38, 139, 210
|
|||||||
headertext = 88, 110, 117
|
headertext = 88, 110, 117
|
||||||
headertag = 42, 161, 152
|
headertag = 42, 161, 152
|
||||||
emphasis = 38, 139, 210
|
emphasis = 38, 139, 210
|
||||||
straightquotes = 211, 54, 130
|
dialog = 42, 161, 152
|
||||||
doublequotes = 42, 161, 152
|
altdialog = 42, 161, 152
|
||||||
singlequotes = 42, 161, 152
|
|
||||||
note = 27, 102, 96
|
note = 27, 102, 96
|
||||||
hidden = 88, 110, 117
|
hidden = 88, 110, 117
|
||||||
shortcode = 88, 110, 117
|
shortcode = 88, 110, 117
|
||||||
|
|||||||
@@ -23,9 +23,8 @@ link = 114, 159, 207
|
|||||||
headertext = 114, 159, 207
|
headertext = 114, 159, 207
|
||||||
headertag = 114, 159, 207, 160
|
headertag = 114, 159, 207, 160
|
||||||
emphasis = 196, 160, 0
|
emphasis = 196, 160, 0
|
||||||
straightquotes = 239, 41, 41
|
dialog = 138, 226, 52
|
||||||
doublequotes = 138, 226, 52
|
altdialog = 252, 233, 79
|
||||||
singlequotes = 252, 233, 79
|
|
||||||
note = 252, 242, 164
|
note = 252, 242, 164
|
||||||
hidden = 143, 143, 141
|
hidden = 143, 143, 141
|
||||||
shortcode = 114, 159, 207
|
shortcode = 114, 159, 207
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ link = 66, 113, 174
|
|||||||
headertext = 66, 113, 174
|
headertext = 66, 113, 174
|
||||||
headertag = 66, 113, 174, 160
|
headertag = 66, 113, 174, 160
|
||||||
emphasis = 245, 135, 31
|
emphasis = 245, 135, 31
|
||||||
straightquotes = 240, 40, 41
|
dialog = 113, 140, 0
|
||||||
doublequotes = 113, 140, 0
|
altdialog = 234, 183, 0
|
||||||
singlequotes = 234, 183, 0
|
|
||||||
note = 115, 90, 0
|
note = 115, 90, 0
|
||||||
hidden = 142, 144, 140
|
hidden = 142, 144, 140
|
||||||
shortcode = 66, 113, 174
|
shortcode = 66, 113, 174
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ link = 197, 200, 198, 160
|
|||||||
headertext = 129, 162, 190
|
headertext = 129, 162, 190
|
||||||
headertag = 94, 119, 139
|
headertag = 94, 119, 139
|
||||||
emphasis = 222, 147, 95
|
emphasis = 222, 147, 95
|
||||||
straightquotes = 204, 102, 102
|
dialog = 181, 189, 104
|
||||||
doublequotes = 181, 189, 104
|
altdialog = 240, 198, 116
|
||||||
singlequotes = 240, 198, 116
|
|
||||||
note = 240, 219, 178
|
note = 240, 219, 178
|
||||||
hidden = 150, 152, 150
|
hidden = 150, 152, 150
|
||||||
shortcode = 129, 162, 190
|
shortcode = 129, 162, 190
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ link = 187, 218, 255
|
|||||||
headertext = 187, 218, 255
|
headertext = 187, 218, 255
|
||||||
headertag = 187, 218, 255, 160
|
headertag = 187, 218, 255, 160
|
||||||
emphasis = 255, 197, 143
|
emphasis = 255, 197, 143
|
||||||
straightquotes = 255, 157, 164
|
dialog = 209, 241, 169
|
||||||
doublequotes = 209, 241, 169
|
altdialog = 255, 238, 173
|
||||||
singlequotes = 255, 238, 173
|
|
||||||
note = 255, 247, 214
|
note = 255, 247, 214
|
||||||
hidden = 114, 133, 183
|
hidden = 114, 133, 183
|
||||||
shortcode = 187, 218, 255
|
shortcode = 187, 218, 255
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ link = 122, 166, 218
|
|||||||
headertext = 122, 166, 218
|
headertext = 122, 166, 218
|
||||||
headertag = 122, 166, 218, 160
|
headertag = 122, 166, 218, 160
|
||||||
emphasis = 231, 140, 69
|
emphasis = 231, 140, 69
|
||||||
straightquotes = 213, 78, 83
|
dialog = 185, 202, 74
|
||||||
doublequotes = 185, 202, 74
|
altdialog = 231, 197, 71
|
||||||
singlequotes = 231, 197, 71
|
|
||||||
note = 231, 214, 150
|
note = 231, 214, 150
|
||||||
hidden = 150, 152, 150
|
hidden = 150, 152, 150
|
||||||
shortcode = 122, 166, 218
|
shortcode = 122, 166, 218
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ link = 102, 153, 204
|
|||||||
headertext = 102, 153, 204
|
headertext = 102, 153, 204
|
||||||
headertag = 102, 153, 204, 160
|
headertag = 102, 153, 204, 160
|
||||||
emphasis = 249, 145, 57
|
emphasis = 249, 145, 57
|
||||||
straightquotes = 242, 119, 122
|
dialog = 153, 204, 153
|
||||||
doublequotes = 153, 204, 153
|
altdialog = 255, 204, 102
|
||||||
singlequotes = 255, 204, 102
|
|
||||||
note = 255, 230, 179
|
note = 255, 230, 179
|
||||||
hidden = 153, 153, 153
|
hidden = 153, 153, 153
|
||||||
shortcode = 102, 153, 204
|
shortcode = 102, 153, 204
|
||||||
|
|||||||
+18
-9
@@ -158,9 +158,12 @@ class Config:
|
|||||||
self.autoScrollPos = 30 # Start point for typewriter-like scrolling
|
self.autoScrollPos = 30 # Start point for typewriter-like scrolling
|
||||||
self.scrollPastEnd = True # Scroll past end of document, and centre cursor
|
self.scrollPastEnd = True # Scroll past end of document, and centre cursor
|
||||||
|
|
||||||
self.highlightQuotes = True # Highlight text in quotes
|
self.dialogStyle = 2 # Quote type to use for dialogue
|
||||||
self.allowOpenSQuote = False # Allow open-ended single quotes
|
self.allowOpenDial = True # Allow open-ended dialogue quotes
|
||||||
self.allowOpenDQuote = True # Allow open-ended double quotes
|
self.narratorBreak = "" # Symbol to use for narrator break
|
||||||
|
self.dialogLine = "" # Symbol to use for dialogue line
|
||||||
|
self.altDialogOpen = "" # Alternative dialog symbol, open
|
||||||
|
self.altDialogClose = "" # Alternative dialog symbol, close
|
||||||
self.highlightEmph = True # Add colour to text emphasis
|
self.highlightEmph = True # Add colour to text emphasis
|
||||||
|
|
||||||
self.stopWhenIdle = True # Stop the status bar clock when the user is idle
|
self.stopWhenIdle = True # Stop the status bar clock when the user is idle
|
||||||
@@ -618,9 +621,12 @@ class Config:
|
|||||||
self.showMultiSpaces = conf.rdBool(sec, "showmultispaces", self.showMultiSpaces)
|
self.showMultiSpaces = conf.rdBool(sec, "showmultispaces", self.showMultiSpaces)
|
||||||
self.incNotesWCount = conf.rdBool(sec, "incnoteswcount", self.incNotesWCount)
|
self.incNotesWCount = conf.rdBool(sec, "incnoteswcount", self.incNotesWCount)
|
||||||
self.showFullPath = conf.rdBool(sec, "showfullpath", self.showFullPath)
|
self.showFullPath = conf.rdBool(sec, "showfullpath", self.showFullPath)
|
||||||
self.highlightQuotes = conf.rdBool(sec, "highlightquotes", self.highlightQuotes)
|
self.dialogStyle = conf.rdInt(sec, "dialogstyle", self.dialogStyle)
|
||||||
self.allowOpenSQuote = conf.rdBool(sec, "allowopensquote", self.allowOpenSQuote)
|
self.allowOpenDial = conf.rdBool(sec, "allowopendial", self.allowOpenDial)
|
||||||
self.allowOpenDQuote = conf.rdBool(sec, "allowopendquote", self.allowOpenDQuote)
|
self.narratorBreak = conf.rdStr(sec, "narratorbreak", self.narratorBreak)
|
||||||
|
self.altDialogOpen = conf.rdStr(sec, "altdialogopen", self.altDialogOpen)
|
||||||
|
self.altDialogClose = conf.rdStr(sec, "altdialogclose", self.altDialogClose)
|
||||||
|
self.dialogLine = conf.rdStr(sec, "dialogline", self.dialogLine)
|
||||||
self.highlightEmph = conf.rdBool(sec, "highlightemph", self.highlightEmph)
|
self.highlightEmph = conf.rdBool(sec, "highlightemph", self.highlightEmph)
|
||||||
self.stopWhenIdle = conf.rdBool(sec, "stopwhenidle", self.stopWhenIdle)
|
self.stopWhenIdle = conf.rdBool(sec, "stopwhenidle", self.stopWhenIdle)
|
||||||
self.userIdleTime = conf.rdInt(sec, "useridletime", self.userIdleTime)
|
self.userIdleTime = conf.rdInt(sec, "useridletime", self.userIdleTime)
|
||||||
@@ -726,9 +732,12 @@ class Config:
|
|||||||
"showmultispaces": str(self.showMultiSpaces),
|
"showmultispaces": str(self.showMultiSpaces),
|
||||||
"incnoteswcount": str(self.incNotesWCount),
|
"incnoteswcount": str(self.incNotesWCount),
|
||||||
"showfullpath": str(self.showFullPath),
|
"showfullpath": str(self.showFullPath),
|
||||||
"highlightquotes": str(self.highlightQuotes),
|
"dialogstyle": str(self.dialogStyle),
|
||||||
"allowopensquote": str(self.allowOpenSQuote),
|
"allowopendial": str(self.allowOpenDial),
|
||||||
"allowopendquote": str(self.allowOpenDQuote),
|
"narratorbreak": str(self.narratorBreak),
|
||||||
|
"altdialogopen": str(self.altDialogOpen),
|
||||||
|
"altdialogclose": str(self.altDialogClose),
|
||||||
|
"dialogline": str(self.dialogLine),
|
||||||
"highlightemph": str(self.highlightEmph),
|
"highlightemph": str(self.highlightEmph),
|
||||||
"stopwhenidle": str(self.stopWhenIdle),
|
"stopwhenidle": str(self.stopWhenIdle),
|
||||||
"useridletime": str(self.userIdleTime),
|
"useridletime": str(self.userIdleTime),
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ class GuiPreferences(QDialog):
|
|||||||
"""Build the settings form."""
|
"""Build the settings form."""
|
||||||
section = 0
|
section = 0
|
||||||
iSz = SHARED.theme.baseIconSize
|
iSz = SHARED.theme.baseIconSize
|
||||||
|
boxFixed = 5*SHARED.theme.textNWidth
|
||||||
minWidth = CONFIG.pxInt(200)
|
minWidth = CONFIG.pxInt(200)
|
||||||
|
|
||||||
# Label
|
# Label
|
||||||
@@ -538,26 +539,59 @@ class GuiPreferences(QDialog):
|
|||||||
self.sidebar.addButton(title, section)
|
self.sidebar.addButton(title, section)
|
||||||
self.mainForm.addGroupLabel(title, section)
|
self.mainForm.addGroupLabel(title, section)
|
||||||
|
|
||||||
self.highlightQuotes = NSwitch(self)
|
self.dialogStyle = NComboBox(self)
|
||||||
self.highlightQuotes.setChecked(CONFIG.highlightQuotes)
|
self.dialogStyle.addItem(self.tr("None"), 0)
|
||||||
self.highlightQuotes.toggled.connect(self._toggleHighlightQuotes)
|
self.dialogStyle.addItem(self.tr("Single Quotes"), 1)
|
||||||
|
self.dialogStyle.addItem(self.tr("Double Quotes"), 2)
|
||||||
|
self.dialogStyle.addItem(self.tr("Both"), 3)
|
||||||
|
self.dialogStyle.setCurrentData(CONFIG.dialogStyle, 2)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
self.tr("Highlight text wrapped in quotes"), self.highlightQuotes,
|
self.tr("Highlight dialogue"), self.dialogStyle,
|
||||||
self.tr("Applies to the document editor only.")
|
self.tr("Applies to the selected quote styles.")
|
||||||
)
|
)
|
||||||
|
|
||||||
self.allowOpenSQuote = NSwitch(self)
|
self.allowOpenDial = NSwitch(self)
|
||||||
self.allowOpenSQuote.setChecked(CONFIG.allowOpenSQuote)
|
self.allowOpenDial.setChecked(CONFIG.allowOpenDial)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
self.tr("Allow open-ended single quotes"), self.allowOpenSQuote,
|
self.tr("Allow open-ended sialogue"), self.allowOpenDial,
|
||||||
self.tr("Highlight single-quoted line with no closing quote.")
|
self.tr("Highlight dialogue line with no closing quote.")
|
||||||
)
|
)
|
||||||
|
|
||||||
self.allowOpenDQuote = NSwitch(self)
|
self.narratorBreak = QLineEdit(self)
|
||||||
self.allowOpenDQuote.setChecked(CONFIG.allowOpenDQuote)
|
self.narratorBreak.setMaxLength(1)
|
||||||
|
self.narratorBreak.setFixedWidth(boxFixed)
|
||||||
|
self.narratorBreak.setAlignment(QtAlignCenter)
|
||||||
|
self.narratorBreak.setText(CONFIG.narratorBreak)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
self.tr("Allow open-ended double quotes"), self.allowOpenDQuote,
|
self.tr("Dialogue narrator break symbol"), self.narratorBreak,
|
||||||
self.tr("Highlight double-quoted line with no closing quote.")
|
self.tr("Symbol to indicate injected narrator break.")
|
||||||
|
)
|
||||||
|
|
||||||
|
self.dialogLine = QLineEdit(self)
|
||||||
|
self.dialogLine.setMaxLength(1)
|
||||||
|
self.dialogLine.setFixedWidth(boxFixed)
|
||||||
|
self.dialogLine.setAlignment(QtAlignCenter)
|
||||||
|
self.dialogLine.setText(CONFIG.dialogLine)
|
||||||
|
self.mainForm.addRow(
|
||||||
|
self.tr("Dialogue line symbol"), self.dialogLine,
|
||||||
|
self.tr("Lines starting with this symbol are dialogue.")
|
||||||
|
)
|
||||||
|
|
||||||
|
self.altDialogOpen = QLineEdit(self)
|
||||||
|
self.altDialogOpen.setMaxLength(4)
|
||||||
|
self.altDialogOpen.setFixedWidth(boxFixed)
|
||||||
|
self.altDialogOpen.setAlignment(QtAlignCenter)
|
||||||
|
self.altDialogOpen.setText(CONFIG.altDialogOpen)
|
||||||
|
|
||||||
|
self.altDialogClose = QLineEdit(self)
|
||||||
|
self.altDialogClose.setMaxLength(4)
|
||||||
|
self.altDialogClose.setFixedWidth(boxFixed)
|
||||||
|
self.altDialogClose.setAlignment(QtAlignCenter)
|
||||||
|
self.altDialogClose.setText(CONFIG.altDialogClose)
|
||||||
|
|
||||||
|
self.mainForm.addRow(
|
||||||
|
self.tr("Alternative dialog symbols"), [self.altDialogOpen, self.altDialogClose],
|
||||||
|
self.tr("Custom highlighting of dialog text.")
|
||||||
)
|
)
|
||||||
|
|
||||||
self.highlightEmph = NSwitch(self)
|
self.highlightEmph = NSwitch(self)
|
||||||
@@ -667,13 +701,12 @@ class GuiPreferences(QDialog):
|
|||||||
self.mainForm.addGroupLabel(title, section)
|
self.mainForm.addGroupLabel(title, section)
|
||||||
|
|
||||||
self.quoteSym = {}
|
self.quoteSym = {}
|
||||||
qWidth = CONFIG.pxInt(40)
|
|
||||||
|
|
||||||
# Single Quote Style
|
# Single Quote Style
|
||||||
self.quoteSym["SO"] = QLineEdit(self)
|
self.quoteSym["SO"] = QLineEdit(self)
|
||||||
self.quoteSym["SO"].setMaxLength(1)
|
self.quoteSym["SO"].setMaxLength(1)
|
||||||
self.quoteSym["SO"].setReadOnly(True)
|
self.quoteSym["SO"].setReadOnly(True)
|
||||||
self.quoteSym["SO"].setFixedWidth(qWidth)
|
self.quoteSym["SO"].setFixedWidth(boxFixed)
|
||||||
self.quoteSym["SO"].setAlignment(QtAlignCenter)
|
self.quoteSym["SO"].setAlignment(QtAlignCenter)
|
||||||
self.quoteSym["SO"].setText(CONFIG.fmtSQuoteOpen)
|
self.quoteSym["SO"].setText(CONFIG.fmtSQuoteOpen)
|
||||||
self.btnSingleStyleO = NIconToolButton(self, iSz, "more")
|
self.btnSingleStyleO = NIconToolButton(self, iSz, "more")
|
||||||
@@ -687,7 +720,7 @@ class GuiPreferences(QDialog):
|
|||||||
self.quoteSym["SC"] = QLineEdit(self)
|
self.quoteSym["SC"] = QLineEdit(self)
|
||||||
self.quoteSym["SC"].setMaxLength(1)
|
self.quoteSym["SC"].setMaxLength(1)
|
||||||
self.quoteSym["SC"].setReadOnly(True)
|
self.quoteSym["SC"].setReadOnly(True)
|
||||||
self.quoteSym["SC"].setFixedWidth(qWidth)
|
self.quoteSym["SC"].setFixedWidth(boxFixed)
|
||||||
self.quoteSym["SC"].setAlignment(QtAlignCenter)
|
self.quoteSym["SC"].setAlignment(QtAlignCenter)
|
||||||
self.quoteSym["SC"].setText(CONFIG.fmtSQuoteClose)
|
self.quoteSym["SC"].setText(CONFIG.fmtSQuoteClose)
|
||||||
self.btnSingleStyleC = NIconToolButton(self, iSz, "more")
|
self.btnSingleStyleC = NIconToolButton(self, iSz, "more")
|
||||||
@@ -702,7 +735,7 @@ class GuiPreferences(QDialog):
|
|||||||
self.quoteSym["DO"] = QLineEdit(self)
|
self.quoteSym["DO"] = QLineEdit(self)
|
||||||
self.quoteSym["DO"].setMaxLength(1)
|
self.quoteSym["DO"].setMaxLength(1)
|
||||||
self.quoteSym["DO"].setReadOnly(True)
|
self.quoteSym["DO"].setReadOnly(True)
|
||||||
self.quoteSym["DO"].setFixedWidth(qWidth)
|
self.quoteSym["DO"].setFixedWidth(boxFixed)
|
||||||
self.quoteSym["DO"].setAlignment(QtAlignCenter)
|
self.quoteSym["DO"].setAlignment(QtAlignCenter)
|
||||||
self.quoteSym["DO"].setText(CONFIG.fmtDQuoteOpen)
|
self.quoteSym["DO"].setText(CONFIG.fmtDQuoteOpen)
|
||||||
self.btnDoubleStyleO = NIconToolButton(self, iSz, "more")
|
self.btnDoubleStyleO = NIconToolButton(self, iSz, "more")
|
||||||
@@ -716,7 +749,7 @@ class GuiPreferences(QDialog):
|
|||||||
self.quoteSym["DC"] = QLineEdit(self)
|
self.quoteSym["DC"] = QLineEdit(self)
|
||||||
self.quoteSym["DC"].setMaxLength(1)
|
self.quoteSym["DC"].setMaxLength(1)
|
||||||
self.quoteSym["DC"].setReadOnly(True)
|
self.quoteSym["DC"].setReadOnly(True)
|
||||||
self.quoteSym["DC"].setFixedWidth(qWidth)
|
self.quoteSym["DC"].setFixedWidth(boxFixed)
|
||||||
self.quoteSym["DC"].setAlignment(QtAlignCenter)
|
self.quoteSym["DC"].setAlignment(QtAlignCenter)
|
||||||
self.quoteSym["DC"].setText(CONFIG.fmtDQuoteClose)
|
self.quoteSym["DC"].setText(CONFIG.fmtDQuoteClose)
|
||||||
self.btnDoubleStyleC = NIconToolButton(self, iSz, "more")
|
self.btnDoubleStyleC = NIconToolButton(self, iSz, "more")
|
||||||
@@ -823,13 +856,6 @@ class GuiPreferences(QDialog):
|
|||||||
self.askBeforeBackup.setEnabled(state)
|
self.askBeforeBackup.setEnabled(state)
|
||||||
return
|
return
|
||||||
|
|
||||||
@pyqtSlot(bool)
|
|
||||||
def _toggleHighlightQuotes(self, state: bool) -> None:
|
|
||||||
"""Toggle switches controlled by the highlight quotes switch."""
|
|
||||||
self.allowOpenSQuote.setEnabled(state)
|
|
||||||
self.allowOpenDQuote.setEnabled(state)
|
|
||||||
return
|
|
||||||
|
|
||||||
@pyqtSlot(bool)
|
@pyqtSlot(bool)
|
||||||
def _toggleAutoReplaceMain(self, state: bool) -> None:
|
def _toggleAutoReplaceMain(self, state: bool) -> None:
|
||||||
"""Toggle switches controlled by the auto replace switch."""
|
"""Toggle switches controlled by the auto replace switch."""
|
||||||
@@ -927,19 +953,32 @@ class GuiPreferences(QDialog):
|
|||||||
CONFIG.scrollPastEnd = self.scrollPastEnd.isChecked()
|
CONFIG.scrollPastEnd = self.scrollPastEnd.isChecked()
|
||||||
|
|
||||||
# Text Highlighting
|
# Text Highlighting
|
||||||
highlightQuotes = self.highlightQuotes.isChecked()
|
dialogueStyle = self.dialogStyle.currentData()
|
||||||
|
allowOpenDial = self.allowOpenDial.isChecked()
|
||||||
|
narratorBreak = self.narratorBreak.text()
|
||||||
|
dialogueLine = self.dialogLine.text()
|
||||||
|
altDialogOpen = self.altDialogOpen.text()
|
||||||
|
altDialogClose = self.altDialogClose.text()
|
||||||
highlightEmph = self.highlightEmph.isChecked()
|
highlightEmph = self.highlightEmph.isChecked()
|
||||||
showMultiSpaces = self.showMultiSpaces.isChecked()
|
showMultiSpaces = self.showMultiSpaces.isChecked()
|
||||||
|
|
||||||
updateSyntax |= CONFIG.highlightQuotes != highlightQuotes
|
updateSyntax |= CONFIG.dialogStyle != dialogueStyle
|
||||||
|
updateSyntax |= CONFIG.allowOpenDial != allowOpenDial
|
||||||
|
updateSyntax |= CONFIG.narratorBreak != narratorBreak
|
||||||
|
updateSyntax |= CONFIG.dialogLine != dialogueLine
|
||||||
|
updateSyntax |= CONFIG.altDialogOpen != altDialogOpen
|
||||||
|
updateSyntax |= CONFIG.altDialogClose != altDialogClose
|
||||||
updateSyntax |= CONFIG.highlightEmph != highlightEmph
|
updateSyntax |= CONFIG.highlightEmph != highlightEmph
|
||||||
updateSyntax |= CONFIG.showMultiSpaces != showMultiSpaces
|
updateSyntax |= CONFIG.showMultiSpaces != showMultiSpaces
|
||||||
|
|
||||||
CONFIG.highlightQuotes = highlightQuotes
|
CONFIG.dialogStyle = dialogueStyle
|
||||||
|
CONFIG.allowOpenDial = allowOpenDial
|
||||||
|
CONFIG.narratorBreak = narratorBreak
|
||||||
|
CONFIG.dialogLine = dialogueLine
|
||||||
|
CONFIG.altDialogOpen = altDialogOpen
|
||||||
|
CONFIG.altDialogClose = altDialogClose
|
||||||
CONFIG.highlightEmph = highlightEmph
|
CONFIG.highlightEmph = highlightEmph
|
||||||
CONFIG.showMultiSpaces = showMultiSpaces
|
CONFIG.showMultiSpaces = showMultiSpaces
|
||||||
CONFIG.allowOpenSQuote = self.allowOpenSQuote.isChecked()
|
|
||||||
CONFIG.allowOpenDQuote = self.allowOpenDQuote.isChecked()
|
|
||||||
|
|
||||||
# Text Automation
|
# Text Automation
|
||||||
CONFIG.doReplace = self.doReplace.isChecked()
|
CONFIG.doReplace = self.doReplace.isChecked()
|
||||||
|
|||||||
@@ -180,16 +180,26 @@ class NScrollableForm(QScrollArea):
|
|||||||
self._sections[identifier] = qLabel
|
self._sections[identifier] = qLabel
|
||||||
return
|
return
|
||||||
|
|
||||||
def addRow(self, label: str, widget: QWidget, helpText: str = "", unit: str | None = None,
|
def addRow(self, label: str, widget: QWidget | list[QWidget], helpText: str = "",
|
||||||
button: QWidget | None = None, editable: str | None = None,
|
unit: str | None = None, button: QWidget | None = None, editable: str | None = None,
|
||||||
stretch: tuple[int, int] = (1, 0)) -> None:
|
stretch: tuple[int, int] = (1, 0)) -> None:
|
||||||
"""Add a label and a widget as a new row of the form."""
|
"""Add a label and a widget as a new row of the form."""
|
||||||
row = QHBoxLayout()
|
row = QHBoxLayout()
|
||||||
row.setSpacing(CONFIG.pxInt(12))
|
row.setSpacing(CONFIG.pxInt(12))
|
||||||
|
|
||||||
|
if isinstance(widget, list):
|
||||||
|
wBox = QHBoxLayout()
|
||||||
|
wBox.setContentsMargins(0, 0, 0, 0)
|
||||||
|
for item in widget:
|
||||||
|
wBox.addWidget(item)
|
||||||
|
qWidget = QWidget(self)
|
||||||
|
qWidget.setLayout(wBox)
|
||||||
|
else:
|
||||||
|
qWidget = widget
|
||||||
|
|
||||||
qLabel = QLabel(label, self)
|
qLabel = QLabel(label, self)
|
||||||
qLabel.setIndent(self._indent)
|
qLabel.setIndent(self._indent)
|
||||||
qLabel.setBuddy(widget)
|
qLabel.setBuddy(qWidget)
|
||||||
|
|
||||||
if helpText:
|
if helpText:
|
||||||
qHelp = NColourLabel(
|
qHelp = NColourLabel(
|
||||||
@@ -208,19 +218,19 @@ class NScrollableForm(QScrollArea):
|
|||||||
|
|
||||||
if isinstance(unit, str):
|
if isinstance(unit, str):
|
||||||
box = QHBoxLayout()
|
box = QHBoxLayout()
|
||||||
box.addWidget(widget, 1)
|
box.addWidget(qWidget, 1)
|
||||||
box.addWidget(QLabel(unit, self), 0)
|
box.addWidget(QLabel(unit, self), 0)
|
||||||
row.addLayout(box, stretch[1])
|
row.addLayout(box, stretch[1])
|
||||||
elif isinstance(button, QAbstractButton):
|
elif isinstance(button, QAbstractButton):
|
||||||
box = QHBoxLayout()
|
box = QHBoxLayout()
|
||||||
box.addWidget(widget, 1)
|
box.addWidget(qWidget, 1)
|
||||||
box.addWidget(button, 0)
|
box.addWidget(button, 0)
|
||||||
row.addLayout(box, stretch[1])
|
row.addLayout(box, stretch[1])
|
||||||
else:
|
else:
|
||||||
row.addWidget(widget, stretch[1])
|
row.addWidget(qWidget, stretch[1])
|
||||||
|
|
||||||
self._layout.addLayout(row)
|
self._layout.addLayout(row)
|
||||||
self._index[label.strip()] = widget
|
self._index[label.strip()] = qWidget
|
||||||
self._first = False
|
self._first = False
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class NComboBox(QComboBox):
|
|||||||
event.ignore()
|
event.ignore()
|
||||||
return
|
return
|
||||||
|
|
||||||
def setCurrentData(self, data: str | Enum, default: str | Enum) -> None:
|
def setCurrentData(self, data: str | int | Enum, default: str | int | Enum) -> None:
|
||||||
"""Set the current index from data, with a fallback."""
|
"""Set the current index from data, with a fallback."""
|
||||||
idx = self.findData(data)
|
idx = self.findData(data)
|
||||||
self.setCurrentIndex(self.findData(default) if idx < 0 else idx)
|
self.setCurrentIndex(self.findData(default) if idx < 0 else idx)
|
||||||
|
|||||||
@@ -94,39 +94,42 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
colBreak.setAlpha(64)
|
colBreak.setAlpha(64)
|
||||||
|
|
||||||
# Create Character Formats
|
# Create Character Formats
|
||||||
self._addCharFormat("header1", SHARED.theme.colHead, "b", 1.8)
|
self._addCharFormat("text", SHARED.theme.colText)
|
||||||
self._addCharFormat("header2", SHARED.theme.colHead, "b", 1.6)
|
self._addCharFormat("header1", SHARED.theme.colHead, "b", 1.8)
|
||||||
self._addCharFormat("header3", SHARED.theme.colHead, "b", 1.4)
|
self._addCharFormat("header2", SHARED.theme.colHead, "b", 1.6)
|
||||||
self._addCharFormat("header4", SHARED.theme.colHead, "b", 1.2)
|
self._addCharFormat("header3", SHARED.theme.colHead, "b", 1.4)
|
||||||
self._addCharFormat("head1h", SHARED.theme.colHeadH, "b", 1.8)
|
self._addCharFormat("header4", SHARED.theme.colHead, "b", 1.2)
|
||||||
self._addCharFormat("head2h", SHARED.theme.colHeadH, "b", 1.6)
|
self._addCharFormat("head1h", SHARED.theme.colHeadH, "b", 1.8)
|
||||||
self._addCharFormat("head3h", SHARED.theme.colHeadH, "b", 1.4)
|
self._addCharFormat("head2h", SHARED.theme.colHeadH, "b", 1.6)
|
||||||
self._addCharFormat("head4h", SHARED.theme.colHeadH, "b", 1.2)
|
self._addCharFormat("head3h", SHARED.theme.colHeadH, "b", 1.4)
|
||||||
self._addCharFormat("bold", colEmph, "b")
|
self._addCharFormat("head4h", SHARED.theme.colHeadH, "b", 1.2)
|
||||||
self._addCharFormat("italic", colEmph, "i")
|
self._addCharFormat("bold", colEmph, "b")
|
||||||
self._addCharFormat("strike", SHARED.theme.colHidden, "s")
|
self._addCharFormat("italic", colEmph, "i")
|
||||||
self._addCharFormat("mspaces", SHARED.theme.colError, "err")
|
self._addCharFormat("strike", SHARED.theme.colHidden, "s")
|
||||||
self._addCharFormat("nobreak", colBreak, "bg")
|
self._addCharFormat("mspaces", SHARED.theme.colError, "err")
|
||||||
self._addCharFormat("dialog1", SHARED.theme.colDialN)
|
self._addCharFormat("nobreak", colBreak, "bg")
|
||||||
self._addCharFormat("dialog2", SHARED.theme.colDialD)
|
self._addCharFormat("altdialog", SHARED.theme.colDialA)
|
||||||
self._addCharFormat("dialog3", SHARED.theme.colDialS)
|
self._addCharFormat("dialog", SHARED.theme.colDialN)
|
||||||
self._addCharFormat("replace", SHARED.theme.colRepTag)
|
self._addCharFormat("replace", SHARED.theme.colRepTag)
|
||||||
self._addCharFormat("hidden", SHARED.theme.colHidden)
|
self._addCharFormat("hidden", SHARED.theme.colHidden)
|
||||||
self._addCharFormat("markup", SHARED.theme.colHidden)
|
self._addCharFormat("markup", SHARED.theme.colHidden)
|
||||||
self._addCharFormat("note", SHARED.theme.colNote)
|
self._addCharFormat("note", SHARED.theme.colNote)
|
||||||
self._addCharFormat("code", SHARED.theme.colCode)
|
self._addCharFormat("code", SHARED.theme.colCode)
|
||||||
self._addCharFormat("keyword", SHARED.theme.colKey)
|
self._addCharFormat("keyword", SHARED.theme.colKey)
|
||||||
self._addCharFormat("tag", SHARED.theme.colTag)
|
self._addCharFormat("tag", SHARED.theme.colTag)
|
||||||
self._addCharFormat("modifier", SHARED.theme.colMod)
|
self._addCharFormat("modifier", SHARED.theme.colMod)
|
||||||
self._addCharFormat("value", SHARED.theme.colVal)
|
self._addCharFormat("value", SHARED.theme.colVal)
|
||||||
self._addCharFormat("optional", SHARED.theme.colOpt)
|
self._addCharFormat("optional", SHARED.theme.colOpt)
|
||||||
self._addCharFormat("invalid", None, "err")
|
self._addCharFormat("invalid", None, "err")
|
||||||
|
|
||||||
# Cache Spell Error Format
|
# Cache Spell Error Format
|
||||||
self._spellErr = QTextCharFormat()
|
self._spellErr = QTextCharFormat()
|
||||||
self._spellErr.setUnderlineColor(SHARED.theme.colSpell)
|
self._spellErr.setUnderlineColor(SHARED.theme.colSpell)
|
||||||
self._spellErr.setUnderlineStyle(QTextCharFormat.UnderlineStyle.SpellCheckUnderline)
|
self._spellErr.setUnderlineStyle(QTextCharFormat.UnderlineStyle.SpellCheckUnderline)
|
||||||
|
|
||||||
|
self._txtRules.clear()
|
||||||
|
self._cmnRules.clear()
|
||||||
|
|
||||||
# Multiple or Trailing Spaces
|
# Multiple or Trailing Spaces
|
||||||
if CONFIG.showMultiSpaces:
|
if CONFIG.showMultiSpaces:
|
||||||
rxRule = QRegularExpression(r"[ ]{2,}|[ ]*$")
|
rxRule = QRegularExpression(r"[ ]{2,}|[ ]*$")
|
||||||
@@ -146,36 +149,50 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
self._txtRules.append((rxRule, hlRule))
|
self._txtRules.append((rxRule, hlRule))
|
||||||
self._cmnRules.append((rxRule, hlRule))
|
self._cmnRules.append((rxRule, hlRule))
|
||||||
|
|
||||||
# Quoted Strings
|
# Dialogue
|
||||||
if CONFIG.highlightQuotes:
|
if CONFIG.dialogStyle > 0:
|
||||||
fmtDblO = CONFIG.fmtDQuoteOpen
|
symO = ""
|
||||||
fmtDblC = CONFIG.fmtDQuoteClose
|
symC = ""
|
||||||
fmtSngO = CONFIG.fmtSQuoteOpen
|
if CONFIG.dialogStyle in (1, 3):
|
||||||
fmtSngC = CONFIG.fmtSQuoteClose
|
symO += CONFIG.fmtSQuoteOpen
|
||||||
|
symC += CONFIG.fmtSQuoteClose
|
||||||
|
if CONFIG.dialogStyle in (2, 3):
|
||||||
|
symO += CONFIG.fmtDQuoteOpen
|
||||||
|
symC += CONFIG.fmtDQuoteClose
|
||||||
|
|
||||||
# Straight Quotes
|
rxEnd = "|$" if CONFIG.allowOpenDial else ""
|
||||||
rxRule = QRegularExpression(r'(\B")(.*?)("\B)')
|
rxRule = QRegularExpression(f"\\B[{symO}].*?[{symC}]\\B{rxEnd}")
|
||||||
rxRule.setPatternOptions(QRegExUnicode)
|
rxRule.setPatternOptions(QRegExUnicode)
|
||||||
hlRule = {
|
hlRule = {
|
||||||
0: self._hStyles["dialog1"],
|
0: self._hStyles["dialog"],
|
||||||
}
|
}
|
||||||
self._txtRules.append((rxRule, hlRule))
|
self._txtRules.append((rxRule, hlRule))
|
||||||
|
|
||||||
# Double Quotes
|
if CONFIG.dialogLine:
|
||||||
dblEnd = "|$" if CONFIG.allowOpenDQuote else ""
|
sym = QRegularExpression.escape(CONFIG.dialogLine)
|
||||||
rxRule = QRegularExpression(f"(\\B{fmtDblO})(.*?)({fmtDblC}\\B{dblEnd})")
|
rxRule = QRegularExpression(f"^{sym}.*?$")
|
||||||
rxRule.setPatternOptions(QRegExUnicode)
|
rxRule.setPatternOptions(QRegExUnicode)
|
||||||
hlRule = {
|
hlRule = {
|
||||||
0: self._hStyles["dialog2"],
|
0: self._hStyles["dialog"],
|
||||||
}
|
}
|
||||||
self._txtRules.append((rxRule, hlRule))
|
self._txtRules.append((rxRule, hlRule))
|
||||||
|
|
||||||
# Single Quotes
|
if CONFIG.narratorBreak:
|
||||||
sngEnd = "|$" if CONFIG.allowOpenSQuote else ""
|
sym = QRegularExpression.escape(CONFIG.narratorBreak)
|
||||||
rxRule = QRegularExpression(f"(\\B{fmtSngO})(.*?)({fmtSngC}\\B{sngEnd})")
|
rxRule = QRegularExpression(f"({sym}\\b)(.*?)(\\b{sym})")
|
||||||
rxRule.setPatternOptions(QRegExUnicode)
|
rxRule.setPatternOptions(QRegExUnicode)
|
||||||
hlRule = {
|
hlRule = {
|
||||||
0: self._hStyles["dialog3"],
|
0: self._hStyles["text"],
|
||||||
|
}
|
||||||
|
self._txtRules.append((rxRule, hlRule))
|
||||||
|
|
||||||
|
if CONFIG.altDialogOpen and CONFIG.altDialogClose:
|
||||||
|
symO = QRegularExpression.escape(CONFIG.altDialogOpen)
|
||||||
|
symC = QRegularExpression.escape(CONFIG.altDialogClose)
|
||||||
|
rxRule = QRegularExpression(f"\\B{symO}.*?{symC}\\B")
|
||||||
|
rxRule.setPatternOptions(QRegExUnicode)
|
||||||
|
hlRule = {
|
||||||
|
0: self._hStyles["altdialog"],
|
||||||
}
|
}
|
||||||
self._txtRules.append((rxRule, hlRule))
|
self._txtRules.append((rxRule, hlRule))
|
||||||
|
|
||||||
|
|||||||
@@ -96,8 +96,7 @@ class GuiTheme:
|
|||||||
self.colHeadH = QColor(0, 0, 0)
|
self.colHeadH = QColor(0, 0, 0)
|
||||||
self.colEmph = QColor(0, 0, 0)
|
self.colEmph = QColor(0, 0, 0)
|
||||||
self.colDialN = QColor(0, 0, 0)
|
self.colDialN = QColor(0, 0, 0)
|
||||||
self.colDialD = QColor(0, 0, 0)
|
self.colDialA = QColor(0, 0, 0)
|
||||||
self.colDialS = QColor(0, 0, 0)
|
|
||||||
self.colHidden = QColor(0, 0, 0)
|
self.colHidden = QColor(0, 0, 0)
|
||||||
self.colNote = QColor(0, 0, 0)
|
self.colNote = QColor(0, 0, 0)
|
||||||
self.colCode = QColor(0, 0, 0)
|
self.colCode = QColor(0, 0, 0)
|
||||||
@@ -338,9 +337,8 @@ class GuiTheme:
|
|||||||
self.colHead = self._parseColour(confParser, cnfSec, "headertext")
|
self.colHead = self._parseColour(confParser, cnfSec, "headertext")
|
||||||
self.colHeadH = self._parseColour(confParser, cnfSec, "headertag")
|
self.colHeadH = self._parseColour(confParser, cnfSec, "headertag")
|
||||||
self.colEmph = self._parseColour(confParser, cnfSec, "emphasis")
|
self.colEmph = self._parseColour(confParser, cnfSec, "emphasis")
|
||||||
self.colDialN = self._parseColour(confParser, cnfSec, "straightquotes")
|
self.colDialN = self._parseColour(confParser, cnfSec, "dialog")
|
||||||
self.colDialD = self._parseColour(confParser, cnfSec, "doublequotes")
|
self.colDialA = self._parseColour(confParser, cnfSec, "altdialog")
|
||||||
self.colDialS = self._parseColour(confParser, cnfSec, "singlequotes")
|
|
||||||
self.colHidden = self._parseColour(confParser, cnfSec, "hidden")
|
self.colHidden = self._parseColour(confParser, cnfSec, "hidden")
|
||||||
self.colNote = self._parseColour(confParser, cnfSec, "note")
|
self.colNote = self._parseColour(confParser, cnfSec, "note")
|
||||||
self.colCode = self._parseColour(confParser, cnfSec, "shortcode")
|
self.colCode = self._parseColour(confParser, cnfSec, "shortcode")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[Meta]
|
[Meta]
|
||||||
timestamp = 2024-04-13 18:57:38
|
timestamp = 2024-05-13 15:59:59
|
||||||
|
|
||||||
[Main]
|
[Main]
|
||||||
theme = default
|
theme = default
|
||||||
@@ -59,9 +59,12 @@ showlineendings = False
|
|||||||
showmultispaces = True
|
showmultispaces = True
|
||||||
incnoteswcount = True
|
incnoteswcount = True
|
||||||
showfullpath = True
|
showfullpath = True
|
||||||
highlightquotes = True
|
dialogstyle = 2
|
||||||
allowopensquote = False
|
allowopendial = True
|
||||||
allowopendquote = True
|
narratorbreak =
|
||||||
|
altdialogopen =
|
||||||
|
altdialogclose =
|
||||||
|
dialogline =
|
||||||
highlightemph = True
|
highlightemph = True
|
||||||
stopwhenidle = True
|
stopwhenidle = True
|
||||||
useridletime = 300
|
useridletime = 300
|
||||||
|
|||||||
@@ -266,18 +266,21 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, tstPaths):
|
|||||||
assert CONFIG.autoScrollPos == 30
|
assert CONFIG.autoScrollPos == 30
|
||||||
|
|
||||||
# Text Highlighting
|
# Text Highlighting
|
||||||
prefs.allowOpenSQuote.setChecked(True)
|
prefs.dialogStyle.setCurrentData(3, 0)
|
||||||
prefs.allowOpenDQuote.setChecked(False)
|
prefs.allowOpenDial.setChecked(False)
|
||||||
prefs.highlightQuotes.setChecked(False)
|
prefs.narratorBreak.setText("–")
|
||||||
|
prefs.dialogLine.setText("–")
|
||||||
|
prefs.altDialogOpen.setText("<")
|
||||||
|
prefs.altDialogClose.setText(">")
|
||||||
prefs.highlightEmph.setChecked(False)
|
prefs.highlightEmph.setChecked(False)
|
||||||
prefs.showMultiSpaces.setChecked(False)
|
prefs.showMultiSpaces.setChecked(False)
|
||||||
|
|
||||||
assert prefs.allowOpenSQuote.isEnabled() is False
|
assert CONFIG.dialogStyle == 2
|
||||||
assert prefs.allowOpenDQuote.isEnabled() is False
|
assert CONFIG.allowOpenDial is True
|
||||||
|
assert CONFIG.narratorBreak == ""
|
||||||
assert CONFIG.highlightQuotes is True
|
assert CONFIG.dialogLine == ""
|
||||||
assert CONFIG.allowOpenSQuote is False
|
assert CONFIG.altDialogOpen == ""
|
||||||
assert CONFIG.allowOpenDQuote is True
|
assert CONFIG.altDialogClose == ""
|
||||||
assert CONFIG.highlightEmph is True
|
assert CONFIG.highlightEmph is True
|
||||||
assert CONFIG.showMultiSpaces is True
|
assert CONFIG.showMultiSpaces is True
|
||||||
|
|
||||||
@@ -384,9 +387,12 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, tstPaths):
|
|||||||
assert CONFIG.autoScrollPos == 31
|
assert CONFIG.autoScrollPos == 31
|
||||||
|
|
||||||
# Text Highlighting
|
# Text Highlighting
|
||||||
assert CONFIG.highlightQuotes is False
|
assert CONFIG.dialogStyle == 3
|
||||||
assert CONFIG.allowOpenSQuote is True
|
assert CONFIG.allowOpenDial is False
|
||||||
assert CONFIG.allowOpenDQuote is False
|
assert CONFIG.narratorBreak == "–"
|
||||||
|
assert CONFIG.dialogLine == "–"
|
||||||
|
assert CONFIG.altDialogOpen == "<"
|
||||||
|
assert CONFIG.altDialogClose == ">"
|
||||||
assert CONFIG.highlightEmph is False
|
assert CONFIG.highlightEmph is False
|
||||||
assert CONFIG.showMultiSpaces is False
|
assert CONFIG.showMultiSpaces is False
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,15 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd):
|
|||||||
# Text Editor
|
# Text Editor
|
||||||
# ===========
|
# ===========
|
||||||
|
|
||||||
docEditor: GuiDocEditor = nwGUI.docEditor
|
# Syntax Highlighting
|
||||||
|
CONFIG.dialogStyle = 3
|
||||||
|
CONFIG.dialogLine = "–"
|
||||||
|
CONFIG.narratorBreak = "–"
|
||||||
|
CONFIG.altDialogOpen = "<|"
|
||||||
|
CONFIG.altDialogClose = "|>"
|
||||||
|
|
||||||
|
docEditor = nwGUI.docEditor
|
||||||
|
docEditor._qDocument.syntaxHighlighter.initHighlighter()
|
||||||
|
|
||||||
# Type something into the document
|
# Type something into the document
|
||||||
nwGUI.switchFocus(nwWidget.EDITOR)
|
nwGUI.switchFocus(nwWidget.EDITOR)
|
||||||
|
|||||||
Reference in New Issue
Block a user