Make sure document edit status is not set on non-text changes
This commit is contained in:
+10
-2
@@ -316,7 +316,6 @@ class GuiDocEditor(QTextEdit):
|
|||||||
self.lastEdit = time()
|
self.lastEdit = time()
|
||||||
self._runCounter()
|
self._runCounter()
|
||||||
self.wcTimer.start()
|
self.wcTimer.start()
|
||||||
self.setDocumentChanged(False)
|
|
||||||
self.theHandle = tHandle
|
self.theHandle = tHandle
|
||||||
|
|
||||||
self.setReadOnly(False)
|
self.setReadOnly(False)
|
||||||
@@ -341,6 +340,9 @@ class GuiDocEditor(QTextEdit):
|
|||||||
self.docFooter.updateLineCount()
|
self.docFooter.updateLineCount()
|
||||||
self.lengthLast = self.qDocument.characterCount()
|
self.lengthLast = self.qDocument.characterCount()
|
||||||
|
|
||||||
|
qApp.processEvents()
|
||||||
|
self.setDocumentChanged(False)
|
||||||
|
|
||||||
qApp.restoreOverrideCursor()
|
qApp.restoreOverrideCursor()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@@ -373,8 +375,8 @@ class GuiDocEditor(QTextEdit):
|
|||||||
|
|
||||||
qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
|
qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||||
self.setPlainText(theText)
|
self.setPlainText(theText)
|
||||||
self.setDocumentChanged(True)
|
|
||||||
self.updateDocMargins()
|
self.updateDocMargins()
|
||||||
|
self.setDocumentChanged(True)
|
||||||
qApp.restoreOverrideCursor()
|
qApp.restoreOverrideCursor()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@@ -450,11 +452,17 @@ class GuiDocEditor(QTextEdit):
|
|||||||
lM = max(cM, fH)
|
lM = max(cM, fH)
|
||||||
self.setViewportMargins(tM, uM, tM, lM)
|
self.setViewportMargins(tM, uM, tM, lM)
|
||||||
|
|
||||||
|
docChanged = self.docChanged
|
||||||
if self.mainConf.scrollPastEnd:
|
if self.mainConf.scrollPastEnd:
|
||||||
docFrame = self.qDocument.rootFrame().frameFormat()
|
docFrame = self.qDocument.rootFrame().frameFormat()
|
||||||
docFrame.setBottomMargin(max(0, 0.6*(wH - uM - lM - 4*tB)))
|
docFrame.setBottomMargin(max(0, 0.6*(wH - uM - lM - 4*tB)))
|
||||||
self.qDocument.rootFrame().setFrameFormat(docFrame)
|
self.qDocument.rootFrame().setFrameFormat(docFrame)
|
||||||
|
|
||||||
|
# This is needed as the setFrameFormat function itself will
|
||||||
|
# trigger the contetsChanged signal which sets docChanged, so we
|
||||||
|
# set it back to whatever it was before.
|
||||||
|
self.setDocumentChanged(docChanged)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def updateDocInfo(self, tHandle):
|
def updateDocInfo(self, tHandle):
|
||||||
|
|||||||
@@ -432,6 +432,7 @@ class GuiMain(QMainWindow):
|
|||||||
# Restore previously open documents, if any
|
# Restore previously open documents, if any
|
||||||
if self.theProject.lastEdited is not None:
|
if self.theProject.lastEdited is not None:
|
||||||
self.openDocument(self.theProject.lastEdited, doScroll=True)
|
self.openDocument(self.theProject.lastEdited, doScroll=True)
|
||||||
|
|
||||||
if self.theProject.lastViewed is not None:
|
if self.theProject.lastViewed is not None:
|
||||||
self.viewDocument(self.theProject.lastViewed)
|
self.viewDocument(self.theProject.lastViewed)
|
||||||
|
|
||||||
@@ -439,6 +440,12 @@ class GuiMain(QMainWindow):
|
|||||||
if self.theIndex.indexBroken:
|
if self.theIndex.indexBroken:
|
||||||
self.rebuildIndex()
|
self.rebuildIndex()
|
||||||
|
|
||||||
|
# Make sure the changed status is set to false on all that was
|
||||||
|
# just opened
|
||||||
|
qApp.processEvents()
|
||||||
|
self.docEditor.setDocumentChanged(False)
|
||||||
|
self.theProject.setProjectChanged(False)
|
||||||
|
|
||||||
logger.debug("Project load complete")
|
logger.debug("Project load complete")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user