Add test for new project creation path

This commit is contained in:
Veronica Berglyd Olsen
2024-02-03 15:34:08 +01:00
parent a11657c145
commit d5064a8333
3 changed files with 94 additions and 10 deletions
+2 -2
View File
@@ -477,9 +477,9 @@ class ProjectBuilder:
dstPath = path.resolve()
srcCont = srcPath / "content"
dstCont = dstPath / "content"
dstPath.mkdir(exist_ok=True)
dstCont.mkdir(exist_ok=True)
try:
dstPath.mkdir(exist_ok=True)
dstCont.mkdir(exist_ok=True)
if is_zipfile(source):
with ZipFile(source) as zipObj:
for member in zipObj.namelist():
+3 -6
View File
@@ -221,12 +221,9 @@ class SharedData(QObject):
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."""
if allowZip:
label = self.tr("novelWriter Project File or Zip")
ext = f"{nwFiles.PROJ_FILE} *.zip"
else:
label = self.tr("novelWriter Project File")
ext = nwFiles.PROJ_FILE
label = (self.tr("novelWriter Project File or Zip")
if allowZip else self.tr("novelWriter Project File"))
ext = f"{nwFiles.PROJ_FILE} *.zip" if allowZip else nwFiles.PROJ_FILE
selected, _ = QFileDialog.getOpenFileName(
parent, self.tr("Open Project"), str(path or ""), filter=";;".join(
[f"{label} ({ext})", "{0} (*)".format(self.tr("All Files"))]