From 11d0462c7af77281dd02106c46fb229d24626337 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Mon, 7 Oct 2019 10:44:30 +0200 Subject: [PATCH] Fix recent files python function calls --- cura/CuraApplication.py | 1 + .../OpenFilesIncludingProjectsDialog.qml | 2 +- resources/qml/Menus/RecentFilesMenu.qml | 36 +------------------ 3 files changed, 3 insertions(+), 36 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 93695b1d63..1fd62994fd 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1601,6 +1601,7 @@ class CuraApplication(QtApplication): openProjectFile = pyqtSignal(QUrl, arguments = ["project_file"]) # Emitted when a project file is about to open. @pyqtSlot(QUrl, str) + @pyqtSlot(QUrl) ## Open a local file # \param project_mode How to handle project files. Either None(default): Follow user preference, "open_as_model" or # "open_as_project". This parameter is only considered if the file is a project file. diff --git a/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml index 0df914805a..187578f12c 100644 --- a/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml +++ b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml @@ -42,7 +42,7 @@ UM.Dialog { for (var i in fileUrls) { - CuraApplication.readLocalFile(fileUrls[i], true); + CuraApplication.readLocalFile(fileUrls[i], "open_as_model"); } var meshName = backgroundItem.getMeshName(fileUrls[0].toString()); diff --git a/resources/qml/Menus/RecentFilesMenu.qml b/resources/qml/Menus/RecentFilesMenu.qml index 0f1f67b6fa..b788b5e72e 100644 --- a/resources/qml/Menus/RecentFilesMenu.qml +++ b/resources/qml/Menus/RecentFilesMenu.qml @@ -29,42 +29,8 @@ Menu } onTriggered: { - var toShowDialog = false; - var toOpenAsProject = false; - var toOpenAsModel = false; + CuraApplication.readLocalFile(modelData); - if (CuraApplication.checkIsValidProjectFile(modelData)) { - // check preference - var choice = UM.Preferences.getValue("cura/choice_on_open_project"); - - if (choice == "open_as_project") - { - toOpenAsProject = true; - }else if (choice == "open_as_model"){ - toOpenAsModel = true; - }else{ - toShowDialog = true; - } - } - else { - toOpenAsModel = true; - } - - if (toShowDialog) { - askOpenAsProjectOrModelsDialog.fileUrl = modelData; - askOpenAsProjectOrModelsDialog.show(); - return; - } - - // open file in the prefered way - if (toOpenAsProject) - { - UM.WorkspaceFileHandler.readLocalFile(modelData); - } - else if (toOpenAsModel) - { - CuraApplication.readLocalFile(modelData, true); - } var meshName = backgroundItem.getMeshName(modelData.toString()) backgroundItem.hasMesh(decodeURIComponent(meshName)) }