Add some fixes to keep novel tree active handle up to date

This commit is contained in:
Veronica Berglyd Olsen
2022-06-15 19:47:04 +02:00
parent 469275eea5
commit bb85232ea7
2 changed files with 13 additions and 3 deletions
+4 -3
View File
@@ -558,7 +558,7 @@ class GuiMain(QMainWindow):
# Document Actions
##
def closeDocument(self):
def closeDocument(self, beforeOpen=False):
"""Close the document and clear the editor and title field.
"""
if not self.hasProject:
@@ -573,7 +573,8 @@ class GuiMain(QMainWindow):
if self.docEditor.docChanged():
self.saveDocument()
self.docEditor.clearEditor()
self.novelView.setActiveHandle(None)
if not beforeOpen:
self.novelView.setActiveHandle(None)
return True
@@ -588,7 +589,7 @@ class GuiMain(QMainWindow):
logger.debug("Requested item '%s' is not a document", tHandle)
return False
self.closeDocument()
self.closeDocument(beforeOpen=True)
self._changeView(nwView.EDITOR)
if self.docEditor.loadText(tHandle, tLine):
if changeFocus: