Fix recent files python function calls

This commit is contained in:
Nino van Hooff 2019-10-07 10:44:30 +02:00
parent 55fe4ee986
commit 11d0462c7a
3 changed files with 3 additions and 36 deletions

View file

@ -1601,6 +1601,7 @@ class CuraApplication(QtApplication):
openProjectFile = pyqtSignal(QUrl, arguments = ["project_file"]) # Emitted when a project file is about to open. openProjectFile = pyqtSignal(QUrl, arguments = ["project_file"]) # Emitted when a project file is about to open.
@pyqtSlot(QUrl, str) @pyqtSlot(QUrl, str)
@pyqtSlot(QUrl)
## Open a local file ## Open a local file
# \param project_mode How to handle project files. Either None(default): Follow user preference, "open_as_model" or # \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. # "open_as_project". This parameter is only considered if the file is a project file.

View file

@ -42,7 +42,7 @@ UM.Dialog
{ {
for (var i in fileUrls) for (var i in fileUrls)
{ {
CuraApplication.readLocalFile(fileUrls[i], true); CuraApplication.readLocalFile(fileUrls[i], "open_as_model");
} }
var meshName = backgroundItem.getMeshName(fileUrls[0].toString()); var meshName = backgroundItem.getMeshName(fileUrls[0].toString());

View file

@ -29,42 +29,8 @@ Menu
} }
onTriggered: onTriggered:
{ {
var toShowDialog = false; CuraApplication.readLocalFile(modelData);
var toOpenAsProject = false;
var toOpenAsModel = false;
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()) var meshName = backgroundItem.getMeshName(modelData.toString())
backgroundItem.hasMesh(decodeURIComponent(meshName)) backgroundItem.hasMesh(decodeURIComponent(meshName))
} }