diff --git a/novelwriter/config.py b/novelwriter/config.py index 53fe20fe..b6708add 100644 --- a/novelwriter/config.py +++ b/novelwriter/config.py @@ -161,8 +161,10 @@ class Config: # User-Selected Symbol Settings self.fmtApostrophe = nwUnicode.U_RSQUO - self.fmtSingleQuotes = [nwUnicode.U_LSQUO, nwUnicode.U_RSQUO] - self.fmtDoubleQuotes = [nwUnicode.U_LDQUO, nwUnicode.U_RDQUO] + self.fmtSQuoteOpen = nwUnicode.U_LSQUO + self.fmtSQuoteClose = nwUnicode.U_RSQUO + self.fmtDQuoteOpen = nwUnicode.U_LDQUO + self.fmtDQuoteClose = nwUnicode.U_RDQUO self.fmtPadBefore = "" self.fmtPadAfter = "" self.fmtPadThin = False @@ -233,9 +235,6 @@ class Config: # Packages self.hasEnchant = False # The pyenchant package - # Recent Cache - self.recentProj = {} - return ## @@ -570,8 +569,10 @@ class Config: self.scrollPastEnd = theConf.rdInt(cnfSec, "scrollpastend", self.scrollPastEnd) self.autoScroll = theConf.rdBool(cnfSec, "autoscroll", self.autoScroll) self.autoScrollPos = theConf.rdInt(cnfSec, "autoscrollpos", self.autoScrollPos) - self.fmtSingleQuotes = theConf.rdStrList(cnfSec, "fmtsinglequote", self.fmtSingleQuotes) - self.fmtDoubleQuotes = theConf.rdStrList(cnfSec, "fmtdoublequote", self.fmtDoubleQuotes) + self.fmtSQuoteOpen = theConf.rdStr(cnfSec, "fmtsquoteopen", self.fmtSQuoteOpen) + self.fmtSQuoteClose = theConf.rdStr(cnfSec, "fmtsquoteclose", self.fmtSQuoteClose) + self.fmtDQuoteOpen = theConf.rdStr(cnfSec, "fmtdquoteopen", self.fmtDQuoteOpen) + self.fmtDQuoteClose = theConf.rdStr(cnfSec, "fmtdquoteclose", self.fmtDQuoteClose) self.fmtPadBefore = theConf.rdStr(cnfSec, "fmtpadbefore", self.fmtPadBefore) self.fmtPadAfter = theConf.rdStr(cnfSec, "fmtpadafter", self.fmtPadAfter) self.fmtPadThin = theConf.rdBool(cnfSec, "fmtpadthin", self.fmtPadThin) @@ -604,23 +605,35 @@ class Config: self.searchMatchCap = theConf.rdBool(cnfSec, "searchmatchcap", self.searchMatchCap) # Deprecated Settings or Locations as of 2.0 - # These will be loaded for a few minor releases until the users have converted them + # ToDo: These will be loaded for a few minor releases until the users have converted them self.guiFont = theConf.rdStr("Main", "guifont", self.guiFont) self.guiFontSize = theConf.rdInt("Main", "guifontsize", self.guiFontSize) - self.guiLocale = theConf.rdStr("Main", "guilang", self.guiLocale) + self.guiLocale = theConf.rdStr("Main", "guilang", self.guiLocale) self._backupPath = theConf.rdPath("Backup", "backuppath", self._backupPath) self.backupOnClose = theConf.rdBool("Backup", "backuponclose", self.backupOnClose) self.askBeforeBackup = theConf.rdBool("Backup", "askbeforebackup", self.askBeforeBackup) + fmtSingleQuotes = theConf.rdStrList(cnfSec, "fmtsinglequote", []) + fmtDoubleQuotes = theConf.rdStrList(cnfSec, "fmtdoublequote", []) + + if isinstance(fmtSingleQuotes, list) and len(fmtSingleQuotes) == 2: + self.fmtSQuoteOpen = fmtSingleQuotes[0] + self.fmtSQuoteClose = fmtSingleQuotes[1] + if isinstance(fmtDoubleQuotes, list) and len(fmtDoubleQuotes) == 2: + self.fmtDQuoteOpen = fmtDoubleQuotes[0] + self.fmtDQuoteClose = fmtDoubleQuotes[1] + + # Check Values + # ============ # Check Certain Values for None self.spellLanguage = self._checkNone(self.spellLanguage) # If we're using straight quotes, disable auto-replace - if self.fmtSingleQuotes == ["'", "'"] and self.doReplaceSQuote: + if self.fmtSQuoteOpen == self.fmtSQuoteClose == "'" and self.doReplaceSQuote: logger.info("Using straight single quotes, so disabling auto-replace") self.doReplaceSQuote = False - if self.fmtDoubleQuotes == ['"', '"'] and self.doReplaceDQuote: + if self.fmtDQuoteOpen == self.fmtDQuoteClose == '"' and self.doReplaceDQuote: logger.info("Using straight double quotes, so disabling auto-replace") self.doReplaceDQuote = False @@ -685,8 +698,10 @@ class Config: "scrollpastend": str(self.scrollPastEnd), "autoscroll": str(self.autoScroll), "autoscrollpos": str(self.autoScrollPos), - "fmtsinglequote": self._packList(self.fmtSingleQuotes), - "fmtdoublequote": self._packList(self.fmtDoubleQuotes), + "fmtsquoteopen": str(self.fmtSQuoteOpen), + "fmtsquoteclose": str(self.fmtSQuoteClose), + "fmtdquoteopen": str(self.fmtDQuoteOpen), + "fmtdquoteclose": str(self.fmtDQuoteClose), "fmtpadbefore": str(self.fmtPadBefore), "fmtpadafter": str(self.fmtPadAfter), "fmtpadthin": str(self.fmtPadThin), diff --git a/novelwriter/core/item.py b/novelwriter/core/item.py index 9f472dab..155e31b0 100644 --- a/novelwriter/core/item.py +++ b/novelwriter/core/item.py @@ -36,10 +36,16 @@ logger = logging.getLogger(__name__) class NWItem: - def __init__(self, theProject): + __slots__ = ( + "_project", "_name", "_handle", "_parent", "_root", "_order", + "_type", "_class", "_layout", "_status", "_import", "_active", + "_expanded", "_heading", "_charCount", "_wordCount", + "_paraCount", "_cursorPos", "_initCount", + ) - self.theProject = theProject + def __init__(self, project): + self._project = project self._name = "" self._handle = None self._parent = None @@ -267,11 +273,11 @@ class NWItem: the current item based on its class. """ if self.isNovelLike(): - stName = self.theProject.data.itemStatus.name(self._status) - stIcon = self.theProject.data.itemStatus.icon(self._status) if incIcon else None + stName = self._project.data.itemStatus.name(self._status) + stIcon = self._project.data.itemStatus.icon(self._status) if incIcon else None else: - stName = self.theProject.data.itemImport.name(self._import) - stIcon = self.theProject.data.itemImport.icon(self._import) if incIcon else None + stName = self._project.data.itemImport.name(self._import) + stIcon = self._project.data.itemImport.icon(self._import) if incIcon else None return stName, stIcon ## @@ -443,32 +449,32 @@ class NWItem: """Set the item status by looking it up in the valid status items of the current project. """ - self._status = self.theProject.data.itemStatus.check(value) + self._status = self._project.data.itemStatus.check(value) return def setImport(self, value): """Set the item importance by looking it up in the valid import items of the current project. """ - self._import = self.theProject.data.itemImport.check(value) + self._import = self._project.data.itemImport.check(value) return def setActive(self, state): - """Set the export flag. + """Set the active flag. """ - if isinstance(state, str): - self._active = (state == str(True)) + if isinstance(state, bool): + self._active = state else: - self._active = (state is True) + self._active = False return def setExpanded(self, state): """Set the expanded status of an item in the project tree. """ - if isinstance(state, str): - self._expanded = (state == str(True)) + if isinstance(state, bool): + self._expanded = state else: - self._expanded = (state is True) + self._expanded = False return ## diff --git a/novelwriter/dialogs/preferences.py b/novelwriter/dialogs/preferences.py index 568ee265..7804c0a6 100644 --- a/novelwriter/dialogs/preferences.py +++ b/novelwriter/dialogs/preferences.py @@ -1104,7 +1104,7 @@ class GuiPreferencesQuotes(QWidget): self.quoteSym["SO"].setReadOnly(True) self.quoteSym["SO"].setFixedWidth(qWidth) self.quoteSym["SO"].setAlignment(Qt.AlignCenter) - self.quoteSym["SO"].setText(self.mainConf.fmtSingleQuotes[0]) + self.quoteSym["SO"].setText(self.mainConf.fmtSQuoteOpen) self.btnSingleStyleO = QPushButton("...") self.btnSingleStyleO.setMaximumWidth(bWidth) self.btnSingleStyleO.clicked.connect(lambda: self._getQuote("SO")) @@ -1120,7 +1120,7 @@ class GuiPreferencesQuotes(QWidget): self.quoteSym["SC"].setReadOnly(True) self.quoteSym["SC"].setFixedWidth(qWidth) self.quoteSym["SC"].setAlignment(Qt.AlignCenter) - self.quoteSym["SC"].setText(self.mainConf.fmtSingleQuotes[1]) + self.quoteSym["SC"].setText(self.mainConf.fmtSQuoteClose) self.btnSingleStyleC = QPushButton("...") self.btnSingleStyleC.setMaximumWidth(bWidth) self.btnSingleStyleC.clicked.connect(lambda: self._getQuote("SC")) @@ -1137,7 +1137,7 @@ class GuiPreferencesQuotes(QWidget): self.quoteSym["DO"].setReadOnly(True) self.quoteSym["DO"].setFixedWidth(qWidth) self.quoteSym["DO"].setAlignment(Qt.AlignCenter) - self.quoteSym["DO"].setText(self.mainConf.fmtDoubleQuotes[0]) + self.quoteSym["DO"].setText(self.mainConf.fmtDQuoteOpen) self.btnDoubleStyleO = QPushButton("...") self.btnDoubleStyleO.setMaximumWidth(bWidth) self.btnDoubleStyleO.clicked.connect(lambda: self._getQuote("DO")) @@ -1153,7 +1153,7 @@ class GuiPreferencesQuotes(QWidget): self.quoteSym["DC"].setReadOnly(True) self.quoteSym["DC"].setFixedWidth(qWidth) self.quoteSym["DC"].setAlignment(Qt.AlignCenter) - self.quoteSym["DC"].setText(self.mainConf.fmtDoubleQuotes[1]) + self.quoteSym["DC"].setText(self.mainConf.fmtDQuoteClose) self.btnDoubleStyleC = QPushButton("...") self.btnDoubleStyleC.setMaximumWidth(bWidth) self.btnDoubleStyleC.clicked.connect(lambda: self._getQuote("DC")) @@ -1170,10 +1170,10 @@ class GuiPreferencesQuotes(QWidget): """Save the values set for this tab. """ # Quotation Style - self.mainConf.fmtSingleQuotes[0] = self.quoteSym["SO"].text() - self.mainConf.fmtSingleQuotes[1] = self.quoteSym["SC"].text() - self.mainConf.fmtDoubleQuotes[0] = self.quoteSym["DO"].text() - self.mainConf.fmtDoubleQuotes[1] = self.quoteSym["DC"].text() + self.mainConf.fmtSQuoteOpen = self.quoteSym["SO"].text() + self.mainConf.fmtSQuoteClose = self.quoteSym["SC"].text() + self.mainConf.fmtDQuoteOpen = self.quoteSym["DO"].text() + self.mainConf.fmtDQuoteClose = self.quoteSym["DC"].text() return ## diff --git a/novelwriter/gui/doceditor.py b/novelwriter/gui/doceditor.py index 39c5edb3..1e2704f2 100644 --- a/novelwriter/gui/doceditor.py +++ b/novelwriter/gui/doceditor.py @@ -105,12 +105,18 @@ class GuiDocEditor(QTextEdit): self._doReplace = False # Switch to temporarily disable auto-replace self._queuePos = None # Used for delayed change of cursor position - # Typography - self._typDQOpen = '"' - self._typDQClose = '"' - self._typSQOpen = "'" - self._typSQClose = "'" + # Typography Cache self._typPadChar = " " + self._typDQuoteO = '"' + self._typDQuoteC = '"' + self._typSQuoteO = "'" + self._typSQuoteC = "'" + self._typRepDQuote = False + self._typRepSQuote = False + self._typRepDash = False + self._typRepDots = False + self._typPadBefore = "" + self._typPadAfter = "" # Core Elements and Signals qDoc = self.document() @@ -242,9 +248,11 @@ class GuiDocEditor(QTextEdit): created, and when the user changes the main editor preferences. """ # Some Constants - self._nonWord = "\"'" - self._nonWord += "".join(self.mainConf.fmtDoubleQuotes) - self._nonWord += "".join(self.mainConf.fmtSingleQuotes) + self._nonWord = ( + "\"'" + f"{self.mainConf.fmtSQuoteOpen}{self.mainConf.fmtSQuoteClose}" + f"{self.mainConf.fmtDQuoteOpen}{self.mainConf.fmtDQuoteClose}" + ) # Typography if self.mainConf.fmtPadThin: @@ -252,10 +260,16 @@ class GuiDocEditor(QTextEdit): else: self._typPadChar = nwUnicode.U_NBSP - self._typDQOpen = self.mainConf.fmtDoubleQuotes[0] - self._typDQClose = self.mainConf.fmtDoubleQuotes[1] - self._typSQOpen = self.mainConf.fmtSingleQuotes[0] - self._typSQClose = self.mainConf.fmtSingleQuotes[1] + self._typSQuoteO = self.mainConf.fmtSQuoteOpen + self._typSQuoteC = self.mainConf.fmtSQuoteClose + self._typDQuoteO = self.mainConf.fmtDQuoteOpen + self._typDQuoteC = self.mainConf.fmtDQuoteClose + self._typRepDQuote = self.mainConf.doReplaceDQuote + self._typRepSQuote = self.mainConf.doReplaceSQuote + self._typRepDash = self.mainConf.doReplaceDash + self._typRepDots = self.mainConf.doReplaceDots + self._typPadBefore = self.mainConf.fmtPadBefore + self._typPadAfter = self.mainConf.fmtPadAfter # Reload spell check and dictionaries self.setDictionaries() @@ -792,9 +806,9 @@ class GuiDocEditor(QTextEdit): elif theAction == nwDocAction.STRIKE: self._toggleFormat(2, "~") elif theAction == nwDocAction.S_QUOTE: - self._wrapSelection(self._typSQOpen, self._typSQClose) + self._wrapSelection(self._typSQuoteO, self._typSQuoteC) elif theAction == nwDocAction.D_QUOTE: - self._wrapSelection(self._typDQOpen, self._typDQClose) + self._wrapSelection(self._typDQuoteO, self._typDQuoteC) elif theAction == nwDocAction.SEL_ALL: self._makeSelection(QTextCursor.Document) elif theAction == nwDocAction.SEL_PARA: @@ -816,9 +830,9 @@ class GuiDocEditor(QTextEdit): elif theAction == nwDocAction.BLOCK_UNN: self._formatBlock(nwDocAction.BLOCK_UNN) elif theAction == nwDocAction.REPL_SNG: - self._replaceQuotes("'", self._typSQOpen, self._typSQClose) + self._replaceQuotes("'", self._typSQuoteO, self._typSQuoteC) elif theAction == nwDocAction.REPL_DBL: - self._replaceQuotes("\"", self._typDQOpen, self._typDQClose) + self._replaceQuotes("\"", self._typDQuoteO, self._typDQuoteC) elif theAction == nwDocAction.RM_BREAKS: self._removeInParLineBreaks() elif theAction == nwDocAction.ALIGN_L: @@ -884,13 +898,13 @@ class GuiDocEditor(QTextEdit): theText = theInsert elif isinstance(theInsert, nwDocInsert): if theInsert == nwDocInsert.QUOTE_LS: - theText = self._typSQOpen + theText = self._typSQuoteO elif theInsert == nwDocInsert.QUOTE_RS: - theText = self._typSQClose + theText = self._typSQuoteC elif theInsert == nwDocInsert.QUOTE_LD: - theText = self._typDQOpen + theText = self._typDQuoteO elif theInsert == nwDocInsert.QUOTE_RD: - theText = self._typDQClose + theText = self._typDQuoteC elif theInsert == nwDocInsert.SYNOPSIS: theText = "% Synopsis: " newBlock = True @@ -1965,49 +1979,49 @@ class GuiDocEditor(QTextEdit): nDelete = 0 tInsert = theOne - if self.mainConf.doReplaceDQuote and theTwo[:1].isspace() and theTwo.endswith('"'): + if self._typRepDQuote and theTwo[:1].isspace() and theTwo.endswith('"'): nDelete = 1 - tInsert = self._typDQOpen + tInsert = self._typDQuoteO - elif self.mainConf.doReplaceDQuote and theOne == '"': + elif self._typRepDQuote and theOne == '"': nDelete = 1 if thePos == 1: - tInsert = self._typDQOpen + tInsert = self._typDQuoteO elif thePos == 2 and theTwo == '>"': - tInsert = self._typDQOpen + tInsert = self._typDQuoteO elif thePos == 3 and theThree == '>>"': - tInsert = self._typDQOpen + tInsert = self._typDQuoteO else: - tInsert = self._typDQClose + tInsert = self._typDQuoteC - elif self.mainConf.doReplaceSQuote and theTwo[:1].isspace() and theTwo.endswith("'"): + elif self._typRepSQuote and theTwo[:1].isspace() and theTwo.endswith("'"): nDelete = 1 - tInsert = self._typSQOpen + tInsert = self._typSQuoteO - elif self.mainConf.doReplaceSQuote and theOne == "'": + elif self._typRepSQuote and theOne == "'": nDelete = 1 if thePos == 1: - tInsert = self._typSQOpen + tInsert = self._typSQuoteO elif thePos == 2 and theTwo == ">'": - tInsert = self._typSQOpen + tInsert = self._typSQuoteO elif thePos == 3 and theThree == ">>'": - tInsert = self._typSQOpen + tInsert = self._typSQuoteO else: - tInsert = self._typSQClose + tInsert = self._typSQuoteC - elif self.mainConf.doReplaceDash and theThree == "---": + elif self._typRepDash and theThree == "---": nDelete = 3 tInsert = nwUnicode.U_EMDASH - elif self.mainConf.doReplaceDash and theTwo == "--": + elif self._typRepDash and theTwo == "--": nDelete = 2 tInsert = nwUnicode.U_ENDASH - elif self.mainConf.doReplaceDash and theTwo == nwUnicode.U_ENDASH + "-": + elif self._typRepDash and theTwo == nwUnicode.U_ENDASH + "-": nDelete = 2 tInsert = nwUnicode.U_EMDASH - elif self.mainConf.doReplaceDots and theThree == "...": + elif self._typRepDots and theThree == "...": nDelete = 3 tInsert = nwUnicode.U_HELLIP @@ -2017,7 +2031,7 @@ class GuiDocEditor(QTextEdit): tInsert = nwUnicode.U_PSEP tCheck = tInsert - if self.mainConf.fmtPadBefore and tCheck in self.mainConf.fmtPadBefore: + if self._typPadBefore and tCheck in self._typPadBefore: if self._allowSpaceBeforeColon(theText, tCheck): nDelete = max(nDelete, 1) chkPos = thePos - nDelete - 1 @@ -2026,7 +2040,7 @@ class GuiDocEditor(QTextEdit): nDelete += 1 tInsert = self._typPadChar + tInsert - if self.mainConf.fmtPadAfter and tCheck in self.mainConf.fmtPadAfter: + if self._typPadAfter and tCheck in self._typPadAfter: if self._allowSpaceBeforeColon(theText, tCheck): nDelete = max(nDelete, 1) tInsert = tInsert + self._typPadChar diff --git a/novelwriter/gui/dochighlight.py b/novelwriter/gui/dochighlight.py index 91aa0416..baea34bb 100644 --- a/novelwriter/gui/dochighlight.py +++ b/novelwriter/gui/dochighlight.py @@ -151,11 +151,13 @@ class GuiDocHighlighter(QSyntaxHighlighter): # Quoted Strings if self.mainConf.highlightQuotes: - fmtDbl = self.mainConf.fmtDoubleQuotes - fmtSng = self.mainConf.fmtSingleQuotes + fmtDblO = self.mainConf.fmtDQuoteOpen + fmtDblC = self.mainConf.fmtDQuoteClose + fmtSngO = self.mainConf.fmtSQuoteOpen + fmtSngC = self.mainConf.fmtSQuoteClose # Straight Quotes - if fmtDbl != ["\"", "\""]: + if not (fmtDblO == fmtDblC == "\""): self.hRules.append(( "(\\B\")(.*?)(\"\\B)", { 0: self.hStyles["dialogue1"], @@ -165,7 +167,7 @@ class GuiDocHighlighter(QSyntaxHighlighter): # Double Quotes dblEnd = "|$" if self.mainConf.allowOpenDQuote else "" self.hRules.append(( - f"(\\B{fmtDbl[0]})(.*?)({fmtDbl[1]}\\B{dblEnd})", { + f"(\\B{fmtDblO})(.*?)({fmtDblC}\\B{dblEnd})", { 0: self.hStyles["dialogue2"], } )) @@ -173,7 +175,7 @@ class GuiDocHighlighter(QSyntaxHighlighter): # Single Quotes sngEnd = "|$" if self.mainConf.allowOpenSQuote else "" self.hRules.append(( - f"(\\B{fmtSng[0]})(.*?)({fmtSng[1]}\\B{sngEnd})", { + f"(\\B{fmtSngO})(.*?)({fmtSngC}\\B{sngEnd})", { 0: self.hStyles["dialogue3"], } )) diff --git a/tests/reference/baseConfig_novelwriter.conf b/tests/reference/baseConfig_novelwriter.conf index ed621ba2..185fbd50 100644 --- a/tests/reference/baseConfig_novelwriter.conf +++ b/tests/reference/baseConfig_novelwriter.conf @@ -1,5 +1,5 @@ [Meta] -timestamp = 2022-11-10 11:10:10 +timestamp = 2022-11-11 12:48:18 [Main] theme = default @@ -46,8 +46,10 @@ repdots = True scrollpastend = 25 autoscroll = False autoscrollpos = 30 -fmtsinglequote = ‘, ’ -fmtdoublequote = “, ” +fmtsquoteopen = ‘ +fmtsquoteclose = ’ +fmtdquoteopen = “ +fmtdquoteclose = ” fmtpadbefore = fmtpadafter = fmtpadthin = False diff --git a/tests/reference/guiPreferences_novelwriter.conf b/tests/reference/guiPreferences_novelwriter.conf index 47c5579d..672f6f7b 100644 --- a/tests/reference/guiPreferences_novelwriter.conf +++ b/tests/reference/guiPreferences_novelwriter.conf @@ -1,5 +1,5 @@ [Meta] -timestamp = 2022-11-10 11:10:13 +timestamp = 2022-11-11 12:48:20 [Main] theme = default @@ -46,8 +46,10 @@ repdots = True scrollpastend = 0 autoscroll = True autoscrollpos = 30 -fmtsinglequote = ‘, ’ -fmtdoublequote = “, ” +fmtsquoteopen = ‘ +fmtsquoteclose = ’ +fmtdquoteopen = “ +fmtdquoteclose = ” fmtpadbefore = fmtpadafter = fmtpadthin = False diff --git a/tests/test_base/test_base_config.py b/tests/test_base/test_base_config.py index 0159952b..8282e558 100644 --- a/tests/test_base/test_base_config.py +++ b/tests/test_base/test_base_config.py @@ -141,8 +141,10 @@ def testBaseConfig_InitLoadSave(monkeypatch, fncPath, tstPaths): assert newConf.guiSyntax == "bar" # Test Correcting Quote Settings - tstConf.fmtDoubleQuotes = ["\"", "\""] - tstConf.fmtSingleQuotes = ["'", "'"] + tstConf.fmtDQuoteOpen = "\"" + tstConf.fmtDQuoteClose = "\"" + tstConf.fmtSQuoteOpen = "'" + tstConf.fmtSQuoteClose = "'" tstConf.doReplaceDQuote = True tstConf.doReplaceSQuote = True assert tstConf.saveConfig() is True diff --git a/tests/test_core/test_core_item.py b/tests/test_core/test_core_item.py index 6ee0837e..034240e1 100644 --- a/tests/test_core/test_core_item.py +++ b/tests/test_core/test_core_item.py @@ -133,11 +133,11 @@ def testCoreItem_Setters(mockGUI, mockRnd, fncPath): theItem.setExpanded("What?") assert theItem.isExpanded is False theItem.setExpanded("True") - assert theItem.isExpanded is True + assert theItem.isExpanded is False theItem.setExpanded(True) assert theItem.isExpanded is True - # Exported + # Active theItem.setActive(8) assert theItem.isActive is False theItem.setActive(None) @@ -147,7 +147,7 @@ def testCoreItem_Setters(mockGUI, mockRnd, fncPath): theItem.setActive("What?") assert theItem.isActive is False theItem.setActive("True") - assert theItem.isActive is True + assert theItem.isActive is False theItem.setActive(True) assert theItem.isActive is True diff --git a/tests/test_gui/test_gui_guimain.py b/tests/test_gui/test_gui_guimain.py index 2a6daf33..9d4f2d02 100644 --- a/tests/test_gui/test_gui_guimain.py +++ b/tests/test_gui/test_gui_guimain.py @@ -432,19 +432,19 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd): qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=KEY_DELAY) # Insert spaces before and after quotes - nwGUI.mainConf.fmtPadBefore = "\u201d" - nwGUI.mainConf.fmtPadAfter = "\u201c" + nwGUI.docEditor._typPadBefore = "\u201d" + nwGUI.docEditor._typPadAfter = "\u201c" for c in "Some \"double quoted text with spaces padded\".": qtbot.keyClick(nwGUI.docEditor, c, delay=KEY_DELAY) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=KEY_DELAY) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=KEY_DELAY) - nwGUI.mainConf.fmtPadBefore = "" - nwGUI.mainConf.fmtPadAfter = "" + nwGUI.docEditor._typPadBefore = "" + nwGUI.docEditor._typPadAfter = "" # Insert spaces before colon, but ignore tags and synopsis - nwGUI.mainConf.fmtPadBefore = ":" + nwGUI.docEditor._typPadBefore = ":" for c in "@object: NoSpaceAdded": qtbot.keyClick(nwGUI.docEditor, c, delay=KEY_DELAY) @@ -466,7 +466,7 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd): qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=KEY_DELAY) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=KEY_DELAY) - nwGUI.mainConf.fmtPadBefore = "" + nwGUI.docEditor._typPadBefore = "" # Indent and Align # ================ diff --git a/tests/test_gui/test_gui_mainmenu.py b/tests/test_gui/test_gui_mainmenu.py index 57696584..157b9d46 100644 --- a/tests/test_gui/test_gui_mainmenu.py +++ b/tests/test_gui/test_gui_mainmenu.py @@ -461,19 +461,19 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncPath, projPath, mockRnd): nwGUI.docEditor.clear() nwGUI.mainMenu.aInsQuoteLS.activate(QAction.Trigger) - assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtSingleQuotes[0] + assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtSQuoteOpen nwGUI.docEditor.clear() nwGUI.mainMenu.aInsQuoteRS.activate(QAction.Trigger) - assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtSingleQuotes[1] + assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtSQuoteClose nwGUI.docEditor.clear() nwGUI.mainMenu.aInsQuoteLD.activate(QAction.Trigger) - assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtDoubleQuotes[0] + assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtDQuoteOpen nwGUI.docEditor.clear() nwGUI.mainMenu.aInsQuoteRD.activate(QAction.Trigger) - assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtDoubleQuotes[1] + assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtDQuoteClose nwGUI.docEditor.clear() nwGUI.mainMenu.aInsMSApos.activate(QAction.Trigger)