Merge branch 'main' into unicode_fix
This commit is contained in:
@@ -699,11 +699,12 @@ class NWConfigParser(ConfigParser):
|
||||
"""Common: Adapted Config Parser
|
||||
|
||||
This is a subclass of the standard config parser that adds type safe
|
||||
helper functions, and support for lists.
|
||||
helper functions, and support for lists. It also turns off
|
||||
interpolation, which would require % symbols to be escaped (#2455).
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
super().__init__(interpolation=None)
|
||||
return
|
||||
|
||||
def rdStr(self, section: str, option: str, default: str) -> str:
|
||||
|
||||
@@ -441,9 +441,9 @@ class ProjectXMLReader:
|
||||
for xEntry in xItem:
|
||||
if xEntry.tag == "entry":
|
||||
key = xEntry.attrib.get("key", None)
|
||||
red = checkInt(xEntry.attrib.get("red", 0), 0) # Deprecated in 1.5 R6
|
||||
green = checkInt(xEntry.attrib.get("green", 0), 0) # Deprecated in 1.5 R6
|
||||
blue = checkInt(xEntry.attrib.get("blue", 0), 0) # Deprecated in 1.5 R6
|
||||
red = checkInt(xEntry.attrib.get("red", 0), 0) # Removed in 1.5 R6
|
||||
green = checkInt(xEntry.attrib.get("green", 0), 0) # Removed in 1.5 R6
|
||||
blue = checkInt(xEntry.attrib.get("blue", 0), 0) # Removed in 1.5 R6
|
||||
color = xEntry.attrib.get("color") # Added in 1.5 R6
|
||||
count = checkInt(xEntry.attrib.get("count", 0), 0)
|
||||
shape = xEntry.attrib.get("shape", "")
|
||||
|
||||
@@ -192,7 +192,8 @@ class NWStatus:
|
||||
def refreshIcons(self) -> None:
|
||||
"""Refresh all icons."""
|
||||
for entry in self._store.values():
|
||||
entry.color = SHARED.theme.parseColor(entry.theme)
|
||||
if entry.theme != CUSTOM_COL:
|
||||
entry.color = SHARED.theme.parseColor(entry.theme)
|
||||
entry.icon = NWStatus.createIcon(self._height, entry.color, entry.shape)
|
||||
return
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import logging
|
||||
from PyQt6.QtCore import Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt6.QtGui import QAction, QCloseEvent, QKeyEvent, QKeySequence
|
||||
from PyQt6.QtWidgets import (
|
||||
QCompleter, QDialogButtonBox, QFileDialog, QHBoxLayout, QLineEdit,
|
||||
QCompleter, QDialogButtonBox, QFileDialog, QHBoxLayout, QLineEdit, QMenu,
|
||||
QPushButton, QVBoxLayout, QWidget
|
||||
)
|
||||
|
||||
@@ -608,6 +608,7 @@ class GuiPreferences(NDialog):
|
||||
self.sidebar.addButton(title, section)
|
||||
self.mainForm.addGroupLabel(title, section)
|
||||
|
||||
# Dialogue Quotes
|
||||
self.dialogStyle = NComboBox(self)
|
||||
self.dialogStyle.addItem(self.tr("None"), 0)
|
||||
self.dialogStyle.addItem(self.tr("Single Quotes"), 1)
|
||||
@@ -619,6 +620,15 @@ class GuiPreferences(NDialog):
|
||||
self.tr("Applies to the selected quote styles.")
|
||||
)
|
||||
|
||||
# Open-Ended Dialogue
|
||||
self.allowOpenDial = NSwitch(self)
|
||||
self.allowOpenDial.setChecked(CONFIG.allowOpenDial)
|
||||
self.mainForm.addRow(
|
||||
self.tr("Allow open-ended dialogue"), self.allowOpenDial,
|
||||
self.tr("Highlight dialogue line with no closing quote.")
|
||||
)
|
||||
|
||||
# Alternative Dialogue
|
||||
self.altDialogOpen = QLineEdit(self)
|
||||
self.altDialogOpen.setMaxLength(4)
|
||||
self.altDialogOpen.setFixedWidth(boxFixed)
|
||||
@@ -636,23 +646,30 @@ class GuiPreferences(NDialog):
|
||||
self.tr("Custom highlighting of dialogue text.")
|
||||
)
|
||||
|
||||
self.allowOpenDial = NSwitch(self)
|
||||
self.allowOpenDial.setChecked(CONFIG.allowOpenDial)
|
||||
self.mainForm.addRow(
|
||||
self.tr("Allow open-ended dialogue"), self.allowOpenDial,
|
||||
self.tr("Highlight dialogue line with no closing quote.")
|
||||
)
|
||||
# Dialogue Line
|
||||
self.mnLineSymbols = QMenu(self)
|
||||
for symbol in nwQuotes.ALLOWED:
|
||||
label = trConst(nwQuotes.SYMBOLS.get(symbol, nwQuotes.DASHES.get(symbol, "None")))
|
||||
self.mnLineSymbols.addAction(
|
||||
f"[ {symbol } ] {label}",
|
||||
lambda symbol=symbol: self._insertDialogLineSymbol(symbol)
|
||||
)
|
||||
|
||||
self.dialogLine = QLineEdit(self)
|
||||
self.dialogLine.setMaxLength(4)
|
||||
self.dialogLine.setFixedWidth(boxFixed)
|
||||
self.dialogLine.setMinimumWidth(100)
|
||||
self.dialogLine.setAlignment(QtAlignCenter)
|
||||
self.dialogLine.setText(CONFIG.dialogLine)
|
||||
self.dialogLine.setText(" ".join(CONFIG.dialogLine))
|
||||
|
||||
self.dialogLineButton = NIconToolButton(self, iSz, "add", "green")
|
||||
self.dialogLineButton.setMenu(self.mnLineSymbols)
|
||||
|
||||
self.mainForm.addRow(
|
||||
self.tr("Dialogue line symbols"), self.dialogLine,
|
||||
self.tr("Lines starting with any of these symbols are dialogue.")
|
||||
self.tr("Lines starting with any of these symbols are dialogue."),
|
||||
button=self.dialogLineButton
|
||||
)
|
||||
|
||||
# Narrator Break
|
||||
self.narratorBreak = NComboBox(self)
|
||||
self.narratorDialog = NComboBox(self)
|
||||
for key, value in nwQuotes.DASHES.items():
|
||||
@@ -672,6 +689,7 @@ class GuiPreferences(NDialog):
|
||||
self.tr("Alternates dialogue highlighting within any paragraph.")
|
||||
)
|
||||
|
||||
# Emphasis
|
||||
self.highlightEmph = NSwitch(self)
|
||||
self.highlightEmph.setChecked(CONFIG.highlightEmph)
|
||||
self.mainForm.addRow(
|
||||
@@ -679,6 +697,7 @@ class GuiPreferences(NDialog):
|
||||
self.tr("Applies to the document editor only.")
|
||||
)
|
||||
|
||||
# Additional Spaces
|
||||
self.showMultiSpaces = NSwitch(self)
|
||||
self.showMultiSpaces.setChecked(CONFIG.showMultiSpaces)
|
||||
self.mainForm.addRow(
|
||||
@@ -914,6 +933,14 @@ class GuiPreferences(NDialog):
|
||||
self.askBeforeBackup.setEnabled(state)
|
||||
return
|
||||
|
||||
@pyqtSlot(str)
|
||||
def _insertDialogLineSymbol(self, symbol: str) -> None:
|
||||
"""Insert a symbol in the dialogue line box."""
|
||||
current = self.dialogLine.text()
|
||||
values = processDialogSymbols(f"{current} {symbol}")
|
||||
self.dialogLine.setText(" ".join(values))
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _toggleAutoReplaceMain(self, state: bool) -> None:
|
||||
"""Toggle switches controlled by the auto replace switch."""
|
||||
|
||||
Reference in New Issue
Block a user