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") logger.error("Invalid call to buildProject function")
return False return False
path = data.get("path", None) path = data.get("path", None) or None
if path is None: if isinstance(path, (str, Path)):
SHARED.error("A project path is required.") self._path = Path(path).resolve()
return False 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): SHARED.error("A project path is required.")
self._path = path
return self._extractSampleProject(path)
elif data.get("template"):
pass
else:
self._buildAndPopulate(path, data)
return True return False
## ##
# Internal Functions # Internal Functions
@@ -475,7 +474,6 @@ class ProjectBuilder:
"Failed to create a new example project." "Failed to create a new example project."
), exc=exc) ), exc=exc)
return False return False
else: else:
SHARED.error(self.tr( SHARED.error(self.tr(
"Failed to create a new example project. " "Failed to create a new example project. "
+1 -1
View File
@@ -175,7 +175,7 @@ class GuiWelcome(QDialog):
@pyqtSlot() @pyqtSlot()
@pyqtSlot(Path) @pyqtSlot(Path)
def _setProjectPath(self, path: Path | None = None) -> None: 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): if isinstance(path, Path):
self.openProjectRequest.emit(path) self.openProjectRequest.emit(path)
self.close() self.close()