Merge branch 'release' into dev
This commit is contained in:
+33
-1
@@ -75,12 +75,14 @@ class GuiDocEditor(QTextEdit):
|
||||
self.mainConf = nw.CONFIG
|
||||
self.theParent = theParent
|
||||
self.theTheme = theParent.theTheme
|
||||
self.theIndex = theParent.theIndex
|
||||
self.theProject = theParent.theProject
|
||||
self.nwDocument = NWDoc(self.theProject, self.theParent)
|
||||
|
||||
self.docChanged = False # Flag for changed status of document
|
||||
self.spellCheck = False # Flag for spell checking enabled
|
||||
self.theHandle = None # The handle of the open file
|
||||
self.theHeaders = [] # Record of headers in the file
|
||||
self.theDict = None # The current spell check dictionary
|
||||
self.nonWord = "\"'" # Characters to not include in spell checking
|
||||
|
||||
@@ -342,6 +344,7 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
self.docFooter.updateLineCount()
|
||||
self.lengthLast = self.qDocument.characterCount()
|
||||
self.theHeaders = self.theIndex.getHandleHeaders(self.theHandle)
|
||||
|
||||
qApp.processEvents()
|
||||
self.setDocumentChanged(False)
|
||||
@@ -411,7 +414,7 @@ class GuiDocEditor(QTextEdit):
|
||||
self.nwDocument.saveDocument(docText)
|
||||
self.setDocumentChanged(False)
|
||||
|
||||
self.theParent.theIndex.scanText(tHandle, docText)
|
||||
self.theIndex.scanText(tHandle, docText)
|
||||
|
||||
hLevel, _ = self.theParent.theIndex.getFirstTitle(tHandle)
|
||||
if self.theProject.projTree.updateItemLayout(tHandle, hLevel):
|
||||
@@ -419,6 +422,11 @@ class GuiDocEditor(QTextEdit):
|
||||
self.nwDocument.saveDocument(docText)
|
||||
self.docFooter.updateInfo()
|
||||
|
||||
if self._updateHeaders(checkLevel=True):
|
||||
self.theParent.novelView.refreshTree()
|
||||
else:
|
||||
self.theParent.novelView.updateWordCounts(tHandle)
|
||||
|
||||
return True
|
||||
|
||||
def updateDocMargins(self):
|
||||
@@ -1230,6 +1238,30 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
return
|
||||
|
||||
def _updateHeaders(self, checkPos=False, checkLevel=False):
|
||||
"""Update the headers record and return True if anything
|
||||
changed, if a check flag was provided.
|
||||
"""
|
||||
if self.theHandle is None:
|
||||
return False
|
||||
|
||||
newHeaders = self.theIndex.getHandleHeaders(self.theHandle)
|
||||
if checkPos:
|
||||
newPos = [x[0] for x in newHeaders]
|
||||
oldPos = [x[0] for x in self.theHeaders]
|
||||
if checkLevel:
|
||||
newLev = [x[1] for x in newHeaders]
|
||||
oldLev = [x[1] for x in self.theHeaders]
|
||||
|
||||
self.theHeaders = newHeaders
|
||||
|
||||
if checkPos:
|
||||
return newPos != oldPos
|
||||
if checkLevel:
|
||||
return newLev != oldLev
|
||||
|
||||
return False
|
||||
|
||||
def _replaceQuotes(self, sQuote, oQuote, cQuote):
|
||||
"""Replace all straight quotes in the selected text.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user