Fix sample project creation

This commit is contained in:
Veronica Berglyd Olsen
2023-12-20 22:20:04 +01:00
parent 8b6691c056
commit ba538920aa
2 changed files with 12 additions and 14 deletions
+11 -13
View File
@@ -331,20 +331,19 @@ class ProjectBuilder:
logger.error("Invalid call to buildProject function")
return False
path = data.get("path", None)
if path is None:
SHARED.error("A project path is required.")
return False
path = data.get("path", None) or None
if isinstance(path, (str, Path)):
self._path = Path(path).resolve()
if data.get("sample", False):
return self._extractSampleProject(self._path)
elif data.get("template"):
return True
else:
return self._buildAndPopulate(self._path, data)
if data.get("sample", False):
self._path = path
return self._extractSampleProject(path)
elif data.get("template"):
pass
else:
self._buildAndPopulate(path, data)
SHARED.error("A project path is required.")
return True
return False
##
# Internal Functions
@@ -475,7 +474,6 @@ class ProjectBuilder:
"Failed to create a new example project."
), exc=exc)
return False
else:
SHARED.error(self.tr(
"Failed to create a new example project. "
+1 -1
View File
@@ -175,7 +175,7 @@ class GuiWelcome(QDialog):
@pyqtSlot()
@pyqtSlot(Path)
def _setProjectPath(self, path: Path | None = None) -> None:
"""Set the path variable for the project to open."""
"""Emit a project open signal."""
if isinstance(path, Path):
self.openProjectRequest.emit(path)
self.close()