Drop the Novel Title data from the project and code

This commit is contained in:
Veronica Berglyd Olsen
2024-01-26 22:45:12 +01:00
parent e03305d601
commit 838a2a8062
7 changed files with 7 additions and 28 deletions
+1 -2
View File
@@ -374,7 +374,6 @@ class ProjectBuilder:
project.data.setUuid(None) project.data.setUuid(None)
project.data.setName(projName) project.data.setName(projName)
project.data.setTitle(projName)
project.data.setAuthor(projAuthor) project.data.setAuthor(projAuthor)
project.data.setLanguage(projLang) project.data.setLanguage(projLang)
project.setDefaultStatusImport() project.setDefaultStatusImport()
@@ -383,7 +382,7 @@ class ProjectBuilder:
# Add Root Folders # Add Root Folders
hNovelRoot = project.newRoot(nwItemClass.NOVEL) hNovelRoot = project.newRoot(nwItemClass.NOVEL)
hTitlePage = project.newFile(lblTitlePage, hNovelRoot) hTitlePage = project.newFile(lblTitlePage, hNovelRoot)
novelTitle = project.data.title if project.data.title else project.data.name novelTitle = project.data.name
titlePage = f"#! {novelTitle}\n\n" titlePage = f"#! {novelTitle}\n\n"
if project.data.author: if project.data.author:
+1 -14
View File
@@ -53,7 +53,6 @@ class NWProjectData:
# Project Meta # Project Meta
self._uuid = "" self._uuid = ""
self._name = "" self._name = ""
self._title = ""
self._author = "" self._author = ""
self._saveCount = 0 self._saveCount = 0
self._autoCount = 0 self._autoCount = 0
@@ -102,11 +101,6 @@ class NWProjectData:
"""Return the project name.""" """Return the project name."""
return self._name return self._name
@property
def title(self) -> str:
"""Return the project title."""
return self._title
@property @property
def author(self) -> str: def author(self) -> str:
"""Return the project author.""" """Return the project author."""
@@ -228,16 +222,9 @@ class NWProjectData:
self._project.setProjectChanged(True) self._project.setProjectChanged(True)
return return
def setTitle(self, value: str | None) -> None:
"""Set a new novel title."""
if value != self._title:
self._title = simplified(str(value or ""))
self._project.setProjectChanged(True)
return
def setAuthor(self, value: str | None) -> None: def setAuthor(self, value: str | None) -> None:
"""Set the author value.""" """Set the author value."""
if value != self._title: if value != self._author:
self._author = simplified(str(value or "")) self._author = simplified(str(value or ""))
self._project.setProjectChanged(True) self._project.setProjectChanged(True)
return return
+3 -5
View File
@@ -46,7 +46,7 @@ if TYPE_CHECKING: # pragma: no cover
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
FILE_VERSION = "1.5" # The current project file format version FILE_VERSION = "1.5" # The current project file format version
FILE_REVISION = "1" # The current project file format revision FILE_REVISION = "2" # The current project file format revision
HEX_VERSION = 0x0105 HEX_VERSION = 0x0105
NUM_VERSION = { NUM_VERSION = {
@@ -106,7 +106,8 @@ class ProjectXMLReader:
the project or the content into their respective section nodes the project or the content into their respective section nodes
as attributes. The id attribute was also added to the project. as attributes. The id attribute was also added to the project.
Rev 1: Drops the titleFormat section of settings. Rev 1: Drops the "titleFormat" section from "settings".
Rev 2: Drop the "title" setting from "project".
""" """
def __init__(self, path: str | Path) -> None: def __init__(self, path: str | Path) -> None:
@@ -247,8 +248,6 @@ class ProjectXMLReader:
for xItem in xSection: for xItem in xSection:
if xItem.tag == "name": if xItem.tag == "name":
data.setName(xItem.text) data.setName(xItem.text)
elif xItem.tag == "title":
data.setTitle(xItem.text)
elif xItem.tag == "author": elif xItem.tag == "author":
data.setAuthor(xItem.text) data.setAuthor(xItem.text)
else: else:
@@ -520,7 +519,6 @@ class ProjectXMLWriter:
xProject = ET.SubElement(xRoot, "project", attrib=projAttr) xProject = ET.SubElement(xRoot, "project", attrib=projAttr)
self._packSingleValue(xProject, "name", data.name) self._packSingleValue(xProject, "name", data.name)
self._packSingleValue(xProject, "title", data.title)
self._packSingleValue(xProject, "author", data.author) self._packSingleValue(xProject, "author", data.author)
# Save Project Settings # Save Project Settings
-1
View File
@@ -338,7 +338,6 @@ class ToHtml(Tokenizer):
data = { data = {
"meta": { "meta": {
"projectName": self._project.data.name, "projectName": self._project.data.name,
"novelTitle": self._project.data.title,
"novelAuthor": self._project.data.author, "novelAuthor": self._project.data.author,
"buildTime": int(timeStamp), "buildTime": int(timeStamp),
"buildTimeStr": formatTimeStamp(timeStamp), "buildTimeStr": formatTimeStamp(timeStamp),
-1
View File
@@ -759,7 +759,6 @@ class Tokenizer(ABC):
data = { data = {
"meta": { "meta": {
"projectName": self._project.data.name, "projectName": self._project.data.name,
"novelTitle": self._project.data.title,
"novelAuthor": self._project.data.author, "novelAuthor": self._project.data.author,
"buildTime": int(timeStamp), "buildTime": int(timeStamp),
"buildTimeStr": formatTimeStamp(timeStamp), "buildTimeStr": formatTimeStamp(timeStamp),
+2 -4
View File
@@ -283,9 +283,7 @@ class ToOdt(Tokenizer):
# =============== # ===============
if self._headerText == "": if self._headerText == "":
theTitle = self._project.data.title or self._project.data.name self._headerText = f"{self._project.data.name} / {self._project.data.author} /"
theAuth = self._project.data.author
self._headerText = f"{theTitle} / {theAuth} /"
# Create Roots # Create Roots
# ============ # ============
@@ -373,7 +371,7 @@ class ToOdt(Tokenizer):
# Dublin Core Meta Data # Dublin Core Meta Data
xMeta = ET.SubElement(self._xMeta, _mkTag("dc", "title")) xMeta = ET.SubElement(self._xMeta, _mkTag("dc", "title"))
xMeta.text = self._project.data.title or self._project.data.name xMeta.text = self._project.data.name
xMeta = ET.SubElement(self._xMeta, _mkTag("dc", "date")) xMeta = ET.SubElement(self._xMeta, _mkTag("dc", "date"))
xMeta.text = timeStamp xMeta.text = timeStamp
-1
View File
@@ -179,7 +179,6 @@ def buildTestProject(obj: object, projPath: Path) -> None:
project.data.setUuid("d0f3fe10-c6e6-4310-8bfd-181eb4224eed") project.data.setUuid("d0f3fe10-c6e6-4310-8bfd-181eb4224eed")
project.data.setName("New Project") project.data.setName("New Project")
project.data.setTitle("New Novel")
project.data.setAuthor("Jane Doe") project.data.setAuthor("Jane Doe")
# Creating a minimal project with a few root folders and a # Creating a minimal project with a few root folders and a