Merge branch 'dev' into project_details

This commit is contained in:
Veronica K. B. Olsen
2021-01-09 22:25:57 +01:00
10 changed files with 310 additions and 223 deletions
+11 -3
View File
@@ -47,7 +47,7 @@ from nw.gui import (
GuiProjectTree, GuiProjectWizard, GuiTheme, GuiWritingStats
)
from nw.core import NWProject, NWDoc, NWIndex
from nw.constants import nwItemType, nwItemClass, nwAlert, nwConst
from nw.constants import nwItemType, nwItemClass, nwAlert, nwLists
from nw.common import getGuiItem
logger = logging.getLogger(__name__)
@@ -446,10 +446,12 @@ class GuiMain(QMainWindow):
self.docEditor.setSpellCheck(self.theProject.spellCheck)
self.mainMenu.setAutoOutline(self.theProject.autoOutline)
self.statusBar.setRefTime(self.theProject.projOpened)
self.statusBar.setStats(self.theProject.currWCount, 0)
# Restore previously open documents, if any
if self.theProject.lastEdited is not None:
self.openDocument(self.theProject.lastEdited, doScroll=True)
if self.theProject.lastViewed is not None:
self.viewDocument(self.theProject.lastViewed)
@@ -457,6 +459,12 @@ class GuiMain(QMainWindow):
if self.theIndex.indexBroken:
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")
return True
@@ -477,7 +485,7 @@ class GuiMain(QMainWindow):
return False
self.treeView.saveTreeOrder()
self.theProject.saveProject(autoSave)
self.theProject.saveProject(autoSave=autoSave)
self.theIndex.saveIndex()
return True
@@ -743,7 +751,7 @@ class GuiMain(QMainWindow):
tItem = self.theProject.projTree[tHandle]
if tItem is None:
return
if tItem.itemType not in nwConst.REG_TYPES:
if tItem.itemType not in nwLists.REG_TYPES:
return
logger.verbose("Requesting change to item %s" % tHandle)