mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 06:45:09 -06:00
Merge branch 'master' into feature_setting_visibility_profiles
This commit is contained in:
commit
97d7354839
586 changed files with 6836 additions and 6692 deletions
|
@ -163,7 +163,7 @@ UM.PreferencesPage
|
|||
append({ text: "Русский", code: "ru_RU" })
|
||||
append({ text: "Türkçe", code: "tr_TR" })
|
||||
append({ text: "简体中文", code: "zh_CN" })
|
||||
//Traditional Chinese is disabled for being incomplete: append({ text: "正體字", code: "zh_TW" })
|
||||
append({ text: "正體字", code: "zh_TW" })
|
||||
|
||||
var date_object = new Date();
|
||||
if (date_object.getUTCMonth() == 8 && date_object.getUTCDate() == 19) //Only add Pirate on the 19th of September.
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Window 2.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
|
||||
UM.ManagementPage
|
||||
{
|
||||
id: base;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright (c) 2017 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
import UM 1.2 as UM
|
||||
|
@ -12,7 +12,10 @@ TabView
|
|||
{
|
||||
id: base
|
||||
|
||||
property QtObject properties;
|
||||
property QtObject materialManager: CuraApplication.getMaterialManager()
|
||||
|
||||
property QtObject properties
|
||||
property var currentMaterialNode: null
|
||||
|
||||
property bool editingEnabled: false;
|
||||
property string currency: UM.Preferences.getValue("cura/currency") ? UM.Preferences.getValue("cura/currency") : "€"
|
||||
|
@ -27,18 +30,23 @@ TabView
|
|||
property bool reevaluateLinkedMaterials: false
|
||||
property string linkedMaterialNames:
|
||||
{
|
||||
if (reevaluateLinkedMaterials)
|
||||
{
|
||||
if (reevaluateLinkedMaterials) {
|
||||
reevaluateLinkedMaterials = false;
|
||||
}
|
||||
if(!base.containerId || !base.editingEnabled)
|
||||
{
|
||||
if (!base.containerId || !base.editingEnabled) {
|
||||
return ""
|
||||
}
|
||||
var linkedMaterials = Cura.ContainerManager.getLinkedMaterials(base.currentMaterialNode);
|
||||
if (linkedMaterials.length <= 1) {
|
||||
return ""
|
||||
}
|
||||
var linkedMaterials = Cura.ContainerManager.getLinkedMaterials(base.containerId);
|
||||
return linkedMaterials.join(", ");
|
||||
}
|
||||
|
||||
function getApproximateDiameter(diameter) {
|
||||
return Math.round(diameter);
|
||||
}
|
||||
|
||||
Tab
|
||||
{
|
||||
title: catalog.i18nc("@title", "Information")
|
||||
|
@ -65,6 +73,34 @@ TabView
|
|||
width: base.width
|
||||
property real rowHeight: textField.height + UM.Theme.getSize("default_lining").height
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: confirmDiameterChangeDialog
|
||||
|
||||
icon: StandardIcon.Question;
|
||||
title: catalog.i18nc("@title:window", "Confirm Diameter Change")
|
||||
text: catalog.i18nc("@label (%1 is object name)", "The new material diameter is set to %1 mm, which is not compatible to the current machine. Do you wish to continue?".arg(new_diameter_value))
|
||||
standardButtons: StandardButton.Yes | StandardButton.No
|
||||
modality: Qt.ApplicationModal
|
||||
|
||||
property var new_diameter_value: null;
|
||||
property var old_diameter_value: null;
|
||||
property var old_approximate_diameter_value: null;
|
||||
|
||||
onYes:
|
||||
{
|
||||
Cura.ContainerManager.setContainerProperty(base.containerId, "material_diameter", "value", new_diameter_value);
|
||||
base.setMetaDataEntry("approximate_diameter", old_approximate_diameter_value, getApproximateDiameter(new_diameter_value).toString());
|
||||
base.setMetaDataEntry("properties/diameter", properties.diameter, new_diameter_value);
|
||||
}
|
||||
|
||||
onNo:
|
||||
{
|
||||
properties.diameter = old_diameter_value;
|
||||
diameterSpinBox.value = properties.diameter;
|
||||
}
|
||||
}
|
||||
|
||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Display Name") }
|
||||
ReadOnlyTextField
|
||||
{
|
||||
|
@ -80,18 +116,18 @@ TabView
|
|||
{
|
||||
id: textField;
|
||||
width: scrollView.columnWidth;
|
||||
text: properties.supplier;
|
||||
text: properties.brand;
|
||||
readOnly: !base.editingEnabled;
|
||||
onEditingFinished: base.updateMaterialSupplier(properties.supplier, text)
|
||||
onEditingFinished: base.updateMaterialBrand(properties.brand, text)
|
||||
}
|
||||
|
||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Material Type") }
|
||||
ReadOnlyTextField
|
||||
{
|
||||
width: scrollView.columnWidth;
|
||||
text: properties.material_type;
|
||||
text: properties.material;
|
||||
readOnly: !base.editingEnabled;
|
||||
onEditingFinished: base.updateMaterialType(properties.material_type, text)
|
||||
onEditingFinished: base.updateMaterialType(properties.material, text)
|
||||
}
|
||||
|
||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Color") }
|
||||
|
@ -172,14 +208,20 @@ TabView
|
|||
// which derive from the same base_file
|
||||
var old_diameter = Cura.ContainerManager.getContainerProperty(base.containerId, "material_diameter", "value").toString();
|
||||
var old_approximate_diameter = Cura.ContainerManager.getContainerMetaDataEntry(base.containerId, "approximate_diameter");
|
||||
base.setMetaDataEntry("approximate_diameter", old_approximate_diameter, Math.round(value).toString());
|
||||
base.setMetaDataEntry("properties/diameter", properties.diameter, value);
|
||||
var new_approximate_diameter = Cura.ContainerManager.getContainerMetaDataEntry(base.containerId, "approximate_diameter");
|
||||
if (Cura.MachineManager.filterMaterialsByMachine && new_approximate_diameter != Cura.MachineManager.activeMachine.approximateMaterialDiameter)
|
||||
var new_approximate_diameter = getApproximateDiameter(value);
|
||||
if (Cura.MachineManager.filterMaterialsByMachine && new_approximate_diameter != Cura.ExtruderManager.getActiveExtruderStack().approximateMaterialDiameter)
|
||||
{
|
||||
Cura.MaterialManager.showMaterialWarningMessage(base.containerId, old_diameter);
|
||||
confirmDiameterChangeDialog.old_diameter_value = old_diameter;
|
||||
confirmDiameterChangeDialog.new_diameter_value = value;
|
||||
confirmDiameterChangeDialog.old_approximate_diameter_value = old_approximate_diameter;
|
||||
|
||||
confirmDiameterChangeDialog.open()
|
||||
}
|
||||
else {
|
||||
Cura.ContainerManager.setContainerProperty(base.containerId, "material_diameter", "value", value);
|
||||
base.setMetaDataEntry("approximate_diameter", old_approximate_diameter, getApproximateDiameter(value).toString());
|
||||
base.setMetaDataEntry("properties/diameter", properties.diameter, value);
|
||||
}
|
||||
Cura.ContainerManager.setContainerProperty(base.containerId, "material_diameter", "value", value);
|
||||
}
|
||||
onValueChanged: updateCostPerMeter()
|
||||
}
|
||||
|
@ -251,7 +293,7 @@ TabView
|
|||
visible: base.linkedMaterialNames != ""
|
||||
onClicked:
|
||||
{
|
||||
Cura.ContainerManager.unlinkMaterial(base.containerId)
|
||||
Cura.ContainerManager.unlinkMaterial(base.currentMaterialNode)
|
||||
base.reevaluateLinkedMaterials = true
|
||||
}
|
||||
}
|
||||
|
@ -357,8 +399,20 @@ TabView
|
|||
onEditingFinished: materialPropertyProvider.setPropertyValue("value", value)
|
||||
}
|
||||
|
||||
UM.ContainerPropertyProvider { id: materialPropertyProvider; containerId: base.containerId; watchedProperties: [ "value" ]; key: model.key }
|
||||
UM.ContainerPropertyProvider { id: machinePropertyProvider; containerId: Cura.MachineManager.activeDefinitionId; watchedProperties: [ "value" ]; key: model.key }
|
||||
UM.ContainerPropertyProvider
|
||||
{
|
||||
id: materialPropertyProvider
|
||||
containerId: base.containerId
|
||||
watchedProperties: [ "value" ]
|
||||
key: model.key
|
||||
}
|
||||
UM.ContainerPropertyProvider
|
||||
{
|
||||
id: machinePropertyProvider
|
||||
containerId: Cura.MachineManager.activeDefinitionId
|
||||
watchedProperties: [ "value" ]
|
||||
key: model.key
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -405,7 +459,7 @@ TabView
|
|||
// Tiny convenience function to check if a value really changed before trying to set it.
|
||||
function setMetaDataEntry(entry_name, old_value, new_value) {
|
||||
if (old_value != new_value) {
|
||||
Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, entry_name, new_value)
|
||||
Cura.ContainerManager.setContainerMetaDataEntry(base.currentMaterialNode, entry_name, new_value)
|
||||
// make sure the UI properties are updated as well since we don't re-fetch the entire model here
|
||||
// When the entry_name is something like properties/diameter, we take the last part of the entry_name
|
||||
var list = entry_name.split("/")
|
||||
|
@ -442,26 +496,25 @@ TabView
|
|||
|
||||
// update the display name of the material
|
||||
function updateMaterialDisplayName (old_name, new_name) {
|
||||
|
||||
// don't change when new name is the same
|
||||
if (old_name == new_name) {
|
||||
return
|
||||
}
|
||||
|
||||
// update the values
|
||||
Cura.ContainerManager.setContainerName(base.containerId, new_name)
|
||||
base.materialManager.setMaterialName(base.currentMaterialNode, new_name)
|
||||
materialProperties.name = new_name
|
||||
}
|
||||
|
||||
// update the type of the material
|
||||
function updateMaterialType (old_type, new_type) {
|
||||
base.setMetaDataEntry("material", old_type, new_type)
|
||||
materialProperties.material_type = new_type
|
||||
materialProperties.material= new_type
|
||||
}
|
||||
|
||||
// update the supplier of the material
|
||||
function updateMaterialSupplier (old_supplier, new_supplier) {
|
||||
base.setMetaDataEntry("brand", old_supplier, new_supplier)
|
||||
materialProperties.supplier = new_supplier
|
||||
// update the brand of the material
|
||||
function updateMaterialBrand (old_brand, new_brand) {
|
||||
base.setMetaDataEntry("brand", old_brand, new_brand)
|
||||
materialProperties.brand = new_brand
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,412 +1,526 @@
|
|||
//Copyright (c) 2017 Ultimaker B.V.
|
||||
//Cura is released under the terms of the LGPLv3 or higher.
|
||||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
UM.ManagementPage
|
||||
|
||||
Item
|
||||
{
|
||||
id: base;
|
||||
id: base
|
||||
|
||||
title: catalog.i18nc("@title:tab", "Materials");
|
||||
property QtObject materialManager: CuraApplication.getMaterialManager()
|
||||
property var resetEnabled: false // Keep PreferencesDialog happy
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
// Workaround to make sure all of the items are visible
|
||||
objectList.positionViewAtBeginning();
|
||||
UM.I18nCatalog { id: catalog; name: "cura"; }
|
||||
|
||||
Cura.MaterialManagementModel {
|
||||
id: materialsModel
|
||||
}
|
||||
|
||||
model: Cura.MaterialsModel
|
||||
{
|
||||
filter:
|
||||
{
|
||||
var result = { "type": "material", "approximate_diameter": Math.round(materialDiameterProvider.properties.value).toString() }
|
||||
if(Cura.MachineManager.filterMaterialsByMachine)
|
||||
{
|
||||
result.definition = Cura.MachineManager.activeQualityDefinitionId;
|
||||
if(Cura.MachineManager.hasVariants)
|
||||
{
|
||||
result.variant = Cura.MachineManager.activeQualityVariantId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.definition = "fdmprinter";
|
||||
result.compatible = true; //NB: Only checks for compatibility in global version of material, but we don't have machine-specific materials anyway.
|
||||
}
|
||||
return result
|
||||
Label {
|
||||
id: titleLabel
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: 5 * screenScaleFactor
|
||||
}
|
||||
|
||||
sectionProperty: "brand"
|
||||
font.pointSize: 18
|
||||
text: catalog.i18nc("@title:tab", "Materials")
|
||||
}
|
||||
|
||||
delegate: Rectangle
|
||||
{
|
||||
width: objectList.width;
|
||||
height: childrenRect.height;
|
||||
color: isCurrentItem ? palette.highlight : index % 2 ? palette.base : palette.alternateBase
|
||||
property bool isCurrentItem: ListView.isCurrentItem
|
||||
property var hasCurrentItem: materialListView.currentItem != null
|
||||
|
||||
Row
|
||||
property var currentItem:
|
||||
{ // is soon to be overwritten
|
||||
var current_index = materialListView.currentIndex;
|
||||
return materialsModel.getItem(current_index);
|
||||
}
|
||||
|
||||
property var isCurrentItemActivated:
|
||||
{
|
||||
const extruder_position = Cura.ExtruderManager.activeExtruderIndex;
|
||||
const root_material_id = Cura.MachineManager.currentRootMaterialId[extruder_position];
|
||||
return base.currentItem.root_material_id == root_material_id;
|
||||
}
|
||||
|
||||
Row // Button Row
|
||||
{
|
||||
id: buttonRow
|
||||
anchors
|
||||
{
|
||||
spacing: (UM.Theme.getSize("default_margin").width / 2) | 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.right: parent.right
|
||||
Rectangle
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: titleLabel.bottom
|
||||
}
|
||||
height: childrenRect.height
|
||||
|
||||
// Activate button
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Activate")
|
||||
iconName: "list-activate"
|
||||
enabled: !isCurrentItemActivated
|
||||
onClicked:
|
||||
{
|
||||
width: Math.round(parent.height * 0.8)
|
||||
height: Math.round(parent.height * 0.8)
|
||||
color: model.metadata.color_code
|
||||
border.color: isCurrentItem ? palette.highlightedText : palette.text;
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: Math.round((parent.width * 0.3))
|
||||
text: model.metadata.material
|
||||
elide: Text.ElideRight
|
||||
font.italic: model.id == activeId
|
||||
color: isCurrentItem ? palette.highlightedText : palette.text;
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: (model.name != model.metadata.material) ? model.name : ""
|
||||
elide: Text.ElideRight
|
||||
font.italic: model.id == activeId
|
||||
color: isCurrentItem ? palette.highlightedText : palette.text;
|
||||
forceActiveFocus()
|
||||
|
||||
const extruder_position = Cura.ExtruderManager.activeExtruderIndex;
|
||||
Cura.MachineManager.setMaterial(extruder_position, base.currentItem.container_node);
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea
|
||||
// Create button
|
||||
Button
|
||||
{
|
||||
anchors.fill: parent;
|
||||
text: catalog.i18nc("@action:button", "Create")
|
||||
iconName: "list-add"
|
||||
onClicked:
|
||||
{
|
||||
forceActiveFocus();
|
||||
if(!parent.ListView.isCurrentItem)
|
||||
{
|
||||
parent.ListView.view.currentIndex = index;
|
||||
base.itemActivated();
|
||||
}
|
||||
base.newRootMaterialIdToSwitchTo = base.materialManager.createMaterial();
|
||||
base.toActivateNewMaterial = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
activeId: Cura.MachineManager.activeMaterialId
|
||||
activeIndex: getIndexById(activeId)
|
||||
function getIndexById(material_id)
|
||||
{
|
||||
for(var i = 0; i < model.rowCount(); i++) {
|
||||
if (model.getItem(i).id == material_id) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
scrollviewCaption:
|
||||
{
|
||||
var caption = catalog.i18nc("@action:label", "Printer") + ": " + Cura.MachineManager.activeMachineName;
|
||||
if (Cura.MachineManager.hasVariants)
|
||||
{
|
||||
caption += ", " + Cura.MachineManager.activeDefinitionVariantsName + ": " + Cura.MachineManager.activeVariantName;
|
||||
}
|
||||
return caption;
|
||||
}
|
||||
detailsVisible: true
|
||||
|
||||
section.property: "section"
|
||||
section.delegate: Label
|
||||
{
|
||||
text: section
|
||||
font.bold: true
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: UM.Theme.getSize("default_lining").width;
|
||||
}
|
||||
|
||||
buttons: [
|
||||
|
||||
// Activate button
|
||||
Button {
|
||||
text: catalog.i18nc("@action:button", "Activate")
|
||||
iconName: "list-activate";
|
||||
enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId && Cura.MachineManager.hasMaterials
|
||||
onClicked: {
|
||||
forceActiveFocus()
|
||||
Cura.MachineManager.setActiveMaterial(base.currentItem.id)
|
||||
currentItem = base.model.getItem(base.objectList.currentIndex) // Refresh the current item.
|
||||
}
|
||||
},
|
||||
|
||||
// Create button
|
||||
Button {
|
||||
text: catalog.i18nc("@action:button", "Create")
|
||||
iconName: "list-add"
|
||||
onClicked: {
|
||||
forceActiveFocus()
|
||||
Cura.ContainerManager.createMaterial()
|
||||
}
|
||||
},
|
||||
|
||||
// Duplicate button
|
||||
Button {
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Duplicate");
|
||||
iconName: "list-add";
|
||||
enabled: base.currentItem != null
|
||||
onClicked: {
|
||||
forceActiveFocus()
|
||||
Cura.ContainerManager.duplicateOriginalMaterial(base.currentItem.id)
|
||||
iconName: "list-add"
|
||||
enabled: base.hasCurrentItem
|
||||
onClicked:
|
||||
{
|
||||
forceActiveFocus();
|
||||
base.newRootMaterialIdToSwitchTo = base.materialManager.duplicateMaterial(base.currentItem.container_node);
|
||||
base.toActivateNewMaterial = true;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// Remove button
|
||||
Button {
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Remove")
|
||||
iconName: "list-remove"
|
||||
enabled: base.currentItem != null && !base.currentItem.readOnly && !Cura.ContainerManager.isContainerUsed(base.currentItem.id)
|
||||
onClicked: {
|
||||
forceActiveFocus()
|
||||
confirmDialog.open()
|
||||
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated
|
||||
onClicked:
|
||||
{
|
||||
forceActiveFocus();
|
||||
confirmRemoveMaterialDialog.open();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// Import button
|
||||
Button {
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Import")
|
||||
iconName: "document-import"
|
||||
onClicked: {
|
||||
forceActiveFocus()
|
||||
importDialog.open()
|
||||
onClicked:
|
||||
{
|
||||
forceActiveFocus();
|
||||
importMaterialDialog.open();
|
||||
}
|
||||
visible: true
|
||||
},
|
||||
}
|
||||
|
||||
// Export button
|
||||
Button {
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Export")
|
||||
iconName: "document-export"
|
||||
onClicked: {
|
||||
forceActiveFocus()
|
||||
exportDialog.open()
|
||||
onClicked:
|
||||
{
|
||||
forceActiveFocus();
|
||||
exportMaterialDialog.open();
|
||||
}
|
||||
enabled: currentItem != null
|
||||
}
|
||||
}
|
||||
|
||||
property string newRootMaterialIdToSwitchTo: ""
|
||||
property bool toActivateNewMaterial: false
|
||||
|
||||
// This connection makes sure that we will switch to the new
|
||||
Connections
|
||||
{
|
||||
target: materialsModel
|
||||
onItemsChanged: {
|
||||
var currentItemId = base.currentItem == null ? "" : base.currentItem.root_material_id;
|
||||
var position = Cura.ExtruderManager.activeExtruderIndex;
|
||||
|
||||
// try to pick the currently selected item; it may have been moved
|
||||
if (base.newRootMaterialIdToSwitchTo == "") {
|
||||
base.newRootMaterialIdToSwitchTo = currentItemId;
|
||||
}
|
||||
|
||||
for (var idx = 0; idx < materialsModel.rowCount(); ++idx) {
|
||||
var item = materialsModel.getItem(idx);
|
||||
if (item.root_material_id == base.newRootMaterialIdToSwitchTo) {
|
||||
// Switch to the newly created profile if needed
|
||||
materialListView.currentIndex = idx;
|
||||
materialListView.activateDetailsWithIndex(materialListView.currentIndex);
|
||||
if (base.toActivateNewMaterial) {
|
||||
Cura.MachineManager.setMaterial(position, item.container_node);
|
||||
}
|
||||
base.newRootMaterialIdToSwitchTo = "";
|
||||
base.toActivateNewMaterial = false;
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
materialListView.currentIndex = 0;
|
||||
materialListView.activateDetailsWithIndex(materialListView.currentIndex);
|
||||
if (base.toActivateNewMaterial) {
|
||||
Cura.MachineManager.setMaterial(position, materialsModel.getItem(0).container_node);
|
||||
}
|
||||
base.newRootMaterialIdToSwitchTo = "";
|
||||
base.toActivateNewMaterial = false;
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: confirmRemoveMaterialDialog
|
||||
|
||||
icon: StandardIcon.Question;
|
||||
title: catalog.i18nc("@title:window", "Confirm Remove")
|
||||
text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItem.name)
|
||||
standardButtons: StandardButton.Yes | StandardButton.No
|
||||
modality: Qt.ApplicationModal
|
||||
|
||||
onYes:
|
||||
{
|
||||
base.materialManager.removeMaterial(base.currentItem.container_node);
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: importMaterialDialog
|
||||
title: catalog.i18nc("@title:window", "Import Material")
|
||||
selectExisting: true
|
||||
nameFilters: Cura.ContainerManager.getContainerNameFilters("material")
|
||||
folder: CuraApplication.getDefaultPath("dialog_material_path")
|
||||
onAccepted:
|
||||
{
|
||||
var result = Cura.ContainerManager.importMaterialContainer(fileUrl);
|
||||
|
||||
messageDialog.title = catalog.i18nc("@title:window", "Import Material");
|
||||
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "Could not import material <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message);
|
||||
if (result.status == "success") {
|
||||
messageDialog.icon = StandardIcon.Information;
|
||||
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully imported material <filename>%1</filename>").arg(fileUrl);
|
||||
}
|
||||
else if (result.status == "duplicate") {
|
||||
messageDialog.icon = StandardIcon.Warning;
|
||||
}
|
||||
else {
|
||||
messageDialog.icon = StandardIcon.Critical;
|
||||
}
|
||||
messageDialog.open();
|
||||
CuraApplication.setDefaultPath("dialog_material_path", folder);
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: exportMaterialDialog
|
||||
title: catalog.i18nc("@title:window", "Export Material")
|
||||
selectExisting: false
|
||||
nameFilters: Cura.ContainerManager.getContainerNameFilters("material")
|
||||
folder: CuraApplication.getDefaultPath("dialog_material_path")
|
||||
onAccepted:
|
||||
{
|
||||
var result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, selectedNameFilter, fileUrl);
|
||||
|
||||
messageDialog.title = catalog.i18nc("@title:window", "Export Material");
|
||||
if (result.status == "error") {
|
||||
messageDialog.icon = StandardIcon.Critical;
|
||||
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> and <message>!", "Failed to export material to <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message);
|
||||
messageDialog.open();
|
||||
}
|
||||
else if (result.status == "success") {
|
||||
messageDialog.icon = StandardIcon.Information;
|
||||
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully exported material to <filename>%1</filename>").arg(result.path);
|
||||
messageDialog.open();
|
||||
}
|
||||
CuraApplication.setDefaultPath("dialog_material_path", folder);
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: messageDialog
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
Item {
|
||||
visible: base.currentItem != null
|
||||
anchors.fill: parent
|
||||
id: contentsItem
|
||||
|
||||
anchors {
|
||||
top: titleLabel.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: 5 * screenScaleFactor
|
||||
bottomMargin: 0
|
||||
}
|
||||
|
||||
clip: true
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
anchors {
|
||||
top: buttonRow.bottom
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
SystemPalette { id: palette }
|
||||
|
||||
Label
|
||||
{
|
||||
id: captionLabel
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
}
|
||||
visible: text != ""
|
||||
text: {
|
||||
var caption = catalog.i18nc("@action:label", "Printer") + ": " + Cura.MachineManager.activeMachineName;
|
||||
if (Cura.MachineManager.hasVariants)
|
||||
{
|
||||
caption += ", " + Cura.MachineManager.activeDefinitionVariantsName + ": " + Cura.MachineManager.activeVariantName;
|
||||
}
|
||||
return caption;
|
||||
}
|
||||
width: materialScrollView.width
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
ScrollView
|
||||
{
|
||||
id: materialScrollView
|
||||
anchors {
|
||||
top: captionLabel.visible ? captionLabel.bottom : parent.top
|
||||
topMargin: captionLabel.visible ? UM.Theme.getSize("default_margin").height : 0
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
parent: viewport
|
||||
anchors.fill: parent
|
||||
color: palette.light
|
||||
}
|
||||
|
||||
width: true ? (parent.width * 0.4) | 0 : parent.width
|
||||
|
||||
ListView
|
||||
{
|
||||
id: materialListView
|
||||
|
||||
model: materialsModel
|
||||
|
||||
section.property: "brand"
|
||||
section.criteria: ViewSection.FullString
|
||||
section.delegate: Rectangle
|
||||
{
|
||||
width: materialScrollView.width
|
||||
height: childrenRect.height
|
||||
color: palette.light
|
||||
|
||||
Label
|
||||
{
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_lining").width
|
||||
text: section
|
||||
font.bold: true
|
||||
color: palette.text
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Rectangle
|
||||
{
|
||||
width: materialScrollView.width
|
||||
height: childrenRect.height
|
||||
color: ListView.isCurrentItem ? palette.highlight : (model.index % 2) ? palette.base : palette.alternateBase
|
||||
|
||||
Row
|
||||
{
|
||||
id: materialRow
|
||||
spacing: (UM.Theme.getSize("default_margin").width / 2) | 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.right: parent.right
|
||||
|
||||
property bool isItemActivated:
|
||||
{
|
||||
const extruder_position = Cura.ExtruderManager.activeExtruderIndex;
|
||||
const root_material_id = Cura.MachineManager.currentRootMaterialId[extruder_position];
|
||||
return model.root_material_id == root_material_id;
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
width: Math.floor(parent.height * 0.8)
|
||||
height: Math.floor(parent.height * 0.8)
|
||||
color: model.color_code
|
||||
border.color: parent.ListView.isCurrentItem ? palette.highlightedText : palette.text;
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: Math.floor((parent.width * 0.3))
|
||||
text: model.material
|
||||
elide: Text.ElideRight
|
||||
font.italic: materialRow.isItemActivated
|
||||
color: parent.ListView.isCurrentItem ? palette.highlightedText : palette.text;
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: (model.name != model.material) ? model.name : ""
|
||||
elide: Text.ElideRight
|
||||
font.italic: materialRow.isItemActivated
|
||||
color: parent.ListView.isCurrentItem ? palette.highlightedText : palette.text;
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
parent.ListView.view.currentIndex = model.index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function activateDetailsWithIndex(index) {
|
||||
var model = materialsModel.getItem(index);
|
||||
base.currentItem = model;
|
||||
materialDetailsView.containerId = model.container_id;
|
||||
materialDetailsView.currentMaterialNode = model.container_node;
|
||||
|
||||
detailsPanel.updateMaterialPropertiesObject();
|
||||
}
|
||||
|
||||
onCurrentIndexChanged:
|
||||
{
|
||||
forceActiveFocus(); // causes the changed fields to be saved
|
||||
activateDetailsWithIndex(currentIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Item
|
||||
{
|
||||
id: profileName
|
||||
id: detailsPanel
|
||||
|
||||
width: parent.width;
|
||||
height: childrenRect.height
|
||||
|
||||
Label { text: materialProperties.name; font: UM.Theme.getFont("large"); }
|
||||
}
|
||||
|
||||
MaterialView
|
||||
{
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: profileName.bottom
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors {
|
||||
left: materialScrollView.right
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
editingEnabled: base.currentItem != null && !base.currentItem.readOnly
|
||||
|
||||
properties: materialProperties
|
||||
containerId: base.currentItem != null ? base.currentItem.id : ""
|
||||
|
||||
property alias pane: base
|
||||
}
|
||||
|
||||
QtObject
|
||||
{
|
||||
id: materialProperties
|
||||
|
||||
property string guid: "00000000-0000-0000-0000-000000000000"
|
||||
property string name: "Unknown";
|
||||
property string profile_type: "Unknown";
|
||||
property string supplier: "Unknown";
|
||||
property string material_type: "Unknown";
|
||||
|
||||
property string color_name: "Yellow";
|
||||
property color color_code: "yellow";
|
||||
|
||||
property real density: 0.0;
|
||||
property real diameter: 0.0;
|
||||
property string approximate_diameter: "0";
|
||||
|
||||
property real spool_cost: 0.0;
|
||||
property real spool_weight: 0.0;
|
||||
property real spool_length: 0.0;
|
||||
property real cost_per_meter: 0.0;
|
||||
|
||||
property string description: "";
|
||||
property string adhesion_info: "";
|
||||
}
|
||||
|
||||
UM.ConfirmRemoveDialog
|
||||
{
|
||||
id: confirmDialog
|
||||
object: base.currentItem != null ? base.currentItem.name : ""
|
||||
onYes:
|
||||
function updateMaterialPropertiesObject()
|
||||
{
|
||||
// A material container can actually be multiple items, so we need to find (and remove) all of them.
|
||||
var base_file = Cura.ContainerManager.getContainerMetaDataEntry(base.currentItem.id, "base_file")
|
||||
if(base_file == "")
|
||||
{
|
||||
base_file = base.currentItem.id
|
||||
}
|
||||
var guid = Cura.ContainerManager.getContainerMetaDataEntry(base.currentItem.id, "GUID")
|
||||
// remove base container first, it otherwise triggers loading the base file while removing other containers
|
||||
var base_containers = Cura.ContainerManager.findInstanceContainers({"GUID": guid, "id": base_file, "base_file": base_file, "type": "material"})
|
||||
for(var i in base_containers)
|
||||
{
|
||||
Cura.ContainerManager.removeContainer(base_containers[i]);
|
||||
}
|
||||
var containers = Cura.ContainerManager.findInstanceContainers({"GUID": guid, "base_file": base_file, "type": "material"})
|
||||
for(var i in containers)
|
||||
{
|
||||
Cura.ContainerManager.removeContainer(containers[i]);
|
||||
}
|
||||
if(base.objectList.currentIndex > 0)
|
||||
{
|
||||
base.objectList.currentIndex--;
|
||||
}
|
||||
currentItem = base.model.getItem(base.objectList.currentIndex) // Refresh the current item.
|
||||
}
|
||||
}
|
||||
var currentItem = materialsModel.getItem(materialListView.currentIndex);
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: importDialog;
|
||||
title: catalog.i18nc("@title:window", "Import Material");
|
||||
selectExisting: true;
|
||||
nameFilters: Cura.ContainerManager.getContainerNameFilters("material")
|
||||
folder: CuraApplication.getDefaultPath("dialog_material_path")
|
||||
onAccepted:
|
||||
materialProperties.name = currentItem.name;
|
||||
materialProperties.guid = currentItem.guid;
|
||||
|
||||
materialProperties.brand = currentItem.brand ? currentItem.brand : "Unknown";
|
||||
materialProperties.material = currentItem.material ? currentItem.material : "Unknown";
|
||||
materialProperties.color_name = currentItem.color_name ? currentItem.color_name : "Yellow";
|
||||
materialProperties.color_code = currentItem.color_code ? currentItem.color_code : "yellow";
|
||||
|
||||
materialProperties.description = currentItem.description ? currentItem.description : "";
|
||||
materialProperties.adhesion_info = currentItem.adhesion_info ? currentItem.adhesion_info : "";
|
||||
|
||||
materialProperties.density = currentItem.density ? currentItem.density : 0.0;
|
||||
materialProperties.diameter = currentItem.diameter ? currentItem.diameter : 0.0;
|
||||
materialProperties.approximate_diameter = currentItem.approximate_diameter ? currentItem.approximate_diameter : "0";
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
var result = Cura.ContainerManager.importMaterialContainer(fileUrl)
|
||||
anchors.fill: parent
|
||||
|
||||
messageDialog.title = catalog.i18nc("@title:window", "Import Material")
|
||||
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "Could not import material <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message)
|
||||
if(result.status == "success")
|
||||
Item // Material title Label
|
||||
{
|
||||
messageDialog.icon = StandardIcon.Information
|
||||
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully imported material <filename>%1</filename>").arg(fileUrl)
|
||||
id: profileName
|
||||
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
|
||||
Label {
|
||||
text: materialProperties.name
|
||||
font: UM.Theme.getFont("large")
|
||||
}
|
||||
}
|
||||
else if(result.status == "duplicate")
|
||||
|
||||
MaterialView // Material detailed information view below the title Label
|
||||
{
|
||||
messageDialog.icon = StandardIcon.Warning
|
||||
id: materialDetailsView
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: profileName.bottom
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
editingEnabled: base.currentItem != null && !base.currentItem.is_read_only
|
||||
|
||||
properties: materialProperties
|
||||
containerId: base.currentItem != null ? base.currentItem.container_id : ""
|
||||
currentMaterialNode: base.currentItem.container_node
|
||||
|
||||
property alias pane: base
|
||||
}
|
||||
else
|
||||
|
||||
QtObject
|
||||
{
|
||||
messageDialog.icon = StandardIcon.Critical
|
||||
id: materialProperties
|
||||
|
||||
property string guid: "00000000-0000-0000-0000-000000000000"
|
||||
property string name: "Unknown";
|
||||
property string profile_type: "Unknown";
|
||||
property string brand: "Unknown";
|
||||
property string material: "Unknown"; // This needs to be named as "material" to be consistent with
|
||||
// the material container's metadata entry
|
||||
|
||||
property string color_name: "Yellow";
|
||||
property color color_code: "yellow";
|
||||
|
||||
property real density: 0.0;
|
||||
property real diameter: 0.0;
|
||||
property string approximate_diameter: "0";
|
||||
|
||||
property real spool_cost: 0.0;
|
||||
property real spool_weight: 0.0;
|
||||
property real spool_length: 0.0;
|
||||
property real cost_per_meter: 0.0;
|
||||
|
||||
property string description: "";
|
||||
property string adhesion_info: "";
|
||||
}
|
||||
messageDialog.open()
|
||||
CuraApplication.setDefaultPath("dialog_material_path", folder)
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: exportDialog;
|
||||
title: catalog.i18nc("@title:window", "Export Material");
|
||||
selectExisting: false;
|
||||
nameFilters: Cura.ContainerManager.getContainerNameFilters("material")
|
||||
folder: CuraApplication.getDefaultPath("dialog_material_path")
|
||||
onAccepted:
|
||||
{
|
||||
if(base.currentItem.metadata.base_file)
|
||||
{
|
||||
var result = Cura.ContainerManager.exportContainer(base.currentItem.metadata.base_file, selectedNameFilter, fileUrl)
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = Cura.ContainerManager.exportContainer(base.currentItem.id, selectedNameFilter, fileUrl)
|
||||
}
|
||||
|
||||
messageDialog.title = catalog.i18nc("@title:window", "Export Material")
|
||||
if(result.status == "error")
|
||||
{
|
||||
messageDialog.icon = StandardIcon.Critical
|
||||
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> and <message>!", "Failed to export material to <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message)
|
||||
messageDialog.open()
|
||||
}
|
||||
else if(result.status == "success")
|
||||
{
|
||||
messageDialog.icon = StandardIcon.Information
|
||||
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully exported material to <filename>%1</filename>").arg(result.path)
|
||||
messageDialog.open()
|
||||
}
|
||||
CuraApplication.setDefaultPath("dialog_material_path", folder)
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: messageDialog
|
||||
}
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: materialDiameterProvider
|
||||
|
||||
containerStackId: Cura.ExtruderManager.activeExtruderStackId
|
||||
key: "material_diameter"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 5
|
||||
}
|
||||
|
||||
UM.I18nCatalog { id: catalog; name: "cura"; }
|
||||
SystemPalette { id: palette }
|
||||
}
|
||||
|
||||
onCurrentItemChanged:
|
||||
{
|
||||
if(currentItem == null)
|
||||
{
|
||||
return
|
||||
}
|
||||
materialProperties.name = currentItem.name;
|
||||
materialProperties.guid = Cura.ContainerManager.getContainerMetaDataEntry(base.currentItem.id, "GUID");
|
||||
|
||||
if(currentItem.metadata != undefined && currentItem.metadata != null)
|
||||
{
|
||||
materialProperties.supplier = currentItem.metadata.brand ? currentItem.metadata.brand : "Unknown";
|
||||
materialProperties.material_type = currentItem.metadata.material ? currentItem.metadata.material : "Unknown";
|
||||
materialProperties.color_name = currentItem.metadata.color_name ? currentItem.metadata.color_name : "Yellow";
|
||||
materialProperties.color_code = currentItem.metadata.color_code ? currentItem.metadata.color_code : "yellow";
|
||||
|
||||
materialProperties.description = currentItem.metadata.description ? currentItem.metadata.description : "";
|
||||
materialProperties.adhesion_info = currentItem.metadata.adhesion_info ? currentItem.metadata.adhesion_info : "";
|
||||
|
||||
if(currentItem.metadata.properties != undefined && currentItem.metadata.properties != null)
|
||||
{
|
||||
materialProperties.density = currentItem.metadata.properties.density ? currentItem.metadata.properties.density : 0.0;
|
||||
materialProperties.diameter = currentItem.metadata.properties.diameter ? currentItem.metadata.properties.diameter : 0.0;
|
||||
materialProperties.approximate_diameter = currentItem.metadata.approximate_diameter ? currentItem.metadata.approximate_diameter : "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
materialProperties.density = 0.0;
|
||||
materialProperties.diameter = 0.0;
|
||||
materialProperties.approximate_diameter = "0";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
@ -11,10 +11,8 @@ Tab
|
|||
{
|
||||
id: base
|
||||
|
||||
property string extruderId: "";
|
||||
property string extruderDefinition: "";
|
||||
property string quality: "";
|
||||
property string material: "";
|
||||
property string extruderPosition: ""
|
||||
property var qualityItem: null
|
||||
|
||||
TableView
|
||||
{
|
||||
|
@ -38,8 +36,8 @@ Tab
|
|||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.right: parent.right
|
||||
text: (styleData.value.substr(0,1) == "=") ? catalog.i18nc("@info:status", "Calculated") : styleData.value
|
||||
font.strikeout: styleData.column == 1 && quality == Cura.MachineManager.globalQualityId && setting.user_value != ""
|
||||
font.italic: setting.profile_value_source == "quality_changes" || (quality == Cura.MachineManager.globalQualityId && setting.user_value != "")
|
||||
font.strikeout: styleData.column == 1 && setting.user_value != "" && qualityItem.name == Cura.MachineManager.activeQualityOrQualityChangesName
|
||||
font.italic: setting.profile_value_source == "quality_changes" || (setting.user_value != "" && qualityItem.name == Cura.MachineManager.activeQualityOrQualityChangesName)
|
||||
opacity: font.strikeout ? 0.5 : 1
|
||||
color: styleData.textColor
|
||||
elide: Text.ElideRight
|
||||
|
@ -65,7 +63,7 @@ Tab
|
|||
{
|
||||
role: "user_value"
|
||||
title: catalog.i18nc("@title:column", "Current");
|
||||
visible: quality == Cura.MachineManager.globalQualityId
|
||||
visible: qualityItem.name == Cura.MachineManager.activeQualityOrQualityChangesName
|
||||
width: (parent.width * 0.18) | 0
|
||||
delegate: itemDelegate
|
||||
}
|
||||
|
@ -87,10 +85,8 @@ Tab
|
|||
model: Cura.QualitySettingsModel
|
||||
{
|
||||
id: qualitySettings
|
||||
extruderId: base.extruderId
|
||||
extruderDefinition: base.extruderDefinition
|
||||
quality: base.quality != null ? base.quality : ""
|
||||
material: base.material != null ? base.material : ""
|
||||
selectedPosition: base.extruderPosition
|
||||
selectedQualityItem: base.qualityItem
|
||||
}
|
||||
|
||||
SystemPalette { id: palette }
|
||||
|
|
|
@ -1,355 +1,532 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
UM.ManagementPage
|
||||
|
||||
Item
|
||||
{
|
||||
id: base;
|
||||
id: base
|
||||
|
||||
title: catalog.i18nc("@title:tab", "Profiles");
|
||||
property var extrudersModel: Cura.ExtrudersModel{}
|
||||
property QtObject qualityManager: CuraApplication.getQualityManager()
|
||||
property var resetEnabled: false // Keep PreferencesDialog happy
|
||||
property var extrudersModel: Cura.ExtrudersModel {}
|
||||
|
||||
model: Cura.QualityAndUserProfilesModel { }
|
||||
UM.I18nCatalog { id: catalog; name: "cura"; }
|
||||
|
||||
section.property: "readOnly"
|
||||
section.delegate: Rectangle
|
||||
Cura.QualityManagementModel {
|
||||
id: qualitiesModel
|
||||
}
|
||||
|
||||
Label {
|
||||
id: titleLabel
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: 5 * screenScaleFactor
|
||||
}
|
||||
font.pointSize: 18
|
||||
text: catalog.i18nc("@title:tab", "Profiles")
|
||||
}
|
||||
|
||||
property var hasCurrentItem: qualityListView.currentItem != null
|
||||
|
||||
property var currentItem: {
|
||||
var current_index = qualityListView.currentIndex;
|
||||
return qualitiesModel.getItem(current_index);
|
||||
}
|
||||
|
||||
property var isCurrentItemActivated: {
|
||||
if (!base.currentItem) {
|
||||
return false;
|
||||
}
|
||||
return base.currentItem.name == Cura.MachineManager.activeQualityOrQualityChangesName;
|
||||
}
|
||||
|
||||
property var canCreateProfile: {
|
||||
return isCurrentItemActivated && Cura.MachineManager.hasUserSettings;
|
||||
}
|
||||
|
||||
Row // Button Row
|
||||
{
|
||||
height: childrenRect.height;
|
||||
|
||||
Label
|
||||
{
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: UM.Theme.getSize("default_lining").width;
|
||||
text: section == "true" ? catalog.i18nc("@label", "Protected profiles") : catalog.i18nc("@label", "Custom profiles")
|
||||
font.bold: true
|
||||
id: buttonRow
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: titleLabel.bottom
|
||||
}
|
||||
}
|
||||
height: childrenRect.height
|
||||
|
||||
activeId: Cura.MachineManager.activeQualityId
|
||||
activeIndex: {
|
||||
for(var i = 0; i < model.rowCount(); i++) {
|
||||
if (model.getItem(i).id == Cura.MachineManager.activeQualityId) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function canCreateProfile() {
|
||||
return base.currentItem && (base.currentItem.id == Cura.MachineManager.activeQualityId) && Cura.MachineManager.hasUserSettings;
|
||||
}
|
||||
|
||||
buttons: [
|
||||
// Activate button
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Activate");
|
||||
iconName: "list-activate";
|
||||
enabled: base.currentItem != null ? base.currentItem.id != Cura.MachineManager.activeQualityId : false;
|
||||
onClicked:
|
||||
{
|
||||
Cura.MachineManager.setActiveQuality(base.currentItem.id)
|
||||
currentItem = base.model.getItem(base.objectList.currentIndex) // Refresh the current item.
|
||||
text: catalog.i18nc("@action:button", "Activate")
|
||||
iconName: "list-activate"
|
||||
enabled: !isCurrentItemActivated
|
||||
onClicked: {
|
||||
if (base.currentItem.is_read_only) {
|
||||
Cura.MachineManager.setQualityGroup(base.currentItem.quality_group);
|
||||
} else {
|
||||
Cura.MachineManager.setQualityChangesGroup(base.currentItem.quality_changes_group);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// Create button
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@label", "Create")
|
||||
enabled: base.canCreateProfile() && !Cura.MachineManager.stacksHaveErrors
|
||||
visible: base.canCreateProfile()
|
||||
iconName: "list-add";
|
||||
iconName: "list-add"
|
||||
enabled: base.canCreateProfile && !Cura.MachineManager.stacksHaveErrors
|
||||
visible: base.canCreateProfile
|
||||
|
||||
onClicked:
|
||||
{
|
||||
newNameDialog.object = base.currentItem != null ? Cura.ContainerManager.makeUniqueName(base.currentItem.name) : "";
|
||||
newNameDialog.open();
|
||||
newNameDialog.selectText();
|
||||
onClicked: {
|
||||
createQualityDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name);
|
||||
createQualityDialog.open();
|
||||
createQualityDialog.selectText();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// Duplicate button
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@label", "Duplicate")
|
||||
enabled: ! base.canCreateProfile()
|
||||
visible: ! base.canCreateProfile()
|
||||
iconName: "list-add";
|
||||
iconName: "list-add"
|
||||
enabled: !base.canCreateProfile
|
||||
visible: !base.canCreateProfile
|
||||
|
||||
onClicked:
|
||||
{
|
||||
newDuplicateNameDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name);
|
||||
newDuplicateNameDialog.open();
|
||||
newDuplicateNameDialog.selectText();
|
||||
onClicked: {
|
||||
duplicateQualityDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name);
|
||||
duplicateQualityDialog.open();
|
||||
duplicateQualityDialog.selectText();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// Remove button
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Remove");
|
||||
iconName: "list-remove";
|
||||
enabled: base.currentItem != null ? !base.currentItem.readOnly && !Cura.ContainerManager.isContainerUsed(base.currentItem.id) : false;
|
||||
onClicked: confirmDialog.open();
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Rename");
|
||||
iconName: "edit-rename";
|
||||
enabled: base.currentItem != null ? !base.currentItem.readOnly : false;
|
||||
onClicked:
|
||||
{
|
||||
renameDialog.open();
|
||||
renameDialog.selectText();
|
||||
text: catalog.i18nc("@action:button", "Remove")
|
||||
iconName: "list-remove"
|
||||
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated
|
||||
onClicked: {
|
||||
forceActiveFocus();
|
||||
confirmRemoveQualityDialog.open();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// Rename button
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Import");
|
||||
iconName: "document-import";
|
||||
onClicked: importDialog.open();
|
||||
},
|
||||
text: catalog.i18nc("@action:button", "Rename")
|
||||
iconName: "edit-rename"
|
||||
enabled: base.hasCurrentItem && !base.currentItem.is_read_only
|
||||
onClicked: {
|
||||
renameQualityDialog.object = base.currentItem.name;
|
||||
renameQualityDialog.open();
|
||||
renameQualityDialog.selectText();
|
||||
}
|
||||
}
|
||||
|
||||
// Import button
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Import")
|
||||
iconName: "document-import"
|
||||
onClicked: {
|
||||
importDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
// Export button
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Export")
|
||||
iconName: "document-export"
|
||||
onClicked: exportDialog.open()
|
||||
enabled: currentItem != null && !base.currentItem.readOnly
|
||||
enabled: base.hasCurrentItem && !base.currentItem.is_read_only
|
||||
onClicked: {
|
||||
exportDialog.open();
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
scrollviewCaption: catalog.i18nc("@label %1 is printer name","Printer: %1").arg(Cura.MachineManager.activeMachineName)
|
||||
}
|
||||
|
||||
// Click create profile from ... in Profile context menu
|
||||
signal createProfile()
|
||||
onCreateProfile:
|
||||
{
|
||||
newNameDialog.object = base.currentItem != null ? Cura.ContainerManager.makeUniqueName(base.currentItem.name) : "";
|
||||
newNameDialog.open();
|
||||
newNameDialog.selectText();
|
||||
createQualityDialog.object = Cura.ContainerManager.makeUniqueName(Cura.MachineManager.activeQualityOrQualityChangesName);
|
||||
createQualityDialog.open();
|
||||
createQualityDialog.selectText();
|
||||
}
|
||||
|
||||
signal selectContainer(string name)
|
||||
onSelectContainer:
|
||||
// Dialog to request a name when creating a new profile
|
||||
UM.RenameDialog
|
||||
{
|
||||
objectList.currentIndex = objectList.model.find("name", name);
|
||||
id: createQualityDialog
|
||||
title: catalog.i18nc("@title:window", "Create Profile")
|
||||
object: "<new name>"
|
||||
onAccepted:
|
||||
{
|
||||
base.newQualityNameToSelect = newName; // We want to switch to the new profile once it's created
|
||||
base.toActivateNewQuality = true;
|
||||
base.qualityManager.createQualityChanges(newName);
|
||||
}
|
||||
}
|
||||
|
||||
property string newQualityNameToSelect: ""
|
||||
property bool toActivateNewQuality: false
|
||||
|
||||
// This connection makes sure that we will switch to the correct quality after the model gets updated
|
||||
Connections
|
||||
{
|
||||
target: qualitiesModel
|
||||
onItemsChanged: {
|
||||
var toSelectItemName = base.currentItem == null ? "" : base.currentItem.name;
|
||||
if (newQualityNameToSelect != "") {
|
||||
toSelectItemName = newQualityNameToSelect;
|
||||
}
|
||||
|
||||
var newIdx = -1; // Default to nothing if nothing can be found
|
||||
if (toSelectItemName != "") {
|
||||
// Select the required quality name if given
|
||||
for (var idx = 0; idx < qualitiesModel.rowCount(); ++idx) {
|
||||
var item = qualitiesModel.getItem(idx);
|
||||
if (item.name == toSelectItemName) {
|
||||
// Switch to the newly created profile if needed
|
||||
newIdx = idx;
|
||||
if (base.toActivateNewQuality) {
|
||||
// Activate this custom quality if required
|
||||
Cura.MachineManager.setQualityChangesGroup(item.quality_changes_group);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
qualityListView.currentIndex = newIdx;
|
||||
|
||||
// Reset states
|
||||
base.newQualityNameToSelect = "";
|
||||
base.toActivateNewQuality = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Dialog to request a name when duplicating a new profile
|
||||
UM.RenameDialog
|
||||
{
|
||||
id: duplicateQualityDialog
|
||||
title: catalog.i18nc("@title:window", "Duplicate Profile")
|
||||
object: "<new name>"
|
||||
onAccepted:
|
||||
{
|
||||
base.qualityManager.duplicateQualityChanges(newName, base.currentItem);
|
||||
}
|
||||
}
|
||||
|
||||
// Confirmation dialog for removing a profile
|
||||
MessageDialog
|
||||
{
|
||||
id: confirmRemoveQualityDialog
|
||||
|
||||
icon: StandardIcon.Question;
|
||||
title: catalog.i18nc("@title:window", "Confirm Remove")
|
||||
text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItem.name)
|
||||
standardButtons: StandardButton.Yes | StandardButton.No
|
||||
modality: Qt.ApplicationModal
|
||||
|
||||
onYes:
|
||||
{
|
||||
base.qualityManager.removeQualityChangesGroup(base.currentItem.quality_changes_group);
|
||||
// reset current item to the first if available
|
||||
qualityListView.currentIndex = -1; // Reset selection.
|
||||
}
|
||||
}
|
||||
|
||||
// Dialog to rename a quality profile
|
||||
UM.RenameDialog
|
||||
{
|
||||
id: renameQualityDialog
|
||||
title: catalog.i18nc("@title:window", "Rename Profile")
|
||||
object: "<new name>"
|
||||
onAccepted:
|
||||
{
|
||||
var actualNewName = base.qualityManager.renameQualityChangesGroup(base.currentItem.quality_changes_group, newName);
|
||||
base.newQualityNameToSelect = actualNewName; // Select the new name after the model gets updated
|
||||
}
|
||||
}
|
||||
|
||||
// Dialog for importing a quality profile
|
||||
FileDialog
|
||||
{
|
||||
id: importDialog
|
||||
title: catalog.i18nc("@title:window", "Import Profile")
|
||||
selectExisting: true
|
||||
nameFilters: qualitiesModel.getFileNameFilters("profile_reader")
|
||||
folder: CuraApplication.getDefaultPath("dialog_profile_path")
|
||||
onAccepted:
|
||||
{
|
||||
var result = Cura.ContainerManager.importProfile(fileUrl);
|
||||
messageDialog.text = result.message;
|
||||
if (result.status == "ok") {
|
||||
messageDialog.icon = StandardIcon.Information;
|
||||
}
|
||||
else if (result.status == "duplicate") {
|
||||
messageDialog.icon = StandardIcon.Warning;
|
||||
}
|
||||
else {
|
||||
messageDialog.icon = StandardIcon.Critical;
|
||||
}
|
||||
messageDialog.open();
|
||||
CuraApplication.setDefaultPath("dialog_profile_path", folder);
|
||||
}
|
||||
}
|
||||
|
||||
// Dialog for exporting a quality profile
|
||||
FileDialog
|
||||
{
|
||||
id: exportDialog
|
||||
title: catalog.i18nc("@title:window", "Export Profile")
|
||||
selectExisting: false
|
||||
nameFilters: qualitiesModel.getFileNameFilters("profile_writer")
|
||||
folder: CuraApplication.getDefaultPath("dialog_profile_path")
|
||||
onAccepted:
|
||||
{
|
||||
var result = Cura.ContainerManager.exportQualityChangesGroup(base.currentItem.quality_changes_group,
|
||||
fileUrl, selectedNameFilter);
|
||||
|
||||
if (result && result.status == "error") {
|
||||
messageDialog.icon = StandardIcon.Critical;
|
||||
messageDialog.text = result.message;
|
||||
messageDialog.open();
|
||||
}
|
||||
|
||||
// else pop-up Message thing from python code
|
||||
CuraApplication.setDefaultPath("dialog_profile_path", folder);
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
visible: base.currentItem != null
|
||||
anchors.fill: parent
|
||||
id: contentsItem
|
||||
|
||||
Label {
|
||||
id: profileName
|
||||
text: base.currentItem ? base.currentItem.name: ""
|
||||
font: UM.Theme.getFont("large")
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
anchors {
|
||||
top: titleLabel.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: 5 * screenScaleFactor
|
||||
bottomMargin: 0
|
||||
}
|
||||
|
||||
Flow {
|
||||
id: currentSettingsActions
|
||||
visible: currentItem && currentItem.id == Cura.MachineManager.activeQualityId
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: profileName.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
|
||||
Button
|
||||
{
|
||||
text: {
|
||||
return catalog.i18nc("@action:button", "Update profile with current settings/overrides");
|
||||
}
|
||||
enabled: Cura.MachineManager.hasUserSettings && !Cura.MachineManager.isReadOnly(Cura.MachineManager.activeQualityId)
|
||||
onClicked: Cura.ContainerManager.updateQualityChanges()
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Discard current changes");
|
||||
enabled: Cura.MachineManager.hasUserSettings
|
||||
onClicked: Cura.ContainerManager.clearUserContainers();
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: profileNotices
|
||||
anchors.top: currentSettingsActions.visible ? currentSettingsActions.bottom : currentSettingsActions.anchors.top
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
||||
Label {
|
||||
id: defaultsMessage
|
||||
visible: false
|
||||
text: catalog.i18nc("@action:label", "This profile uses the defaults specified by the printer, so it has no settings/overrides in the list below.")
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
}
|
||||
Label {
|
||||
id: noCurrentSettingsMessage
|
||||
visible: currentItem && currentItem.id == Cura.MachineManager.activeQualityId && !Cura.MachineManager.hasUserSettings
|
||||
text: catalog.i18nc("@action:label", "Your current settings match the selected profile.")
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
TabView
|
||||
{
|
||||
anchors.left: parent.left
|
||||
anchors.top: profileNotices.visible ? profileNotices.bottom : profileNotices.anchors.top
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
currentIndex: Cura.ExtruderManager.extruderCount > 0 ? Cura.ExtruderManager.activeExtruderIndex + 1 : 0
|
||||
|
||||
ProfileTab
|
||||
{
|
||||
title: catalog.i18nc("@title:tab", "Global Settings");
|
||||
quality: base.currentItem != null ? base.currentItem.id : "";
|
||||
material: Cura.MachineManager.allActiveMaterialIds[Cura.MachineManager.activeMachineId]
|
||||
}
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: base.extrudersModel
|
||||
|
||||
ProfileTab
|
||||
{
|
||||
title: model.name;
|
||||
extruderId: model.id;
|
||||
extruderDefinition: model.definition;
|
||||
quality: base.currentItem != null ? base.currentItem.id : "";
|
||||
material: Cura.MachineManager.allActiveMaterialIds[model.id]
|
||||
}
|
||||
}
|
||||
}
|
||||
clip: true
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
UM.I18nCatalog { id: catalog; name: "cura"; }
|
||||
anchors {
|
||||
top: buttonRow.bottom
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
UM.ConfirmRemoveDialog
|
||||
SystemPalette { id: palette }
|
||||
|
||||
Label
|
||||
{
|
||||
id: confirmDialog
|
||||
object: base.currentItem != null ? base.currentItem.name : ""
|
||||
onYes:
|
||||
id: captionLabel
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
}
|
||||
visible: text != ""
|
||||
text: catalog.i18nc("@label %1 is printer name", "Printer: %1").arg(Cura.MachineManager.activeMachineName)
|
||||
width: profileScrollView.width
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
ScrollView
|
||||
{
|
||||
id: profileScrollView
|
||||
anchors {
|
||||
top: captionLabel.visible ? captionLabel.bottom : parent.top
|
||||
topMargin: captionLabel.visible ? UM.Theme.getSize("default_margin").height : 0
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
parent: viewport
|
||||
anchors.fill: parent
|
||||
color: palette.light
|
||||
}
|
||||
|
||||
width: true ? (parent.width * 0.4) | 0 : parent.width
|
||||
|
||||
ListView
|
||||
{
|
||||
var name = base.currentItem.name;
|
||||
Cura.ContainerManager.removeQualityChanges(name)
|
||||
if(Cura.MachineManager.activeQualityName == name)
|
||||
id: qualityListView
|
||||
|
||||
model: qualitiesModel
|
||||
|
||||
section.property: "is_read_only"
|
||||
section.delegate: Rectangle
|
||||
{
|
||||
Cura.MachineManager.setActiveQuality(base.model.getItem(0).name)
|
||||
height: childrenRect.height
|
||||
|
||||
Label
|
||||
{
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_lining").width
|
||||
text: section == "true" ? catalog.i18nc("@label", "Protected profiles") : catalog.i18nc("@label", "Custom profiles")
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Rectangle
|
||||
{
|
||||
width: profileScrollView.width
|
||||
height: childrenRect.height
|
||||
color: ListView.isCurrentItem ? palette.highlight : (model.index % 2) ? palette.base : palette.alternateBase
|
||||
|
||||
Row
|
||||
{
|
||||
spacing: (UM.Theme.getSize("default_margin").width / 2) | 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.right: parent.right
|
||||
Label
|
||||
{
|
||||
width: Math.floor((parent.width * 0.8))
|
||||
text: model.name
|
||||
elide: Text.ElideRight
|
||||
font.italic: model.name == Cura.MachineManager.activeQualityOrQualityChangesName
|
||||
color: parent.ListView.isCurrentItem ? palette.highlightedText : palette.text
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
parent.ListView.view.currentIndex = model.index;
|
||||
}
|
||||
}
|
||||
}
|
||||
objectList.currentIndex = -1 //Reset selection.
|
||||
}
|
||||
}
|
||||
|
||||
UM.RenameDialog
|
||||
// details panel on the right
|
||||
Item
|
||||
{
|
||||
title: catalog.i18nc("@title:window", "Rename Profile")
|
||||
id: renameDialog;
|
||||
object: base.currentItem != null ? base.currentItem.name : ""
|
||||
onAccepted:
|
||||
{
|
||||
Cura.ContainerManager.renameQualityChanges(base.currentItem.name, newName)
|
||||
objectList.currentIndex = -1 //Reset selection.
|
||||
id: detailsPanel
|
||||
|
||||
anchors {
|
||||
left: profileScrollView.right
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
|
||||
// Dialog to request a name when creating a new profile
|
||||
UM.RenameDialog
|
||||
{
|
||||
title: catalog.i18nc("@title:window", "Create Profile")
|
||||
id: newNameDialog;
|
||||
object: "<new name>";
|
||||
onAccepted:
|
||||
Item
|
||||
{
|
||||
var selectedContainer = Cura.ContainerManager.createQualityChanges(newName);
|
||||
base.selectContainer(selectedContainer);
|
||||
objectList.currentIndex = -1 //Reset selection.
|
||||
}
|
||||
}
|
||||
anchors.fill: parent
|
||||
|
||||
// Dialog to request a name when duplicating a new profile
|
||||
UM.RenameDialog
|
||||
{
|
||||
title: catalog.i18nc("@title:window", "Duplicate Profile")
|
||||
id: newDuplicateNameDialog;
|
||||
object: "<new name>";
|
||||
onAccepted:
|
||||
{
|
||||
var selectedContainer = Cura.ContainerManager.duplicateQualityOrQualityChanges(base.currentItem.name, newName);
|
||||
base.selectContainer(selectedContainer);
|
||||
objectList.currentIndex = -1 //Reset selection.
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: messageDialog
|
||||
title: catalog.i18nc("@window:title", "Import Profile");
|
||||
standardButtons: StandardButton.Ok
|
||||
modality: Qt.ApplicationModal
|
||||
}
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: importDialog;
|
||||
title: catalog.i18nc("@title:window", "Import Profile");
|
||||
selectExisting: true;
|
||||
nameFilters: base.model.getFileNameFilters("profile_reader")
|
||||
folder: CuraApplication.getDefaultPath("dialog_profile_path")
|
||||
onAccepted:
|
||||
{
|
||||
var result = Cura.ContainerManager.importProfile(fileUrl);
|
||||
messageDialog.text = result.message
|
||||
if(result.status == "ok")
|
||||
Item // Profile title Label
|
||||
{
|
||||
messageDialog.icon = StandardIcon.Information
|
||||
}
|
||||
else if(result.status == "duplicate")
|
||||
{
|
||||
messageDialog.icon = StandardIcon.Warning
|
||||
}
|
||||
else
|
||||
{
|
||||
messageDialog.icon = StandardIcon.Critical
|
||||
}
|
||||
messageDialog.open()
|
||||
CuraApplication.setDefaultPath("dialog_profile_path", folder)
|
||||
}
|
||||
}
|
||||
id: profileName
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: exportDialog;
|
||||
title: catalog.i18nc("@title:window", "Export Profile");
|
||||
selectExisting: false;
|
||||
nameFilters: base.model.getFileNameFilters("profile_writer")
|
||||
folder: CuraApplication.getDefaultPath("dialog_profile_path")
|
||||
onAccepted:
|
||||
{
|
||||
var containers = Cura.ContainerManager.findInstanceContainers({"type": "quality_changes", "name": base.currentItem.name})
|
||||
var result = Cura.ContainerManager.exportProfile(containers, fileUrl, selectedNameFilter)
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
|
||||
if(result && result.status == "error")
|
||||
{
|
||||
messageDialog.icon = StandardIcon.Critical
|
||||
messageDialog.text = result.message
|
||||
messageDialog.open()
|
||||
Label {
|
||||
text: base.currentItem.name
|
||||
font: UM.Theme.getFont("large")
|
||||
}
|
||||
}
|
||||
|
||||
// else pop-up Message thing from python code
|
||||
CuraApplication.setDefaultPath("dialog_profile_path", folder)
|
||||
Flow {
|
||||
id: currentSettingsActions
|
||||
visible: base.hasCurrentItem && base.currentItem.name == Cura.MachineManager.activeQualityOrQualityChangesName
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: profileName.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Update profile with current settings/overrides")
|
||||
enabled: Cura.MachineManager.hasUserSettings && !base.currentItem.is_read_only
|
||||
onClicked: Cura.ContainerManager.updateQualityChanges()
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Discard current changes");
|
||||
enabled: Cura.MachineManager.hasUserSettings
|
||||
onClicked: Cura.ContainerManager.clearUserContainers();
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: profileNotices
|
||||
anchors.top: currentSettingsActions.visible ? currentSettingsActions.bottom : currentSettingsActions.anchors.top
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
||||
Label {
|
||||
id: defaultsMessage
|
||||
visible: false
|
||||
text: catalog.i18nc("@action:label", "This profile uses the defaults specified by the printer, so it has no settings/overrides in the list below.")
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
}
|
||||
Label {
|
||||
id: noCurrentSettingsMessage
|
||||
visible: base.isCurrentItemActivated && !Cura.MachineManager.hasUserSettings
|
||||
text: catalog.i18nc("@action:label", "Your current settings match the selected profile.")
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TabView
|
||||
{
|
||||
anchors.left: parent.left
|
||||
anchors.top: profileNotices.visible ? profileNotices.bottom : profileNotices.anchors.top
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
currentIndex: 0
|
||||
|
||||
ProfileTab
|
||||
{
|
||||
title: catalog.i18nc("@title:tab", "Global Settings")
|
||||
qualityItem: base.currentItem
|
||||
}
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: base.extrudersModel
|
||||
|
||||
ProfileTab
|
||||
{
|
||||
title: model.name
|
||||
extruderPosition: model.index
|
||||
qualityItem: base.currentItem
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue