Drop the Novel Title data from the project and code
This commit is contained in:
@@ -374,7 +374,6 @@ class ProjectBuilder:
|
||||
|
||||
project.data.setUuid(None)
|
||||
project.data.setName(projName)
|
||||
project.data.setTitle(projName)
|
||||
project.data.setAuthor(projAuthor)
|
||||
project.data.setLanguage(projLang)
|
||||
project.setDefaultStatusImport()
|
||||
@@ -383,7 +382,7 @@ class ProjectBuilder:
|
||||
# Add Root Folders
|
||||
hNovelRoot = project.newRoot(nwItemClass.NOVEL)
|
||||
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"
|
||||
if project.data.author:
|
||||
|
||||
@@ -53,7 +53,6 @@ class NWProjectData:
|
||||
# Project Meta
|
||||
self._uuid = ""
|
||||
self._name = ""
|
||||
self._title = ""
|
||||
self._author = ""
|
||||
self._saveCount = 0
|
||||
self._autoCount = 0
|
||||
@@ -102,11 +101,6 @@ class NWProjectData:
|
||||
"""Return the project name."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def title(self) -> str:
|
||||
"""Return the project title."""
|
||||
return self._title
|
||||
|
||||
@property
|
||||
def author(self) -> str:
|
||||
"""Return the project author."""
|
||||
@@ -228,16 +222,9 @@ class NWProjectData:
|
||||
self._project.setProjectChanged(True)
|
||||
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:
|
||||
"""Set the author value."""
|
||||
if value != self._title:
|
||||
if value != self._author:
|
||||
self._author = simplified(str(value or ""))
|
||||
self._project.setProjectChanged(True)
|
||||
return
|
||||
|
||||
@@ -46,7 +46,7 @@ if TYPE_CHECKING: # pragma: no cover
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
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
|
||||
|
||||
NUM_VERSION = {
|
||||
@@ -106,7 +106,8 @@ class ProjectXMLReader:
|
||||
the project or the content into their respective section nodes
|
||||
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:
|
||||
@@ -247,8 +248,6 @@ class ProjectXMLReader:
|
||||
for xItem in xSection:
|
||||
if xItem.tag == "name":
|
||||
data.setName(xItem.text)
|
||||
elif xItem.tag == "title":
|
||||
data.setTitle(xItem.text)
|
||||
elif xItem.tag == "author":
|
||||
data.setAuthor(xItem.text)
|
||||
else:
|
||||
@@ -520,7 +519,6 @@ class ProjectXMLWriter:
|
||||
|
||||
xProject = ET.SubElement(xRoot, "project", attrib=projAttr)
|
||||
self._packSingleValue(xProject, "name", data.name)
|
||||
self._packSingleValue(xProject, "title", data.title)
|
||||
self._packSingleValue(xProject, "author", data.author)
|
||||
|
||||
# Save Project Settings
|
||||
|
||||
@@ -338,7 +338,6 @@ class ToHtml(Tokenizer):
|
||||
data = {
|
||||
"meta": {
|
||||
"projectName": self._project.data.name,
|
||||
"novelTitle": self._project.data.title,
|
||||
"novelAuthor": self._project.data.author,
|
||||
"buildTime": int(timeStamp),
|
||||
"buildTimeStr": formatTimeStamp(timeStamp),
|
||||
|
||||
@@ -759,7 +759,6 @@ class Tokenizer(ABC):
|
||||
data = {
|
||||
"meta": {
|
||||
"projectName": self._project.data.name,
|
||||
"novelTitle": self._project.data.title,
|
||||
"novelAuthor": self._project.data.author,
|
||||
"buildTime": int(timeStamp),
|
||||
"buildTimeStr": formatTimeStamp(timeStamp),
|
||||
|
||||
@@ -283,9 +283,7 @@ class ToOdt(Tokenizer):
|
||||
# ===============
|
||||
|
||||
if self._headerText == "":
|
||||
theTitle = self._project.data.title or self._project.data.name
|
||||
theAuth = self._project.data.author
|
||||
self._headerText = f"{theTitle} / {theAuth} /"
|
||||
self._headerText = f"{self._project.data.name} / {self._project.data.author} /"
|
||||
|
||||
# Create Roots
|
||||
# ============
|
||||
@@ -373,7 +371,7 @@ class ToOdt(Tokenizer):
|
||||
|
||||
# Dublin Core Meta Data
|
||||
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.text = timeStamp
|
||||
|
||||
@@ -179,7 +179,6 @@ def buildTestProject(obj: object, projPath: Path) -> None:
|
||||
|
||||
project.data.setUuid("d0f3fe10-c6e6-4310-8bfd-181eb4224eed")
|
||||
project.data.setName("New Project")
|
||||
project.data.setTitle("New Novel")
|
||||
project.data.setAuthor("Jane Doe")
|
||||
|
||||
# Creating a minimal project with a few root folders and a
|
||||
|
||||
Reference in New Issue
Block a user