Fix minor issues and make improvements for 2.7 RC 1 (#2333)

This commit is contained in:
Veronica Berglyd Olsen
2025-05-11 13:45:01 +02:00
committed by GitHub
16 changed files with 166 additions and 139 deletions
+24 -11
View File
@@ -42,7 +42,7 @@ from PyQt6.QtWidgets import QApplication
from novelwriter.common import ( from novelwriter.common import (
NWConfigParser, checkInt, checkPath, describeFont, fontMatcher, NWConfigParser, checkInt, checkPath, describeFont, fontMatcher,
formatTimeStamp, processDialogSymbols formatTimeStamp, processDialogSymbols, simplified
) )
from novelwriter.constants import nwFiles, nwHtmlUnicode, nwQuotes, nwUnicode from novelwriter.constants import nwFiles, nwHtmlUnicode, nwQuotes, nwUnicode
from novelwriter.error import formatException, logException from novelwriter.error import formatException, logException
@@ -65,16 +65,16 @@ class Config:
__slots__ = ( __slots__ = (
"_appPath", "_appRoot", "_backPath", "_backupPath", "_confPath", "_dLocale", "_dShortDate", "_appPath", "_appRoot", "_backPath", "_backupPath", "_confPath", "_dLocale", "_dShortDate",
"_dShortDateTime", "_dataPath", "_errData", "_hasError", "_homePath", "_manuals", "_dShortDateTime", "_dataPath", "_errData", "_hasError", "_homePath", "_lastAuthor",
"_nwLangPath", "_qLocale", "_qtLangPath", "_qtTrans", "_recentPaths", "_recentProjects", "_manuals", "_nwLangPath", "_qLocale", "_qtLangPath", "_qtTrans", "_recentPaths",
"_splash", "allowOpenDial", "altDialogClose", "altDialogOpen", "appHandle", "appName", "_recentProjects", "_splash", "allowOpenDial", "altDialogClose", "altDialogOpen",
"askBeforeBackup", "askBeforeExit", "autoSaveDoc", "autoSaveProj", "autoScroll", "appHandle", "appName", "askBeforeBackup", "askBeforeExit", "autoSaveDoc", "autoSaveProj",
"autoScrollPos", "autoSelect", "backupOnClose", "cursorWidth", "dialogLine", "dialogStyle", "autoScroll", "autoScrollPos", "autoSelect", "backupOnClose", "cursorWidth", "dialogLine",
"doJustify", "doReplace", "doReplaceDQuote", "doReplaceDash", "doReplaceDots", "dialogStyle", "doJustify", "doReplace", "doReplaceDQuote", "doReplaceDash",
"doReplaceSQuote", "emphLabels", "fmtApostrophe", "fmtDQuoteClose", "fmtDQuoteOpen", "doReplaceDots", "doReplaceSQuote", "emphLabels", "fmtApostrophe", "fmtDQuoteClose",
"fmtPadAfter", "fmtPadBefore", "fmtPadThin", "fmtSQuoteClose", "fmtSQuoteOpen", "fmtDQuoteOpen", "fmtPadAfter", "fmtPadBefore", "fmtPadThin", "fmtSQuoteClose",
"focusWidth", "guiFont", "guiLocale", "guiSyntax", "guiTheme", "hasEnchant", "fmtSQuoteOpen", "focusWidth", "guiFont", "guiLocale", "guiSyntax", "guiTheme",
"hideFocusFooter", "hideHScroll", "hideVScroll", "highlightEmph", "hostName", "hasEnchant", "hideFocusFooter", "hideHScroll", "hideVScroll", "highlightEmph", "hostName",
"iconColDocs", "iconColTree", "iconTheme", "incNotesWCount", "isDebug", "kernelVer", "iconColDocs", "iconColTree", "iconTheme", "incNotesWCount", "isDebug", "kernelVer",
"lastNotes", "mainPanePos", "mainWinSize", "memInfo", "narratorBreak", "narratorDialog", "lastNotes", "mainPanePos", "mainWinSize", "memInfo", "narratorBreak", "narratorDialog",
"nativeFont", "osDarwin", "osLinux", "osType", "osUnknown", "osWindows", "outlinePanePos", "nativeFont", "osDarwin", "osLinux", "osType", "osUnknown", "osWindows", "outlinePanePos",
@@ -149,6 +149,7 @@ class Config:
self._recentProjects = RecentProjects(self) self._recentProjects = RecentProjects(self)
self._recentPaths = RecentPaths(self) self._recentPaths = RecentPaths(self)
self._lastAuthor = ""
# General GUI Settings # General GUI Settings
self.guiLocale = self._qLocale.name() self.guiLocale = self._qLocale.name()
@@ -321,6 +322,11 @@ class Config:
def recentProjects(self) -> RecentProjects: def recentProjects(self) -> RecentProjects:
return self._recentProjects return self._recentProjects
@property
def lastAuthor(self) -> str:
"""Return the last author name used."""
return simplified(self._lastAuthor)
## ##
# Getters # Getters
## ##
@@ -336,6 +342,11 @@ class Config:
# Setters # Setters
## ##
def setLastAuthor(self, value: str) -> None:
"""Set tle last used author name."""
self._lastAuthor = simplified(value)
return
def setMainWinSize(self, width: int, height: int) -> None: def setMainWinSize(self, width: int, height: int) -> None:
"""Set the size of the main window, but only if the change is """Set the size of the main window, but only if the change is
larger than 5 pixels. The OS window manager will sometimes larger than 5 pixels. The OS window manager will sometimes
@@ -645,6 +656,7 @@ class Config:
self.backupOnClose = conf.rdBool(sec, "backuponclose", self.backupOnClose) self.backupOnClose = conf.rdBool(sec, "backuponclose", self.backupOnClose)
self.askBeforeBackup = conf.rdBool(sec, "askbeforebackup", self.askBeforeBackup) self.askBeforeBackup = conf.rdBool(sec, "askbeforebackup", self.askBeforeBackup)
self.askBeforeExit = conf.rdBool(sec, "askbeforeexit", self.askBeforeExit) self.askBeforeExit = conf.rdBool(sec, "askbeforeexit", self.askBeforeExit)
self._lastAuthor = conf.rdStr(sec, "lastauthor", self._lastAuthor)
# Editor # Editor
sec = "Editor" sec = "Editor"
@@ -769,6 +781,7 @@ class Config:
"backuponclose": str(self.backupOnClose), "backuponclose": str(self.backupOnClose),
"askbeforebackup": str(self.askBeforeBackup), "askbeforebackup": str(self.askBeforeBackup),
"askbeforeexit": str(self.askBeforeExit), "askbeforeexit": str(self.askBeforeExit),
"lastauthor": str(self._lastAuthor),
} }
conf["Editor"] = { conf["Editor"] = {
+41 -34
View File
@@ -383,10 +383,12 @@ class ProjectBuilder:
"""Build or copy a project from a data dictionary.""" """Build or copy a project from a data dictionary."""
if isinstance(data, dict): if isinstance(data, dict):
path = data.get("path", None) or None path = data.get("path", None) or None
if author := data.get("author"):
CONFIG.setLastAuthor(author)
if isinstance(path, str | Path): if isinstance(path, str | Path):
self._path = Path(path).resolve() self._path = Path(path).resolve()
if data.get("sample"): if data.get("sample"):
return self._extractSampleProject(self._path) return self._extractSampleProject(self._path, data)
elif data.get("template"): elif data.get("template"):
return self._copyProject(self._path, data) return self._copyProject(self._path, data)
else: else:
@@ -416,20 +418,21 @@ class ProjectBuilder:
self._path = project.storage.storagePath self._path = project.storage.storagePath
lblNewProject = self.tr("New Project") trName = self.tr("New Project")
lblTitlePage = self.tr("Title Page") trAuthor = self.tr("Author Name")
trTitlePage = self.tr("Title Page")
# Settings # Settings
project.data.setUuid(None) project.data.setUuid(None)
project.data.setName(data.get("name", lblNewProject)) project.data.setName(data.get("name", trName))
project.data.setAuthor(data.get("author", "")) project.data.setAuthor(data.get("author", trAuthor))
project.data.setLanguage(CONFIG.guiLocale) project.data.setLanguage(CONFIG.guiLocale)
project.setDefaultStatusImport() project.setDefaultStatusImport()
project.session.startSession() project.session.startSession()
# Add Root Folders # Add Root Folders
hNovelRoot = project.newRoot(nwItemClass.NOVEL) hNovelRoot = project.newRoot(nwItemClass.NOVEL)
hTitlePage = project.newFile(lblTitlePage, hNovelRoot) hTitlePage = project.newFile(trTitlePage, hNovelRoot)
# Generate Title Page # Generate Title Page
aDoc = project.storage.getDocument(hTitlePage) aDoc = project.storage.getDocument(hTitlePage)
@@ -446,25 +449,21 @@ class ProjectBuilder:
"\n" "\n"
">> {count}: [field:{field}] <<\n" ">> {count}: [field:{field}] <<\n"
).format( ).format(
author=project.data.author or "None", author=project.data.author or trAuthor,
address=self.tr("Address"), address=self.tr("Address Line"),
title=project.data.name or "None", title=project.data.name or trName,
by=self.tr("By"), by=self.tr("By"),
count=self.tr("Word Count"), count=self.tr("Word Count"),
field=nwStats.WORDS_TEXT, field=nwStats.WORDS_TEXT,
)) ))
# Create a project structure based on selected root folders
# and a number of chapters and scenes selected in the
# wizard's custom page.
# Create chapters and scenes # Create chapters and scenes
numChapters = data.get("chapters", 0) numChapters = data.get("chapters", 0)
numScenes = data.get("scenes", 0) numScenes = data.get("scenes", 0)
chSynop = self.tr("Summary of the chapter.") trChSynop = self.tr("Summary of the chapter.")
scSynop = self.tr("Summary of the scene.") trScSynop = self.tr("Summary of the scene.")
bfNote = self.tr("A short description.") trNoteDesc = self.tr("A short description.")
# Create chapters # Create chapters
if numChapters > 0: if numChapters > 0:
@@ -472,7 +471,7 @@ class ProjectBuilder:
chTitle = self.tr("Chapter {0}").format(f"{ch+1:d}") chTitle = self.tr("Chapter {0}").format(f"{ch+1:d}")
cHandle = project.newFile(chTitle, hNovelRoot) cHandle = project.newFile(chTitle, hNovelRoot)
aDoc = project.storage.getDocument(cHandle) aDoc = project.storage.getDocument(cHandle)
aDoc.writeDocument(f"## {chTitle}\n\n%Synopsis: {chSynop}\n\n") aDoc.writeDocument(f"## {chTitle}\n\n%Synopsis: {trChSynop}\n\n")
# Create chapter scenes # Create chapter scenes
if numScenes > 0 and cHandle: if numScenes > 0 and cHandle:
@@ -480,7 +479,7 @@ class ProjectBuilder:
scTitle = self.tr("Scene {0}").format(f"{ch+1:d}.{sc+1:d}") scTitle = self.tr("Scene {0}").format(f"{ch+1:d}.{sc+1:d}")
sHandle = project.newFile(scTitle, cHandle) sHandle = project.newFile(scTitle, cHandle)
aDoc = project.storage.getDocument(sHandle) aDoc = project.storage.getDocument(sHandle)
aDoc.writeDocument(f"### {scTitle}\n\n%Synopsis: {scSynop}\n\n") aDoc.writeDocument(f"### {scTitle}\n\n%Synopsis: {trScSynop}\n\n")
# Create scenes (no chapters) # Create scenes (no chapters)
elif numScenes > 0: elif numScenes > 0:
@@ -488,7 +487,7 @@ class ProjectBuilder:
scTitle = self.tr("Scene {0}").format(f"{sc+1:d}") scTitle = self.tr("Scene {0}").format(f"{sc+1:d}")
sHandle = project.newFile(scTitle, hNovelRoot) sHandle = project.newFile(scTitle, hNovelRoot)
aDoc = project.storage.getDocument(sHandle) aDoc = project.storage.getDocument(sHandle)
aDoc.writeDocument(f"### {scTitle}\n\n%Synopsis: {scSynop}\n\n") aDoc.writeDocument(f"### {scTitle}\n\n%Synopsis: {trScSynop}\n\n")
# Create notes folders # Create notes folders
noteTitles = { noteTitles = {
@@ -508,7 +507,7 @@ class ProjectBuilder:
aDoc.writeDocument( aDoc.writeDocument(
f"# {noteTitles[newRoot]}\n\n" f"# {noteTitles[newRoot]}\n\n"
f"@tag: {ntTag}\n\n" f"@tag: {ntTag}\n\n"
f"%Short: {bfNote}\n\n" f"%Short: {trNoteDesc}\n\n"
) )
# Also add the archive and trash folders # Also add the archive and trash folders
@@ -563,23 +562,11 @@ class ProjectBuilder:
return False return False
# Open the copied project and update settings # Open the copied project and update settings
project = NWProject() self._resetProject(dstPath, data)
project.openProject(dstPath)
project.data.setUuid("") # Creates a fresh uuid
project.data.setName(data.get("name", "None"))
project.data.setAuthor(data.get("author", ""))
project.data.setSpellCheck(True)
project.data.setSpellLang(None)
project.data.setDoBackup(True)
project.data.setSaveCount(0)
project.data.setAutoCount(0)
project.data.setEditTime(0)
project.saveProject()
project.closeProject()
return True return True
def _extractSampleProject(self, path: Path) -> bool: def _extractSampleProject(self, path: Path, data: dict) -> bool:
"""Make a copy of the sample project by extracting the """Make a copy of the sample project by extracting the
sample.zip file to the new path. sample.zip file to the new path.
""" """
@@ -593,6 +580,7 @@ class ProjectBuilder:
if (sample := CONFIG.assetPath("sample.zip")).is_file(): if (sample := CONFIG.assetPath("sample.zip")).is_file():
try: try:
shutil.unpack_archive(sample, path) shutil.unpack_archive(sample, path)
self._resetProject(path, data)
except Exception as exc: except Exception as exc:
SHARED.error(self.tr("Failed to create a new example project."), exc=exc) SHARED.error(self.tr("Failed to create a new example project."), exc=exc)
return False return False
@@ -605,3 +593,22 @@ class ProjectBuilder:
return False return False
return True return True
def _resetProject(self, path: Path, data: dict) -> None:
"""Open a project and reset/update its settings."""
project = NWProject()
project.openProject(path)
project.data.setUuid("") # Creates a fresh uuid
if name := data.get("name", ""):
project.data.setName(name)
if author := data.get("author", ""):
project.data.setAuthor(author)
project.data.setSpellCheck(True)
project.data.setSpellLang(None)
project.data.setDoBackup(True)
project.data.setSaveCount(0)
project.data.setAutoCount(0)
project.data.setEditTime(0)
project.saveProject()
project.closeProject()
return
+8 -8
View File
@@ -483,14 +483,14 @@ class NWProject:
def setDefaultStatusImport(self) -> None: def setDefaultStatusImport(self) -> None:
"""Set the default status and importance values.""" """Set the default status and importance values."""
self._data.itemStatus.add(None, self.tr("New"), (100, 100, 100), "SQUARE", 0) self._data.itemStatus.add(None, self.tr("New"), (120, 120, 120), "STAR", 0)
self._data.itemStatus.add(None, self.tr("Note"), (200, 50, 0), "SQUARE", 0) self._data.itemStatus.add(None, self.tr("Note"), (205, 171, 143), "TRIANGLE", 0)
self._data.itemStatus.add(None, self.tr("Draft"), (200, 150, 0), "SQUARE", 0) self._data.itemStatus.add(None, self.tr("Draft"), (143, 240, 164), "CIRCLE_T", 0)
self._data.itemStatus.add(None, self.tr("Finished"), (50, 200, 0), "SQUARE", 0) self._data.itemStatus.add(None, self.tr("Finished"), (249, 240, 107), "STAR", 0)
self._data.itemImport.add(None, self.tr("New"), (100, 100, 100), "SQUARE", 0) self._data.itemImport.add(None, self.tr("New"), (120, 120, 120), "SQUARE", 0)
self._data.itemImport.add(None, self.tr("Minor"), (200, 50, 0), "SQUARE", 0) self._data.itemImport.add(None, self.tr("Minor"), (220, 138, 221), "BLOCK_2", 0)
self._data.itemImport.add(None, self.tr("Major"), (200, 150, 0), "SQUARE", 0) self._data.itemImport.add(None, self.tr("Major"), (220, 138, 221), "BLOCK_3", 0)
self._data.itemImport.add(None, self.tr("Main"), (50, 200, 0), "SQUARE", 0) self._data.itemImport.add(None, self.tr("Main"), (220, 138, 221), "BLOCK_4", 0)
return return
def setProjectLang(self, language: str | None) -> None: def setProjectLang(self, language: str | None) -> None:
+1
View File
@@ -565,6 +565,7 @@ class _NewProjectForm(QWidget):
self.projAuthor = QLineEdit(self) self.projAuthor = QLineEdit(self)
self.projAuthor.setMaxLength(200) self.projAuthor.setMaxLength(200)
self.projAuthor.setPlaceholderText(self.tr("Optional")) self.projAuthor.setPlaceholderText(self.tr("Optional"))
self.projAuthor.setText(CONFIG.lastAuthor)
# Project Path # Project Path
self.projPath = QLineEdit(self) self.projPath = QLineEdit(self)
+2 -1
View File
@@ -1,5 +1,5 @@
[Meta] [Meta]
timestamp = 2025-02-22 19:57:47 timestamp = 2025-05-11 13:28:11
[Main] [Main]
font = font =
@@ -31,6 +31,7 @@ backuppath =
backuponclose = False backuponclose = False
askbeforebackup = True askbeforebackup = True
askbeforeexit = True askbeforeexit = True
lastauthor =
[Editor] [Editor]
textfont = textfont =
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="2.6b1" hexVersion="0x020600b1" fileVersion="1.5" fileRevision="4" timeStamp="2024-11-23 23:32:55"> <novelWriterXML appVersion="2.7b1" hexVersion="0x020700b1" fileVersion="1.5" fileRevision="4" timeStamp="2025-05-11 12:42:48">
<project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="1" editTime="0"> <project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="1" editTime="0">
<name>New Project</name> <name>New Project</name>
<author>Jane Doe</author> <author>Jane Doe</author>
@@ -16,16 +16,16 @@
</lastHandle> </lastHandle>
<autoReplace /> <autoReplace />
<status> <status>
<entry key="s000000" count="7" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="s000000" count="7" red="120" green="120" blue="120" shape="STAR">New</entry>
<entry key="s000001" count="0" red="200" green="50" blue="0" shape="SQUARE">Note</entry> <entry key="s000001" count="0" red="205" green="171" blue="143" shape="TRIANGLE">Note</entry>
<entry key="s000002" count="0" red="200" green="150" blue="0" shape="SQUARE">Draft</entry> <entry key="s000002" count="0" red="143" green="240" blue="164" shape="CIRCLE_T">Draft</entry>
<entry key="s000003" count="0" red="50" green="200" blue="0" shape="SQUARE">Finished</entry> <entry key="s000003" count="0" red="249" green="240" blue="107" shape="STAR">Finished</entry>
</status> </status>
<importance> <importance>
<entry key="i000004" count="5" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="i000004" count="5" red="120" green="120" blue="120" shape="SQUARE">New</entry>
<entry key="i000005" count="0" red="200" green="50" blue="0" shape="SQUARE">Minor</entry> <entry key="i000005" count="0" red="220" green="138" blue="221" shape="BLOCK_2">Minor</entry>
<entry key="i000006" count="0" red="200" green="150" blue="0" shape="SQUARE">Major</entry> <entry key="i000006" count="0" red="220" green="138" blue="221" shape="BLOCK_3">Major</entry>
<entry key="i000007" count="0" red="50" green="200" blue="0" shape="SQUARE">Main</entry> <entry key="i000007" count="0" red="220" green="138" blue="221" shape="BLOCK_4">Main</entry>
</importance> </importance>
</settings> </settings>
<content items="12" novelWords="10" notesWords="6"> <content items="12" novelWords="10" notesWords="6">
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="2.6b1" hexVersion="0x020600b1" fileVersion="1.5" fileRevision="4" timeStamp="2024-11-23 23:32:55"> <novelWriterXML appVersion="2.7b1" hexVersion="0x020700b1" fileVersion="1.5" fileRevision="4" timeStamp="2025-05-11 12:42:48">
<project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="1" editTime="0"> <project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="1" editTime="0">
<name>New Project</name> <name>New Project</name>
<author>Jane Doe</author> <author>Jane Doe</author>
@@ -16,16 +16,16 @@
</lastHandle> </lastHandle>
<autoReplace /> <autoReplace />
<status> <status>
<entry key="s000000" count="6" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="s000000" count="6" red="120" green="120" blue="120" shape="STAR">New</entry>
<entry key="s000001" count="0" red="200" green="50" blue="0" shape="SQUARE">Note</entry> <entry key="s000001" count="0" red="205" green="171" blue="143" shape="TRIANGLE">Note</entry>
<entry key="s000002" count="0" red="200" green="150" blue="0" shape="SQUARE">Draft</entry> <entry key="s000002" count="0" red="143" green="240" blue="164" shape="CIRCLE_T">Draft</entry>
<entry key="s000003" count="0" red="50" green="200" blue="0" shape="SQUARE">Finished</entry> <entry key="s000003" count="0" red="249" green="240" blue="107" shape="STAR">Finished</entry>
</status> </status>
<importance> <importance>
<entry key="i000004" count="10" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="i000004" count="10" red="120" green="120" blue="120" shape="SQUARE">New</entry>
<entry key="i000005" count="0" red="200" green="50" blue="0" shape="SQUARE">Minor</entry> <entry key="i000005" count="0" red="220" green="138" blue="221" shape="BLOCK_2">Minor</entry>
<entry key="i000006" count="0" red="200" green="150" blue="0" shape="SQUARE">Major</entry> <entry key="i000006" count="0" red="220" green="138" blue="221" shape="BLOCK_3">Major</entry>
<entry key="i000007" count="0" red="50" green="200" blue="0" shape="SQUARE">Main</entry> <entry key="i000007" count="0" red="220" green="138" blue="221" shape="BLOCK_4">Main</entry>
</importance> </importance>
</settings> </settings>
<content items="16" novelWords="9" notesWords="0"> <content items="16" novelWords="9" notesWords="0">
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="2.6b1" hexVersion="0x020600b1" fileVersion="1.5" fileRevision="4" timeStamp="2024-11-23 23:37:19"> <novelWriterXML appVersion="2.7b1" hexVersion="0x020700b1" fileVersion="1.5" fileRevision="4" timeStamp="2025-05-11 12:42:46">
<project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="1" editTime="0"> <project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="1" editTime="0">
<name>New Project</name> <name>New Project</name>
<author>Jane Doe</author> <author>Jane Doe</author>
@@ -16,16 +16,16 @@
</lastHandle> </lastHandle>
<autoReplace /> <autoReplace />
<status> <status>
<entry key="s000000" count="16" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="s000000" count="16" red="120" green="120" blue="120" shape="STAR">New</entry>
<entry key="s000001" count="0" red="200" green="50" blue="0" shape="SQUARE">Note</entry> <entry key="s000001" count="0" red="205" green="171" blue="143" shape="TRIANGLE">Note</entry>
<entry key="s000002" count="0" red="200" green="150" blue="0" shape="SQUARE">Draft</entry> <entry key="s000002" count="0" red="143" green="240" blue="164" shape="CIRCLE_T">Draft</entry>
<entry key="s000003" count="0" red="50" green="200" blue="0" shape="SQUARE">Finished</entry> <entry key="s000003" count="0" red="249" green="240" blue="107" shape="STAR">Finished</entry>
</status> </status>
<importance> <importance>
<entry key="i000004" count="3" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="i000004" count="3" red="120" green="120" blue="120" shape="SQUARE">New</entry>
<entry key="i000005" count="0" red="200" green="50" blue="0" shape="SQUARE">Minor</entry> <entry key="i000005" count="0" red="220" green="138" blue="221" shape="BLOCK_2">Minor</entry>
<entry key="i000006" count="0" red="200" green="150" blue="0" shape="SQUARE">Major</entry> <entry key="i000006" count="0" red="220" green="138" blue="221" shape="BLOCK_3">Major</entry>
<entry key="i000007" count="0" red="50" green="200" blue="0" shape="SQUARE">Main</entry> <entry key="i000007" count="0" red="220" green="138" blue="221" shape="BLOCK_4">Main</entry>
</importance> </importance>
</settings> </settings>
<content items="19" novelWords="28" notesWords="0"> <content items="19" novelWords="28" notesWords="0">
@@ -1,6 +1,6 @@
Jane Doe Jane Doe
Address 1 Address Line 1
Address 2 Address Line 2
@@ -17,7 +17,7 @@ Test Project A
**By Jane Doe** **By Jane Doe**
Word Count: 11 Word Count: 13
# Chapter 1 # Chapter 1
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="2.6b1" hexVersion="0x020600b1" fileVersion="1.5" fileRevision="4" timeStamp="2024-11-23 19:07:52"> <novelWriterXML appVersion="2.7b1" hexVersion="0x020700b1" fileVersion="1.5" fileRevision="4" timeStamp="2025-05-11 12:42:46">
<project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="0" editTime="0"> <project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="0" editTime="0">
<name>Test Project A</name> <name>Test Project A</name>
<author>Jane Doe</author> <author>Jane Doe</author>
@@ -16,16 +16,16 @@
</lastHandle> </lastHandle>
<autoReplace /> <autoReplace />
<status> <status>
<entry key="s000000" count="15" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="s000000" count="15" red="120" green="120" blue="120" shape="STAR">New</entry>
<entry key="s000001" count="0" red="200" green="50" blue="0" shape="SQUARE">Note</entry> <entry key="s000001" count="0" red="205" green="171" blue="143" shape="TRIANGLE">Note</entry>
<entry key="s000002" count="0" red="200" green="150" blue="0" shape="SQUARE">Draft</entry> <entry key="s000002" count="0" red="143" green="240" blue="164" shape="CIRCLE_T">Draft</entry>
<entry key="s000003" count="0" red="50" green="200" blue="0" shape="SQUARE">Finished</entry> <entry key="s000003" count="0" red="249" green="240" blue="107" shape="STAR">Finished</entry>
</status> </status>
<importance> <importance>
<entry key="i000004" count="7" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="i000004" count="7" red="120" green="120" blue="120" shape="SQUARE">New</entry>
<entry key="i000005" count="0" red="200" green="50" blue="0" shape="SQUARE">Minor</entry> <entry key="i000005" count="0" red="220" green="138" blue="221" shape="BLOCK_2">Minor</entry>
<entry key="i000006" count="0" red="200" green="150" blue="0" shape="SQUARE">Major</entry> <entry key="i000006" count="0" red="220" green="138" blue="221" shape="BLOCK_3">Major</entry>
<entry key="i000007" count="0" red="50" green="200" blue="0" shape="SQUARE">Main</entry> <entry key="i000007" count="0" red="220" green="138" blue="221" shape="BLOCK_4">Main</entry>
</importance> </importance>
</settings> </settings>
<content items="22" novelWords="0" notesWords="0"> <content items="22" novelWords="0" notesWords="0">
@@ -1,6 +1,6 @@
Jane Doe Jane Doe
Address 1 Address Line 1
Address 2 Address Line 2
@@ -17,7 +17,7 @@ Test Project B
**By Jane Doe** **By Jane Doe**
Word Count: 11 Word Count: 13
* * * * * *
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="2.6b1" hexVersion="0x020600b1" fileVersion="1.5" fileRevision="4" timeStamp="2024-11-23 19:07:13"> <novelWriterXML appVersion="2.7b1" hexVersion="0x020700b1" fileVersion="1.5" fileRevision="4" timeStamp="2025-05-11 12:42:46">
<project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="0" editTime="0"> <project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="0" editTime="0">
<name>Test Project B</name> <name>Test Project B</name>
<author>Jane Doe</author> <author>Jane Doe</author>
@@ -16,16 +16,16 @@
</lastHandle> </lastHandle>
<autoReplace /> <autoReplace />
<status> <status>
<entry key="s000000" count="9" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="s000000" count="9" red="120" green="120" blue="120" shape="STAR">New</entry>
<entry key="s000001" count="0" red="200" green="50" blue="0" shape="SQUARE">Note</entry> <entry key="s000001" count="0" red="205" green="171" blue="143" shape="TRIANGLE">Note</entry>
<entry key="s000002" count="0" red="200" green="150" blue="0" shape="SQUARE">Draft</entry> <entry key="s000002" count="0" red="143" green="240" blue="164" shape="CIRCLE_T">Draft</entry>
<entry key="s000003" count="0" red="50" green="200" blue="0" shape="SQUARE">Finished</entry> <entry key="s000003" count="0" red="249" green="240" blue="107" shape="STAR">Finished</entry>
</status> </status>
<importance> <importance>
<entry key="i000004" count="7" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="i000004" count="7" red="120" green="120" blue="120" shape="SQUARE">New</entry>
<entry key="i000005" count="0" red="200" green="50" blue="0" shape="SQUARE">Minor</entry> <entry key="i000005" count="0" red="220" green="138" blue="221" shape="BLOCK_2">Minor</entry>
<entry key="i000006" count="0" red="200" green="150" blue="0" shape="SQUARE">Major</entry> <entry key="i000006" count="0" red="220" green="138" blue="221" shape="BLOCK_3">Major</entry>
<entry key="i000007" count="0" red="50" green="200" blue="0" shape="SQUARE">Main</entry> <entry key="i000007" count="0" red="220" green="138" blue="221" shape="BLOCK_4">Main</entry>
</importance> </importance>
</settings> </settings>
<content items="16" novelWords="0" notesWords="0"> <content items="16" novelWords="0" notesWords="0">
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="2.7a3" hexVersion="0x020700a3" fileVersion="1.5" fileRevision="4" timeStamp="2025-03-30 23:23:22"> <novelWriterXML appVersion="2.7b1" hexVersion="0x020700b1" fileVersion="1.5" fileRevision="4" timeStamp="2025-05-11 12:42:59">
<project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="3" autoCount="2" editTime="5"> <project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="3" autoCount="2" editTime="4">
<name>New Project</name> <name>New Project</name>
<author>Jane Doe</author> <author>Jane Doe</author>
</project> </project>
@@ -16,16 +16,16 @@
</lastHandle> </lastHandle>
<autoReplace /> <autoReplace />
<status> <status>
<entry key="s000000" count="5" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="s000000" count="5" red="120" green="120" blue="120" shape="STAR">New</entry>
<entry key="s000001" count="0" red="200" green="50" blue="0" shape="SQUARE">Note</entry> <entry key="s000001" count="0" red="205" green="171" blue="143" shape="TRIANGLE">Note</entry>
<entry key="s000002" count="0" red="200" green="150" blue="0" shape="SQUARE">Draft</entry> <entry key="s000002" count="0" red="143" green="240" blue="164" shape="CIRCLE_T">Draft</entry>
<entry key="s000003" count="0" red="50" green="200" blue="0" shape="SQUARE">Finished</entry> <entry key="s000003" count="0" red="249" green="240" blue="107" shape="STAR">Finished</entry>
</status> </status>
<importance> <importance>
<entry key="i000004" count="7" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="i000004" count="7" red="120" green="120" blue="120" shape="SQUARE">New</entry>
<entry key="i000005" count="0" red="200" green="50" blue="0" shape="SQUARE">Minor</entry> <entry key="i000005" count="0" red="220" green="138" blue="221" shape="BLOCK_2">Minor</entry>
<entry key="i000006" count="0" red="200" green="150" blue="0" shape="SQUARE">Major</entry> <entry key="i000006" count="0" red="220" green="138" blue="221" shape="BLOCK_3">Major</entry>
<entry key="i000007" count="0" red="50" green="200" blue="0" shape="SQUARE">Main</entry> <entry key="i000007" count="0" red="220" green="138" blue="221" shape="BLOCK_4">Main</entry>
</importance> </importance>
</settings> </settings>
<content items="12" novelWords="173" notesWords="27"> <content items="12" novelWords="173" notesWords="27">
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="2.7a3" hexVersion="0x020700a3" fileVersion="1.5" fileRevision="4" timeStamp="2025-03-23 22:33:54"> <novelWriterXML appVersion="2.7b1" hexVersion="0x020700b1" fileVersion="1.5" fileRevision="4" timeStamp="2025-05-11 12:39:41">
<project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="2" autoCount="1" editTime="0"> <project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="2" autoCount="1" editTime="0">
<name>New Project</name> <name>New Project</name>
<author>Jane Doe</author> <author>Jane Doe</author>
@@ -16,16 +16,16 @@
</lastHandle> </lastHandle>
<autoReplace /> <autoReplace />
<status> <status>
<entry key="s000000" count="5" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="s000000" count="5" red="120" green="120" blue="120" shape="STAR">New</entry>
<entry key="s000001" count="0" red="200" green="50" blue="0" shape="SQUARE">Note</entry> <entry key="s000001" count="0" red="205" green="171" blue="143" shape="TRIANGLE">Note</entry>
<entry key="s000002" count="0" red="200" green="150" blue="0" shape="SQUARE">Draft</entry> <entry key="s000002" count="0" red="143" green="240" blue="164" shape="CIRCLE_T">Draft</entry>
<entry key="s000003" count="0" red="50" green="200" blue="0" shape="SQUARE">Finished</entry> <entry key="s000003" count="0" red="249" green="240" blue="107" shape="STAR">Finished</entry>
</status> </status>
<importance> <importance>
<entry key="i000004" count="3" red="100" green="100" blue="100" shape="SQUARE">New</entry> <entry key="i000004" count="3" red="120" green="120" blue="120" shape="SQUARE">New</entry>
<entry key="i000005" count="0" red="200" green="50" blue="0" shape="SQUARE">Minor</entry> <entry key="i000005" count="0" red="220" green="138" blue="221" shape="BLOCK_2">Minor</entry>
<entry key="i000006" count="0" red="200" green="150" blue="0" shape="SQUARE">Major</entry> <entry key="i000006" count="0" red="220" green="138" blue="221" shape="BLOCK_3">Major</entry>
<entry key="i000007" count="0" red="50" green="200" blue="0" shape="SQUARE">Main</entry> <entry key="i000007" count="0" red="220" green="138" blue="221" shape="BLOCK_4">Main</entry>
</importance> </importance>
</settings> </settings>
<content items="8" novelWords="9" notesWords="0"> <content items="8" novelWords="9" notesWords="0">
+5
View File
@@ -242,6 +242,11 @@ def testBaseConfig_Methods(fncPath):
# Recent Projects # Recent Projects
assert isinstance(tstConf.recentProjects, RecentProjects) assert isinstance(tstConf.recentProjects, RecentProjects)
# Last Author
assert CONFIG.lastAuthor == ""
CONFIG.setLastAuthor(" Jane Doe ")
assert CONFIG.lastAuthor == "Jane Doe"
@pytest.mark.base @pytest.mark.base
def testBaseConfig_SettersGetters(fncPath): def testBaseConfig_SettersGetters(fncPath):
+15 -15
View File
@@ -214,18 +214,18 @@ def testDlgProjSettings_StatusImport(qtbot, monkeypatch, nwGUI, projPath, mockRn
assert update[0][0] == C.sNew assert update[0][0] == C.sNew
assert update[0][1].name == "New" assert update[0][1].name == "New"
assert update[0][1].color == QColor(100, 100, 100) assert update[0][1].color == QColor(120, 120, 120)
assert update[0][1].shape == nwStatusShape.SQUARE assert update[0][1].shape == nwStatusShape.STAR
assert update[1][0] == C.sDraft assert update[1][0] == C.sDraft
assert update[1][1].name == "Draft" assert update[1][1].name == "Draft"
assert update[1][1].color == QColor(200, 150, 0) assert update[1][1].color == QColor(143, 240, 164)
assert update[1][1].shape == nwStatusShape.SQUARE assert update[1][1].shape == nwStatusShape.CIRCLE_T
assert update[2][0] == C.sFinished assert update[2][0] == C.sFinished
assert update[2][1].name == "Finished" assert update[2][1].name == "Finished"
assert update[2][1].color == QColor(50, 200, 0) assert update[2][1].color == QColor(249, 240, 107)
assert update[2][1].shape == nwStatusShape.SQUARE assert update[2][1].shape == nwStatusShape.STAR
assert update[3][0] is None assert update[3][0] is None
assert update[3][1].name == "Final" assert update[3][1].name == "Final"
@@ -289,18 +289,18 @@ def testDlgProjSettings_StatusImport(qtbot, monkeypatch, nwGUI, projPath, mockRn
assert update[0][0] == C.iNew assert update[0][0] == C.iNew
assert update[0][1].name == "New" assert update[0][1].name == "New"
assert update[0][1].color == QColor(100, 100, 100) assert update[0][1].color == QColor(120, 120, 120)
assert update[0][1].shape == nwStatusShape.SQUARE assert update[0][1].shape == nwStatusShape.SQUARE
assert update[1][0] == C.iMajor assert update[1][0] == C.iMajor
assert update[1][1].name == "Major" assert update[1][1].name == "Major"
assert update[1][1].color == QColor(200, 150, 0) assert update[1][1].color == QColor(220, 138, 221)
assert update[1][1].shape == nwStatusShape.SQUARE assert update[1][1].shape == nwStatusShape.BLOCK_3
assert update[2][0] == C.iMain assert update[2][0] == C.iMain
assert update[2][1].name == "Main" assert update[2][1].name == "Main"
assert update[2][1].color == QColor(50, 200, 0) assert update[2][1].color == QColor(220, 138, 221)
assert update[2][1].shape == nwStatusShape.SQUARE assert update[2][1].shape == nwStatusShape.BLOCK_4
assert update[3][0] is None assert update[3][0] is None
assert update[3][1].name == "Final" assert update[3][1].name == "Final"
@@ -354,10 +354,10 @@ def testDlgProjSettings_StatusImportExport(qtbot, monkeypatch, nwGUI, projPath,
assert expFile.is_file() is True assert expFile.is_file() is True
assert expFile.read_text().split() == [ assert expFile.read_text().split() == [
"SQUARE,#646464,New", "STAR,#787878,New",
"SQUARE,#c83200,Note", "TRIANGLE,#cdab8f,Note",
"SQUARE,#c89600,Draft", "CIRCLE_T,#8ff0a4,Draft",
"SQUARE,#32c800,Finished", "STAR,#f9f06b,Finished",
] ]
# Import Error # Import Error