Count words when saving editor text
This commit is contained in:
@@ -360,9 +360,14 @@ class GuiDocEditor(QTextEdit):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
docText = self.getText()
|
docText = self.getText()
|
||||||
|
|
||||||
|
cC, wC, pC = countWords(docText)
|
||||||
|
self._updateCounts(cC, wC, pC)
|
||||||
|
|
||||||
theItem.setCharCount(self.charCount)
|
theItem.setCharCount(self.charCount)
|
||||||
theItem.setWordCount(self.wordCount)
|
theItem.setWordCount(self.wordCount)
|
||||||
theItem.setParaCount(self.paraCount)
|
theItem.setParaCount(self.paraCount)
|
||||||
|
|
||||||
self.saveCursorPosition()
|
self.saveCursorPosition()
|
||||||
self.nwDocument.saveDocument(docText)
|
self.nwDocument.saveDocument(docText)
|
||||||
self.setDocumentChanged(False)
|
self.setDocumentChanged(False)
|
||||||
|
|||||||
+2
-1
@@ -241,7 +241,8 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
# Add the new item to the tree
|
# Add the new item to the tree
|
||||||
if tHandle is not None:
|
if tHandle is not None:
|
||||||
self.revealNewTreeItem(tHandle, nHandle)
|
self.revealNewTreeItem(tHandle, nHandle)
|
||||||
self.theParent.editItem(tHandle)
|
if self.mainConf.showGUI:
|
||||||
|
self.theParent.editItem(tHandle)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user