mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 14:55:03 -06:00
Also asks when opening a recent project file
CURA-3495
This commit is contained in:
parent
9e5513ade6
commit
2d48809214
1 changed files with 38 additions and 3 deletions
|
@ -4,7 +4,7 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import UM 1.3 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Menu
|
||||
|
@ -25,8 +25,38 @@ Menu
|
|||
var path = modelData.toString()
|
||||
return (index + 1) + ". " + path.slice(path.lastIndexOf("/") + 1);
|
||||
}
|
||||
onTriggered: {
|
||||
Printer.readLocalFile(modelData);
|
||||
onTriggered:
|
||||
{
|
||||
var toShowDialog = false;
|
||||
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)
|
||||
Printer.readLocalFile(modelData);
|
||||
var meshName = backgroundItem.getMeshName(modelData.toString())
|
||||
backgroundItem.hasMesh(decodeURIComponent(meshName))
|
||||
}
|
||||
|
@ -34,4 +64,9 @@ Menu
|
|||
onObjectAdded: menu.insertItem(index, object)
|
||||
onObjectRemoved: menu.removeItem(object)
|
||||
}
|
||||
|
||||
Cura.AskOpenAsProjectOrModelsDialog
|
||||
{
|
||||
id: askOpenAsProjectOrModelsDialog
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue