mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 19:28:07 -06:00
Fix recent files python function calls
This commit is contained in:
parent
55fe4ee986
commit
11d0462c7a
3 changed files with 3 additions and 36 deletions
|
@ -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.
|
||||||
|
|
|
@ -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());
|
||||||
|
|
|
@ -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))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue