diff --git a/novelwriter/core/project.py b/novelwriter/core/project.py index 403ed0f4..66f9617b 100644 --- a/novelwriter/core/project.py +++ b/novelwriter/core/project.py @@ -814,7 +814,7 @@ class NWProject: return True - def closeProject(self, idleTime=0): + def closeProject(self, idleTime=0.0): """Close the current project and clear all meta data. """ logger.info("Closing project: %s", self.projPath) diff --git a/novelwriter/error.py b/novelwriter/error.py index dd0156c8..855f3723 100644 --- a/novelwriter/error.py +++ b/novelwriter/error.py @@ -199,8 +199,8 @@ def exceptionHandler(exType, exValue, exTrace): try: # Try a controlled shutdown - nwGUI.closeProject(isYes=True) - nwGUI.closeMain() + nwGUI.closeProject(isYes=True) # type: ignore + nwGUI.closeMain() # type: ignore logger.info("Emergency shutdown successful") except Exception as exc: diff --git a/novelwriter/guimain.py b/novelwriter/guimain.py index 28b995af..fee7c7d6 100644 --- a/novelwriter/guimain.py +++ b/novelwriter/guimain.py @@ -626,7 +626,7 @@ class GuiMain(QMainWindow): fHandle = None # The first file handle we encounter foundIt = False # We've found tHandle, pick the next we see for tItem in self.theProject.tree: - if not self.theProject.tree.checkType(tItem.itemHandle, nwItemType.FILE): + if tItem is None or not tItem.isFileType(): continue if fHandle is None: fHandle = tItem.itemHandle @@ -950,6 +950,7 @@ class GuiMain(QMainWindow): dlgDetails = getGuiItem("GuiProjectDetails") if dlgDetails is None: dlgDetails = GuiProjectDetails(self) + assert isinstance(dlgDetails, GuiProjectDetails) dlgDetails.setModal(False) dlgDetails.show() @@ -968,6 +969,7 @@ class GuiMain(QMainWindow): dlgBuild = getGuiItem("GuiBuildNovel") if dlgBuild is None: dlgBuild = GuiBuildNovel(self) + assert isinstance(dlgBuild, GuiBuildNovel) dlgBuild.setModal(False) dlgBuild.show() @@ -987,6 +989,7 @@ class GuiMain(QMainWindow): dlgLipsum = getGuiItem("GuiLipsum") if dlgLipsum is None: dlgLipsum = GuiLipsum(self) + assert isinstance(dlgLipsum, GuiLipsum) dlgLipsum.setModal(False) dlgLipsum.show() @@ -1021,6 +1024,7 @@ class GuiMain(QMainWindow): dlgStats = getGuiItem("GuiWritingStats") if dlgStats is None: dlgStats = GuiWritingStats(self) + assert isinstance(dlgStats, GuiWritingStats) dlgStats.setModal(False) dlgStats.show() @@ -1036,6 +1040,7 @@ class GuiMain(QMainWindow): dlgAbout = getGuiItem("GuiAbout") if dlgAbout is None: dlgAbout = GuiAbout(self) + assert isinstance(dlgAbout, GuiAbout) dlgAbout.setModal(True) dlgAbout.show() @@ -1061,6 +1066,7 @@ class GuiMain(QMainWindow): dlgUpdate = getGuiItem("GuiUpdates") if dlgUpdate is None: dlgUpdate = GuiUpdates(self) + assert isinstance(dlgUpdate, GuiUpdates) dlgUpdate.setModal(True) dlgUpdate.show()