From 95f4515e93144e5a1c23f9773a2d58b69fcdd0ab Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 10 Apr 2018 11:40:22 +0200 Subject: [PATCH] Make it possible to skip project file check in readLocalFile() CURA-5203 --- cura/CuraApplication.py | 6 +++--- resources/qml/AskOpenAsProjectOrModelsDialog.qml | 2 +- resources/qml/Menus/RecentFilesMenu.qml | 2 +- resources/qml/OpenFilesIncludingProjectsDialog.qml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 205f918ec4..6e07e35ad9 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1557,8 +1557,8 @@ class CuraApplication(QtApplication): openProjectFile = pyqtSignal(QUrl, arguments = ["project_file"]) # Emitted when a project file is about to open. - @pyqtSlot(QUrl) - def readLocalFile(self, file): + @pyqtSlot(QUrl, bool) + def readLocalFile(self, file, skip_project_file_check = False): if not file.isValid(): return @@ -1569,7 +1569,7 @@ class CuraApplication(QtApplication): self.deleteAll() break - if self.checkIsValidProjectFile(file): + if not skip_project_file_check and self.checkIsValidProjectFile(file): self.callLater(self.openProjectFile.emit, file) return diff --git a/resources/qml/AskOpenAsProjectOrModelsDialog.qml b/resources/qml/AskOpenAsProjectOrModelsDialog.qml index bd37d1acdb..6b1856723b 100644 --- a/resources/qml/AskOpenAsProjectOrModelsDialog.qml +++ b/resources/qml/AskOpenAsProjectOrModelsDialog.qml @@ -53,7 +53,7 @@ UM.Dialog UM.Preferences.setValue("cura/choice_on_open_project", "open_as_model") } - CuraApplication.readLocalFile(base.fileUrl) + CuraApplication.readLocalFile(base.fileUrl, true) var meshName = backgroundItem.getMeshName(base.fileUrl.toString()) backgroundItem.hasMesh(decodeURIComponent(meshName)) diff --git a/resources/qml/Menus/RecentFilesMenu.qml b/resources/qml/Menus/RecentFilesMenu.qml index 579eb24344..12f53fb517 100644 --- a/resources/qml/Menus/RecentFilesMenu.qml +++ b/resources/qml/Menus/RecentFilesMenu.qml @@ -61,7 +61,7 @@ Menu } else if (toOpenAsModel) { - CuraApplication.readLocalFile(modelData); + CuraApplication.readLocalFile(modelData, true); } var meshName = backgroundItem.getMeshName(modelData.toString()) backgroundItem.hasMesh(decodeURIComponent(meshName)) diff --git a/resources/qml/OpenFilesIncludingProjectsDialog.qml b/resources/qml/OpenFilesIncludingProjectsDialog.qml index af8fb9e05f..3dcd4b6236 100644 --- a/resources/qml/OpenFilesIncludingProjectsDialog.qml +++ b/resources/qml/OpenFilesIncludingProjectsDialog.qml @@ -42,7 +42,7 @@ UM.Dialog { for (var i in fileUrls) { - CuraApplication.readLocalFile(fileUrls[i]); + CuraApplication.readLocalFile(fileUrls[i], true); } var meshName = backgroundItem.getMeshName(fileUrls[0].toString());