mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 10:47:49 -06:00
Refactoring; no longer use "Printer" to identify CuraApplication
This commit is contained in:
parent
e0c77231e0
commit
f82aecb7ca
14 changed files with 59 additions and 49 deletions
|
@ -351,7 +351,7 @@ Item
|
||||||
property bool roundValues: true
|
property bool roundValues: true
|
||||||
|
|
||||||
property var activeHandle: upperHandle
|
property var activeHandle: upperHandle
|
||||||
property bool layersVisible: UM.LayerView.layerActivity && Printer.platformActivity ? true : false
|
property bool layersVisible: UM.LayerView.layerActivity && CuraApplication.platformActivity ? true : false
|
||||||
|
|
||||||
function getUpperValueFromHandle()
|
function getUpperValueFromHandle()
|
||||||
{
|
{
|
||||||
|
|
|
@ -183,7 +183,7 @@ Item
|
||||||
enabled: UM.Controller.toolsEnabled;
|
enabled: UM.Controller.toolsEnabled;
|
||||||
iconName: "edit-delete";
|
iconName: "edit-delete";
|
||||||
shortcut: StandardKey.Delete;
|
shortcut: StandardKey.Delete;
|
||||||
onTriggered: Printer.deleteSelection();
|
onTriggered: CuraApplication.deleteSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action
|
Action
|
||||||
|
@ -207,7 +207,7 @@ Item
|
||||||
enabled: UM.Scene.numObjectsSelected > 1 ? true: false
|
enabled: UM.Scene.numObjectsSelected > 1 ? true: false
|
||||||
iconName: "object-group"
|
iconName: "object-group"
|
||||||
shortcut: "Ctrl+G";
|
shortcut: "Ctrl+G";
|
||||||
onTriggered: Printer.groupSelected();
|
onTriggered: CuraApplication.groupSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action
|
Action
|
||||||
|
@ -217,7 +217,7 @@ Item
|
||||||
enabled: UM.Scene.isGroupSelected
|
enabled: UM.Scene.isGroupSelected
|
||||||
iconName: "object-ungroup"
|
iconName: "object-ungroup"
|
||||||
shortcut: "Ctrl+Shift+G";
|
shortcut: "Ctrl+Shift+G";
|
||||||
onTriggered: Printer.ungroupSelected();
|
onTriggered: CuraApplication.ungroupSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action
|
Action
|
||||||
|
@ -227,7 +227,7 @@ Item
|
||||||
enabled: UM.Scene.numObjectsSelected > 1 ? true: false
|
enabled: UM.Scene.numObjectsSelected > 1 ? true: false
|
||||||
iconName: "merge";
|
iconName: "merge";
|
||||||
shortcut: "Ctrl+Alt+G";
|
shortcut: "Ctrl+Alt+G";
|
||||||
onTriggered: Printer.mergeSelected();
|
onTriggered: CuraApplication.mergeSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action
|
Action
|
||||||
|
@ -244,7 +244,7 @@ Item
|
||||||
enabled: UM.Controller.toolsEnabled;
|
enabled: UM.Controller.toolsEnabled;
|
||||||
iconName: "edit-select-all";
|
iconName: "edit-select-all";
|
||||||
shortcut: "Ctrl+A";
|
shortcut: "Ctrl+A";
|
||||||
onTriggered: Printer.selectAll();
|
onTriggered: CuraApplication.selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action
|
Action
|
||||||
|
@ -254,7 +254,7 @@ Item
|
||||||
enabled: UM.Controller.toolsEnabled;
|
enabled: UM.Controller.toolsEnabled;
|
||||||
iconName: "edit-delete";
|
iconName: "edit-delete";
|
||||||
shortcut: "Ctrl+D";
|
shortcut: "Ctrl+D";
|
||||||
onTriggered: Printer.deleteAll();
|
onTriggered: CuraApplication.deleteAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action
|
Action
|
||||||
|
@ -263,21 +263,21 @@ Item
|
||||||
text: catalog.i18nc("@action:inmenu menubar:file","Re&load All Models");
|
text: catalog.i18nc("@action:inmenu menubar:file","Re&load All Models");
|
||||||
iconName: "document-revert";
|
iconName: "document-revert";
|
||||||
shortcut: "F5"
|
shortcut: "F5"
|
||||||
onTriggered: Printer.reloadAll();
|
onTriggered: CuraApplication.reloadAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action
|
Action
|
||||||
{
|
{
|
||||||
id: resetAllTranslationAction;
|
id: resetAllTranslationAction;
|
||||||
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model Positions");
|
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model Positions");
|
||||||
onTriggered: Printer.resetAllTranslation();
|
onTriggered: CuraApplication.resetAllTranslation();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action
|
Action
|
||||||
{
|
{
|
||||||
id: resetAllAction;
|
id: resetAllAction;
|
||||||
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model &Transformations");
|
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model &Transformations");
|
||||||
onTriggered: Printer.resetAll();
|
onTriggered: CuraApplication.resetAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action
|
Action
|
||||||
|
|
|
@ -40,7 +40,9 @@ UM.Dialog
|
||||||
function loadModelFiles(fileUrls)
|
function loadModelFiles(fileUrls)
|
||||||
{
|
{
|
||||||
for (var i in fileUrls)
|
for (var i in fileUrls)
|
||||||
Printer.readLocalFile(fileUrls[i]);
|
{
|
||||||
|
CuraApplication.readLocalFile(fileUrls[i]);
|
||||||
|
}
|
||||||
|
|
||||||
var meshName = backgroundItem.getMeshName(fileUrls[0].toString());
|
var meshName = backgroundItem.getMeshName(fileUrls[0].toString());
|
||||||
backgroundItem.hasMesh(decodeURIComponent(meshName));
|
backgroundItem.hasMesh(decodeURIComponent(meshName));
|
||||||
|
|
|
@ -21,7 +21,7 @@ UM.MainWindow
|
||||||
property bool monitoringPrint: false
|
property bool monitoringPrint: false
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
Printer.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
|
CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
|
||||||
// Workaround silly issues with QML Action's shortcut property.
|
// Workaround silly issues with QML Action's shortcut property.
|
||||||
//
|
//
|
||||||
// Currently, there is no way to define shortcuts as "Application Shortcut".
|
// Currently, there is no way to define shortcuts as "Application Shortcut".
|
||||||
|
@ -502,7 +502,7 @@ UM.MainWindow
|
||||||
icon: StandardIcon.Question
|
icon: StandardIcon.Question
|
||||||
onYes:
|
onYes:
|
||||||
{
|
{
|
||||||
Printer.deleteAll();
|
CuraApplication.deleteAll();
|
||||||
Cura.Actions.resetProfile.trigger();
|
Cura.Actions.resetProfile.trigger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,7 +619,7 @@ UM.MainWindow
|
||||||
{
|
{
|
||||||
if(objectContextMenu.objectId != 0)
|
if(objectContextMenu.objectId != 0)
|
||||||
{
|
{
|
||||||
Printer.deleteObject(objectContextMenu.objectId);
|
CuraApplication.deleteObject(objectContextMenu.objectId);
|
||||||
objectContextMenu.objectId = 0;
|
objectContextMenu.objectId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -652,7 +652,7 @@ UM.MainWindow
|
||||||
{
|
{
|
||||||
if(objectContextMenu.objectId != 0)
|
if(objectContextMenu.objectId != 0)
|
||||||
{
|
{
|
||||||
Printer.centerObject(objectContextMenu.objectId);
|
CuraApplication.centerObject(objectContextMenu.objectId);
|
||||||
objectContextMenu.objectId = 0;
|
objectContextMenu.objectId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -898,14 +898,14 @@ UM.MainWindow
|
||||||
{
|
{
|
||||||
id: messageDialog
|
id: messageDialog
|
||||||
modality: Qt.ApplicationModal
|
modality: Qt.ApplicationModal
|
||||||
onAccepted: Printer.messageBoxClosed(clickedButton)
|
onAccepted: CuraApplication.messageBoxClosed(clickedButton)
|
||||||
onApply: Printer.messageBoxClosed(clickedButton)
|
onApply: CuraApplication.messageBoxClosed(clickedButton)
|
||||||
onDiscard: Printer.messageBoxClosed(clickedButton)
|
onDiscard: CuraApplication.messageBoxClosed(clickedButton)
|
||||||
onHelp: Printer.messageBoxClosed(clickedButton)
|
onHelp: CuraApplication.messageBoxClosed(clickedButton)
|
||||||
onNo: Printer.messageBoxClosed(clickedButton)
|
onNo: CuraApplication.messageBoxClosed(clickedButton)
|
||||||
onRejected: Printer.messageBoxClosed(clickedButton)
|
onRejected: CuraApplication.messageBoxClosed(clickedButton)
|
||||||
onReset: Printer.messageBoxClosed(clickedButton)
|
onReset: CuraApplication.messageBoxClosed(clickedButton)
|
||||||
onYes: Printer.messageBoxClosed(clickedButton)
|
onYes: CuraApplication.messageBoxClosed(clickedButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections
|
Connections
|
||||||
|
|
|
@ -190,7 +190,7 @@ UM.Dialog
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
Printer.discardOrKeepProfileChangesClosed("discard")
|
CuraApplication.discardOrKeepProfileChangesClosed("discard")
|
||||||
base.hide()
|
base.hide()
|
||||||
}
|
}
|
||||||
isDefault: true
|
isDefault: true
|
||||||
|
@ -204,7 +204,7 @@ UM.Dialog
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
Printer.discardOrKeepProfileChangesClosed("keep")
|
CuraApplication.discardOrKeepProfileChangesClosed("keep")
|
||||||
base.hide()
|
base.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ UM.Dialog
|
||||||
interval: 1000;
|
interval: 1000;
|
||||||
running: false;
|
running: false;
|
||||||
repeat: true;
|
repeat: true;
|
||||||
onTriggered: textArea.text = Printer.getEngineLog();
|
onTriggered: textArea.text = CuraApplication.getEngineLog();
|
||||||
}
|
}
|
||||||
UM.I18nCatalog{id: catalog; name:"cura"}
|
UM.I18nCatalog{id: catalog; name:"cura"}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ UM.Dialog
|
||||||
{
|
{
|
||||||
if(visible)
|
if(visible)
|
||||||
{
|
{
|
||||||
textArea.text = Printer.getEngineLog();
|
textArea.text = CuraApplication.getEngineLog();
|
||||||
updateTimer.start();
|
updateTimer.start();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ import Cura 1.0 as Cura
|
||||||
Item {
|
Item {
|
||||||
id: base
|
id: base
|
||||||
|
|
||||||
property bool activity: Printer.platformActivity
|
property bool activity: CuraApplication.platformActivity
|
||||||
property string fileBaseName
|
property string fileBaseName
|
||||||
property variant activeMachineName: Cura.MachineManager.activeMachineName
|
property variant activeMachineName: Cura.MachineManager.activeMachineName
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ Item {
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
font: UM.Theme.getFont("small")
|
font: UM.Theme.getFont("small")
|
||||||
color: UM.Theme.getColor("text_subtext")
|
color: UM.Theme.getColor("text_subtext")
|
||||||
text: Printer.getSceneBoundingBoxString
|
text: CuraApplication.getSceneBoundingBoxString
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
|
|
|
@ -13,11 +13,11 @@ Menu
|
||||||
title: catalog.i18nc("@title:menu menubar:file", "Open &Recent")
|
title: catalog.i18nc("@title:menu menubar:file", "Open &Recent")
|
||||||
iconName: "document-open-recent";
|
iconName: "document-open-recent";
|
||||||
|
|
||||||
enabled: Printer.recentFiles.length > 0;
|
enabled: CuraApplication.recentFiles.length > 0;
|
||||||
|
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
model: Printer.recentFiles
|
model: CuraApplication.recentFiles
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
text:
|
text:
|
||||||
|
@ -36,12 +36,14 @@ Menu
|
||||||
var choice = UM.Preferences.getValue("cura/choice_on_open_project");
|
var choice = UM.Preferences.getValue("cura/choice_on_open_project");
|
||||||
|
|
||||||
if (choice == "open_as_project")
|
if (choice == "open_as_project")
|
||||||
|
{
|
||||||
toOpenAsProject = true;
|
toOpenAsProject = true;
|
||||||
else if (choice == "open_as_model")
|
}else if (choice == "open_as_model"){
|
||||||
toOpenAsModel = true;
|
toOpenAsModel = true;
|
||||||
else
|
}else{
|
||||||
toShowDialog = true;
|
toShowDialog = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
toOpenAsModel = true;
|
toOpenAsModel = true;
|
||||||
}
|
}
|
||||||
|
@ -54,9 +56,13 @@ Menu
|
||||||
|
|
||||||
// open file in the prefered way
|
// open file in the prefered way
|
||||||
if (toOpenAsProject)
|
if (toOpenAsProject)
|
||||||
|
{
|
||||||
UM.WorkspaceFileHandler.readLocalFile(modelData);
|
UM.WorkspaceFileHandler.readLocalFile(modelData);
|
||||||
|
}
|
||||||
else if (toOpenAsModel)
|
else if (toOpenAsModel)
|
||||||
Printer.readLocalFile(modelData);
|
{
|
||||||
|
CuraApplication.readLocalFile(modelData);
|
||||||
|
}
|
||||||
var meshName = backgroundItem.getMeshName(modelData.toString())
|
var meshName = backgroundItem.getMeshName(modelData.toString())
|
||||||
backgroundItem.hasMesh(decodeURIComponent(meshName))
|
backgroundItem.hasMesh(decodeURIComponent(meshName))
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool activity: Printer.platformActivity;
|
property bool activity: CuraApplication.platformActivity;
|
||||||
property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
|
property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
|
||||||
property string fileBaseName
|
property string fileBaseName
|
||||||
property string statusText:
|
property string statusText:
|
||||||
|
@ -205,8 +205,8 @@ Item
|
||||||
onAdditionalComponentsChanged:
|
onAdditionalComponentsChanged:
|
||||||
{
|
{
|
||||||
if(areaId == "monitorButtons") {
|
if(areaId == "monitorButtons") {
|
||||||
for (var component in Printer.additionalComponents["monitorButtons"]) {
|
for (var component in CuraApplication.additionalComponents["monitorButtons"]) {
|
||||||
Printer.additionalComponents["monitorButtons"][component].parent = additionalComponentsRow
|
CuraApplication.additionalComponents["monitorButtons"][component].parent = additionalComponentsRow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ UM.Dialog
|
||||||
height: minimumHeight
|
height: minimumHeight
|
||||||
|
|
||||||
property var objectId: 0;
|
property var objectId: 0;
|
||||||
onAccepted: Printer.multiplyObject(base.objectId, parseInt(copiesField.text))
|
onAccepted: CuraApplication.multiplyObject(base.objectId, parseInt(copiesField.text))
|
||||||
|
|
||||||
property variant catalog: UM.I18nCatalog { name: "cura" }
|
property variant catalog: UM.I18nCatalog { name: "cura" }
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,9 @@ UM.Dialog
|
||||||
function loadModelFiles(fileUrls)
|
function loadModelFiles(fileUrls)
|
||||||
{
|
{
|
||||||
for (var i in fileUrls)
|
for (var i in fileUrls)
|
||||||
Printer.readLocalFile(fileUrls[i]);
|
{
|
||||||
|
CuraApplication.readLocalFile(fileUrls[i]);
|
||||||
|
}
|
||||||
|
|
||||||
var meshName = backgroundItem.getMeshName(fileUrls[0].toString());
|
var meshName = backgroundItem.getMeshName(fileUrls[0].toString());
|
||||||
backgroundItem.hasMesh(decodeURIComponent(meshName));
|
backgroundItem.hasMesh(decodeURIComponent(meshName));
|
||||||
|
|
|
@ -43,7 +43,7 @@ UM.ManagementPage
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:button", "Add");
|
text: catalog.i18nc("@action:button", "Add");
|
||||||
iconName: "list-add";
|
iconName: "list-add";
|
||||||
onClicked: Printer.requestAddPrinter()
|
onClicked: CuraApplication.requestAddPrinter()
|
||||||
},
|
},
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
|
@ -216,8 +216,8 @@ UM.ManagementPage
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
for (var component in Printer.additionalComponents["machinesDetailPane"]) {
|
for (var component in CuraApplication.additionalComponents["machinesDetailPane"]) {
|
||||||
Printer.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
|
CuraApplication.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,8 +227,8 @@ UM.ManagementPage
|
||||||
onAdditionalComponentsChanged:
|
onAdditionalComponentsChanged:
|
||||||
{
|
{
|
||||||
if(areaId == "machinesDetailPane") {
|
if(areaId == "machinesDetailPane") {
|
||||||
for (var component in Printer.additionalComponents["machinesDetailPane"]) {
|
for (var component in CuraApplication.additionalComponents["machinesDetailPane"]) {
|
||||||
Printer.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
|
CuraApplication.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ Item {
|
||||||
property int backendState: UM.Backend.state;
|
property int backendState: UM.Backend.state;
|
||||||
|
|
||||||
property var backend: CuraApplication.getBackend();
|
property var backend: CuraApplication.getBackend();
|
||||||
property bool activity: Printer.platformActivity;
|
property bool activity: CuraApplication.platformActivity;
|
||||||
|
|
||||||
property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
|
property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
|
||||||
property string fileBaseName
|
property string fileBaseName
|
||||||
|
@ -110,8 +110,8 @@ Item {
|
||||||
onAdditionalComponentsChanged:
|
onAdditionalComponentsChanged:
|
||||||
{
|
{
|
||||||
if(areaId == "saveButton") {
|
if(areaId == "saveButton") {
|
||||||
for (var component in Printer.additionalComponents["saveButton"]) {
|
for (var component in CuraApplication.additionalComponents["saveButton"]) {
|
||||||
Printer.additionalComponents["saveButton"][component].parent = additionalComponentsRow
|
CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,14 +155,14 @@ Item
|
||||||
containerId: Cura.MachineManager.activeDefinitionId
|
containerId: Cura.MachineManager.activeDefinitionId
|
||||||
visibilityHandler: UM.SettingPreferenceVisibilityHandler { }
|
visibilityHandler: UM.SettingPreferenceVisibilityHandler { }
|
||||||
exclude: ["machine_settings", "command_line_settings", "infill_mesh", "infill_mesh_order", "support_mesh", "anti_overhang_mesh"] // TODO: infill_mesh settigns are excluded hardcoded, but should be based on the fact that settable_globally, settable_per_meshgroup and settable_per_extruder are false.
|
exclude: ["machine_settings", "command_line_settings", "infill_mesh", "infill_mesh_order", "support_mesh", "anti_overhang_mesh"] // TODO: infill_mesh settigns are excluded hardcoded, but should be based on the fact that settable_globally, settable_per_meshgroup and settable_per_extruder are false.
|
||||||
expanded: Printer.expandedCategories
|
expanded: CuraApplication.expandedCategories
|
||||||
onExpandedChanged:
|
onExpandedChanged:
|
||||||
{
|
{
|
||||||
if(!findingSettings)
|
if(!findingSettings)
|
||||||
{
|
{
|
||||||
// Do not change expandedCategories preference while filtering settings
|
// Do not change expandedCategories preference while filtering settings
|
||||||
// because all categories are expanded while filtering
|
// because all categories are expanded while filtering
|
||||||
Printer.setExpandedCategories(expanded)
|
CuraApplication.setExpandedCategories(expanded)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onVisibilityChanged: Cura.SettingInheritanceManager.forceUpdate()
|
onVisibilityChanged: Cura.SettingInheritanceManager.forceUpdate()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue