Merge branch 'main' into update_i18n
This commit is contained in:
@@ -6,6 +6,7 @@ A collection of tools to create and manipulate documents
|
||||
File History:
|
||||
Created: 2022-10-02 [2.0rc1] DocMerger
|
||||
Created: 2022-10-11 [2.0rc1] DocSplitter
|
||||
Created: 2022-11-03 [2.0rc2] ProjectBuilder
|
||||
|
||||
This file is a part of novelWriter
|
||||
Copyright 2018–2023, Veronica Berglyd Olsen
|
||||
|
||||
+22
-13
@@ -49,15 +49,24 @@ class NWIndex:
|
||||
contains the data that isn't stored in the project items themselves.
|
||||
The content of the index is updated every time a file item is saved.
|
||||
|
||||
The primary index data is contained in the ItemIndex class, which
|
||||
contains an IndexItem representing each NWItem. Each IndexItem holds
|
||||
an IndexHeading object for each heading of the item's text.
|
||||
Some information needed by the NWItem object of a project item can
|
||||
only be known after a text file has been scanned by the indexer, so
|
||||
this data is set directly by the indexer class in the NWItem object.
|
||||
|
||||
A reverse index of all tags is contained in the TagsIndex class.
|
||||
This is duplicate information used for quicker lookups from the tags
|
||||
and back to items where they are defined.
|
||||
The primary index data is contained in a single instance of the
|
||||
ItemIndex class. This object contains an IndexItem representing each
|
||||
NWItem of the project. Each IndexItem holds an IndexHeading object
|
||||
for each heading of the item's text.
|
||||
|
||||
The index data is cached in a JSON file between writing sessions.
|
||||
A reverse index of all tags is contained in a single instance of the
|
||||
TagsIndex class. This is duplicate information used for quicker
|
||||
lookups from the tags and back to items where they are defined.
|
||||
|
||||
The index data is cached in a JSON file between writing sessions in
|
||||
order to save startup time. The cached index is validated on input,
|
||||
and a broken flag set if it is not valid. If it is invalid, the
|
||||
loaded data is cleared and it is up to the calling code to initiate
|
||||
a rebuild of the index data.
|
||||
"""
|
||||
|
||||
def __init__(self, project):
|
||||
@@ -283,10 +292,10 @@ class NWIndex:
|
||||
def _scanActive(self, tHandle, theItem, theText, itemTags):
|
||||
"""Scan an active document for meta data.
|
||||
"""
|
||||
nTitle = 0 # Line Number of the previous title
|
||||
cTitle = TT_NONE # Tag of the current title
|
||||
pTitle = TT_NONE # Tag of the previous title
|
||||
firstHeader = True # First header has been seen
|
||||
nTitle = 0 # Line Number of the previous title
|
||||
cTitle = TT_NONE # Tag of the current title
|
||||
pTitle = TT_NONE # Tag of the previous title
|
||||
canSetHeader = True # First header has not yet been set
|
||||
|
||||
theLines = theText.splitlines()
|
||||
for nLine, aLine in enumerate(theLines, start=1):
|
||||
@@ -299,9 +308,9 @@ class NWIndex:
|
||||
if hDepth == "H0":
|
||||
continue
|
||||
|
||||
if firstHeader:
|
||||
if canSetHeader:
|
||||
theItem.setMainHeading(hDepth)
|
||||
firstHeader = False
|
||||
canSetHeader = False
|
||||
|
||||
cTitle = self._itemIndex.addItemHeading(tHandle, nLine, hDepth, hText)
|
||||
if cTitle != TT_NONE:
|
||||
|
||||
@@ -161,7 +161,7 @@ class GuiMain(QMainWindow):
|
||||
self.splitDocs.setOpaqueResize(False)
|
||||
self.splitDocs.setHandleWidth(hWd)
|
||||
|
||||
# Splitter : Project Tree / Main Tabs
|
||||
# Splitter : Project Tree / Document Area
|
||||
self.splitMain = QSplitter(Qt.Horizontal)
|
||||
self.splitMain.setContentsMargins(0, 0, 0, 0)
|
||||
self.splitMain.addWidget(self.treePane)
|
||||
@@ -184,7 +184,7 @@ class GuiMain(QMainWindow):
|
||||
self.idxViewDoc = self.splitView.indexOf(self.docViewer)
|
||||
self.idxViewMeta = self.splitView.indexOf(self.viewMeta)
|
||||
|
||||
# Indices of Tab Widgets
|
||||
# Indices of Stack Widgets
|
||||
self.idxEditorView = self.mainStack.indexOf(self.splitMain)
|
||||
self.idxOutlineView = self.mainStack.indexOf(self.outlineView)
|
||||
self.idxProjView = self.projStack.indexOf(self.projView)
|
||||
@@ -198,6 +198,9 @@ class GuiMain(QMainWindow):
|
||||
self.splitView.setCollapsible(self.idxViewDoc, False)
|
||||
self.splitView.setCollapsible(self.idxViewMeta, False)
|
||||
|
||||
self.splitMain.setStretchFactor(self.idxTree, 0)
|
||||
self.splitMain.setStretchFactor(self.idxMain, 1)
|
||||
|
||||
# Editor / Viewer Default State
|
||||
self.splitView.setVisible(False)
|
||||
self.docEditor.closeSearch()
|
||||
|
||||
@@ -682,7 +682,7 @@ class GuiBuildNovel(QDialog):
|
||||
return
|
||||
|
||||
def _doBuild(self, bldObj, isPreview=False, doConvert=True):
|
||||
"""Rund the build with a specific build object.
|
||||
"""Run the build with a specific build object.
|
||||
"""
|
||||
tStart = int(time())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user