Add coverage of some missed lines
This commit is contained in:
@@ -333,7 +333,8 @@ class ProjectBuilder:
|
||||
self._path = Path(path).resolve()
|
||||
if data.get("sample", False):
|
||||
return self._extractSampleProject(self._path)
|
||||
elif data.get("template"):
|
||||
elif data.get("template"): # pragma: no cover
|
||||
# Not implemented yet
|
||||
return True
|
||||
else:
|
||||
return self._buildAndPopulate(self._path, data)
|
||||
|
||||
@@ -216,16 +216,17 @@ class SharedData(QObject):
|
||||
QThreadPool.globalInstance().start(runnable, priority=priority)
|
||||
return
|
||||
|
||||
def getProjectPath(self, parent: QWidget, allowZip: bool = False) -> Path | None:
|
||||
def getProjectPath(self, parent: QWidget, path: str | Path | None = None,
|
||||
allowZip: bool = False) -> Path | None:
|
||||
"""Open the file dialog and select a novelWriter project file."""
|
||||
ext = []
|
||||
ext.append(self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE))
|
||||
ext = [
|
||||
self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE),
|
||||
self.tr("All files ({0})").format("*"),
|
||||
]
|
||||
if allowZip:
|
||||
ext.append(self.tr("Zip Archives ({0})").format("*.zip"))
|
||||
ext.append(self.tr("All files ({0})").format("*"))
|
||||
|
||||
ext.insert(1, self.tr("Zip Archives ({0})").format("*.zip"))
|
||||
projFile, _ = QFileDialog.getOpenFileName(
|
||||
parent, self.tr("Open Project"), "", filter=";;".join(ext)
|
||||
parent, self.tr("Open Project"), str(path or ""), filter=";;".join(ext)
|
||||
)
|
||||
return Path(projFile) if projFile else None
|
||||
|
||||
|
||||
@@ -189,7 +189,8 @@ class GuiWelcome(QDialog):
|
||||
@pyqtSlot()
|
||||
def _browseForProject(self) -> None:
|
||||
"""Browse for a project to open."""
|
||||
if path := SHARED.getProjectPath(self, allowZip=False):
|
||||
if path := SHARED.getProjectPath(self, path=CONFIG.lastPath(), allowZip=False):
|
||||
CONFIG.setLastPath(path)
|
||||
self._openProjectPath(path)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user