mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-11 16:00:47 -07:00
Merge branch 'master' into feature_sync_button
This commit is contained in:
commit
13e18c9d54
568 changed files with 6406 additions and 6604 deletions
|
|
@ -69,7 +69,6 @@ Item
|
|||
property alias configureSettingVisibility: configureSettingVisibilityAction
|
||||
|
||||
property alias browsePlugins: browsePluginsAction
|
||||
property alias configurePlugins: configurePluginsAction
|
||||
|
||||
UM.I18nCatalog{id: catalog; name:"cura"}
|
||||
|
||||
|
|
@ -173,7 +172,7 @@ Item
|
|||
Action
|
||||
{
|
||||
id: updateProfileAction;
|
||||
enabled: !Cura.MachineManager.stacksHaveErrors && Cura.MachineManager.hasUserSettings && !Cura.MachineManager.isReadOnly(Cura.MachineManager.activeQualityId)
|
||||
enabled: !Cura.MachineManager.stacksHaveErrors && Cura.MachineManager.hasUserSettings && Cura.MachineManager.activeQualityChangesGroup != null
|
||||
text: catalog.i18nc("@action:inmenu menubar:profile","&Update profile with current settings/overrides");
|
||||
onTriggered: Cura.ContainerManager.updateQualityChanges();
|
||||
}
|
||||
|
|
@ -237,6 +236,16 @@ Item
|
|||
onTriggered: CuraActions.deleteSelection();
|
||||
}
|
||||
|
||||
Action //Also add backspace as the same function as delete because on Macintosh keyboards the button called "delete" is actually a backspace, and the user expects it to function as a delete.
|
||||
{
|
||||
id: backspaceSelectionAction
|
||||
text: catalog.i18ncp("@action:inmenu menubar:edit", "Delete &Selected Model", "Delete &Selected Models", UM.Selection.selectionCount)
|
||||
enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection
|
||||
iconName: "edit-delete"
|
||||
shortcut: StandardKey.Backspace
|
||||
onTriggered: CuraActions.deleteSelection()
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: centerSelectionAction;
|
||||
|
|
@ -425,13 +434,6 @@ Item
|
|||
iconName: "plugins_browse"
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: configurePluginsAction
|
||||
text: catalog.i18nc("@action:menu", "Installed plugins...");
|
||||
iconName: "plugins_configure"
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: expandSidebarAction;
|
||||
|
|
|
|||
|
|
@ -190,24 +190,25 @@ UM.MainWindow
|
|||
model: Cura.ExtrudersModel { simpleNames: true }
|
||||
Menu {
|
||||
title: model.name
|
||||
visible: machineExtruderCount.properties.value > 1
|
||||
|
||||
NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index }
|
||||
MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials; extruderIndex: index }
|
||||
ProfileMenu { title: catalog.i18nc("@title:menu", "&Profile"); }
|
||||
|
||||
MenuSeparator { }
|
||||
MenuSeparator {
|
||||
visible: Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials
|
||||
}
|
||||
|
||||
MenuItem { text: catalog.i18nc("@action:inmenu", "Set as Active Extruder"); onTriggered: Cura.ExtruderManager.setActiveExtruderIndex(model.index) }
|
||||
MenuItem {
|
||||
text: catalog.i18nc("@action:inmenu", "Set as Active Extruder")
|
||||
onTriggered: Cura.ExtruderManager.setActiveExtruderIndex(model.index)
|
||||
}
|
||||
}
|
||||
onObjectAdded: settingsMenu.insertItem(index, object)
|
||||
onObjectRemoved: settingsMenu.removeItem(object)
|
||||
}
|
||||
|
||||
BuildplateMenu { title: catalog.i18nc("@title:menu", "&Build plate"); visible: Cura.MachineManager.hasVariantBuildplates }
|
||||
NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: machineExtruderCount.properties.value <= 1 && Cura.MachineManager.hasVariants }
|
||||
MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: machineExtruderCount.properties.value <= 1 && Cura.MachineManager.hasMaterials }
|
||||
ProfileMenu { title: catalog.i18nc("@title:menu", "&Profile"); visible: machineExtruderCount.properties.value <= 1 }
|
||||
ProfileMenu { title: catalog.i18nc("@title:menu", "&Profile"); }
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
|
|
@ -254,7 +255,6 @@ UM.MainWindow
|
|||
title: catalog.i18nc("@title:menu menubar:toplevel", "P&lugins")
|
||||
|
||||
MenuItem { action: Cura.Actions.browsePlugins }
|
||||
MenuItem { action: Cura.Actions.configurePlugins }
|
||||
}
|
||||
|
||||
Menu
|
||||
|
|
@ -477,6 +477,14 @@ UM.MainWindow
|
|||
collapseSidebarAnimation.start();
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
visible: UM.Controller.activeStage.sidebarComponent != ""
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.AllButtons
|
||||
onWheel: wheel.accepted = true
|
||||
}
|
||||
}
|
||||
|
||||
UM.MessageStack
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import QtQuick.Dialogs 1.2
|
|||
import QtQuick.Window 2.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.1 as Cura
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
UM.Dialog
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
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
|
||||
|
|
@ -12,28 +12,22 @@ Menu
|
|||
id: menu
|
||||
title: "Build plate"
|
||||
|
||||
property var buildPlateModel: CuraApplication.getBuildPlateModel()
|
||||
|
||||
Instantiator
|
||||
{
|
||||
id: buildplateInstantiator
|
||||
model: UM.InstanceContainersModel
|
||||
{
|
||||
filter:
|
||||
{
|
||||
"type": "variant",
|
||||
"hardware_type": "buildplate",
|
||||
"definition": Cura.MachineManager.activeDefinitionId //Only show variants of this machine
|
||||
}
|
||||
}
|
||||
model: menu.buildPlateModel
|
||||
|
||||
MenuItem {
|
||||
text: model.name
|
||||
checkable: true
|
||||
checked: model.id == Cura.MachineManager.globalVariantId
|
||||
checked: model.name == Cura.MachineManager.globalVariantName
|
||||
exclusiveGroup: group
|
||||
onTriggered:
|
||||
{
|
||||
Cura.MachineManager.setActiveVariantBuildplate(model.id);
|
||||
onTriggered: {
|
||||
Cura.MachineManager.setGlobalVariant(model.container_node);
|
||||
}
|
||||
}
|
||||
|
||||
onObjectAdded: menu.insertItem(index, object)
|
||||
onObjectRemoved: menu.removeItem(object)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import QtQuick.Dialogs 1.2
|
|||
import QtQuick.Window 2.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.2 as Cura
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Menu
|
||||
{
|
||||
|
|
@ -15,6 +15,8 @@ Menu
|
|||
|
||||
property bool shouldShowExtruders: machineExtruderCount.properties.value > 1;
|
||||
|
||||
property var multiBuildPlateModel: CuraApplication.getMultiBuildPlateModel()
|
||||
|
||||
// Selection-related actions.
|
||||
MenuItem { action: Cura.Actions.centerSelection; }
|
||||
MenuItem { action: Cura.Actions.deleteSelection; }
|
||||
|
|
@ -45,13 +47,13 @@ Menu
|
|||
|
||||
Instantiator
|
||||
{
|
||||
model: Cura.BuildPlateModel
|
||||
model: base.multiBuildPlateModel
|
||||
MenuItem {
|
||||
enabled: UM.Selection.hasSelection
|
||||
text: Cura.BuildPlateModel.getItem(index).name;
|
||||
onTriggered: CuraActions.setBuildPlateForSelection(Cura.BuildPlateModel.getItem(index).buildPlateNumber);
|
||||
text: base.multiBuildPlateModel.getItem(index).name;
|
||||
onTriggered: CuraActions.setBuildPlateForSelection(base.multiBuildPlateModel.getItem(index).buildPlateNumber);
|
||||
checkable: true
|
||||
checked: Cura.BuildPlateModel.selectionBuildPlates.indexOf(Cura.BuildPlateModel.getItem(index).buildPlateNumber) != -1;
|
||||
checked: base.multiBuildPlateModel.selectionBuildPlates.indexOf(base.multiBuildPlateModel.getItem(index).buildPlateNumber) != -1;
|
||||
visible: UM.Preferences.getValue("cura/use_multi_build_plate")
|
||||
}
|
||||
onObjectAdded: base.insertItem(index, object);
|
||||
|
|
@ -62,7 +64,7 @@ Menu
|
|||
enabled: UM.Selection.hasSelection
|
||||
text: "New build plate";
|
||||
onTriggered: {
|
||||
CuraActions.setBuildPlateForSelection(Cura.BuildPlateModel.maxBuildPlate + 1);
|
||||
CuraActions.setBuildPlateForSelection(base.multiBuildPlateModel.maxBuildPlate + 1);
|
||||
checked = false;
|
||||
}
|
||||
checkable: true
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
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
|
||||
|
|
@ -13,64 +13,6 @@ Menu
|
|||
title: "Material"
|
||||
|
||||
property int extruderIndex: 0
|
||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||
property bool isClusterPrinter:
|
||||
{
|
||||
if(Cura.MachineManager.printerOutputDevices.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize;
|
||||
// This is not a cluster printer or the cluster it is just one printer
|
||||
if(clusterSize == undefined || clusterSize == 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: materialDiameterProvider
|
||||
|
||||
containerStackId: Cura.ExtruderManager.activeExtruderStackId
|
||||
key: "material_diameter"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 5
|
||||
}
|
||||
|
||||
MenuItem
|
||||
{
|
||||
id: automaticMaterial
|
||||
text:
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
var materialName = Cura.MachineManager.printerOutputDevices[0].materialNames[extruderIndex];
|
||||
return catalog.i18nc("@title:menuitem %1 is the automatically selected material", "Automatic: %1").arg(materialName);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].materialNames != undefined && Cura.MachineManager.printerOutputDevices[0].materialNames.length > extruderIndex && !isClusterPrinter
|
||||
onTriggered:
|
||||
{
|
||||
var materialId = Cura.MachineManager.printerOutputDevices[0].materialIds[extruderIndex];
|
||||
var items = materialsModel.items;
|
||||
for(var i in items)
|
||||
{
|
||||
if (items[i]["metadata"]["GUID"] == materialId)
|
||||
{
|
||||
Cura.MachineManager.setActiveMaterial(items[i].id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator
|
||||
{
|
||||
visible: automaticMaterial.visible
|
||||
}
|
||||
|
||||
Instantiator
|
||||
{
|
||||
|
|
@ -79,16 +21,11 @@ Menu
|
|||
{
|
||||
text: model.name
|
||||
checkable: true
|
||||
checked: model.id == Cura.MachineManager.allActiveMaterialIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
|
||||
checked: model.root_material_id == Cura.MachineManager.currentRootMaterialId[extruderIndex]
|
||||
exclusiveGroup: group
|
||||
onTriggered:
|
||||
{
|
||||
// This workaround is done because of the application menus for materials and variants for multiextrusion printers.
|
||||
// The extruder menu would always act on the correspoding extruder only, instead of acting on the extruder selected in the UI.
|
||||
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
|
||||
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
||||
Cura.MachineManager.setActiveMaterial(model.id);
|
||||
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
||||
Cura.MachineManager.setMaterial(extruderIndex, model.container_node);
|
||||
}
|
||||
}
|
||||
onObjectAdded: menu.insertItem(index, object)
|
||||
|
|
@ -126,12 +63,8 @@ Menu
|
|||
exclusiveGroup: group
|
||||
onTriggered:
|
||||
{
|
||||
// This workaround is done because of the application menus for materials and variants for multiextrusion printers.
|
||||
// The extruder menu would always act on the correspoding extruder only, instead of acting on the extruder selected in the UI.
|
||||
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
|
||||
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
||||
Cura.MachineManager.setActiveMaterial(model.id);
|
||||
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
||||
Cura.MachineManager.setMaterial(activeExtruderIndex, model.container_node);
|
||||
}
|
||||
}
|
||||
onObjectAdded: brandMaterialsMenu.insertItem(index, object)
|
||||
|
|
@ -146,24 +79,16 @@ Menu
|
|||
onObjectRemoved: menu.removeItem(object)
|
||||
}
|
||||
|
||||
ListModel
|
||||
Cura.GenericMaterialsModel
|
||||
{
|
||||
id: genericMaterialsModel
|
||||
Component.onCompleted: populateMenuModels()
|
||||
extruderPosition: menu.extruderIndex
|
||||
}
|
||||
|
||||
ListModel
|
||||
Cura.BrandMaterialsModel
|
||||
{
|
||||
id: brandModel
|
||||
}
|
||||
|
||||
//: Model used to populate the brandModel
|
||||
Cura.MaterialsModel
|
||||
{
|
||||
id: materialsModel
|
||||
filter: materialFilter()
|
||||
onModelReset: populateMenuModels()
|
||||
onDataChanged: populateMenuModels()
|
||||
extruderPosition: menu.extruderIndex
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: group }
|
||||
|
|
@ -171,80 +96,4 @@ Menu
|
|||
MenuSeparator { }
|
||||
|
||||
MenuItem { action: Cura.Actions.manageMaterials }
|
||||
|
||||
function materialFilter()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
function populateMenuModels()
|
||||
{
|
||||
// Create a structure of unique brands and their material-types
|
||||
genericMaterialsModel.clear()
|
||||
brandModel.clear();
|
||||
|
||||
var items = materialsModel.items;
|
||||
var materialsByBrand = {};
|
||||
for (var i in items) {
|
||||
var brandName = items[i]["metadata"]["brand"];
|
||||
var materialName = items[i]["metadata"]["material"];
|
||||
|
||||
if (brandName == "Generic")
|
||||
{
|
||||
// Add to top section
|
||||
var materialId = items[i].id;
|
||||
genericMaterialsModel.append({
|
||||
id: materialId,
|
||||
name: items[i].name
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add to per-brand, per-material menu
|
||||
if (!materialsByBrand.hasOwnProperty(brandName))
|
||||
{
|
||||
materialsByBrand[brandName] = {};
|
||||
}
|
||||
if (!materialsByBrand[brandName].hasOwnProperty(materialName))
|
||||
{
|
||||
materialsByBrand[brandName][materialName] = [];
|
||||
}
|
||||
materialsByBrand[brandName][materialName].push({
|
||||
id: items[i].id,
|
||||
name: items[i].name
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (var brand in materialsByBrand)
|
||||
{
|
||||
var materialsByBrandModel = [];
|
||||
var materials = materialsByBrand[brand];
|
||||
for (var material in materials)
|
||||
{
|
||||
materialsByBrandModel.push({
|
||||
name: material,
|
||||
colors: materials[material]
|
||||
})
|
||||
}
|
||||
brandModel.append({
|
||||
name: brand,
|
||||
materials: materialsByBrandModel
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright (c) 2017 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
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
|
||||
|
|
@ -13,89 +13,31 @@ Menu
|
|||
title: "Nozzle"
|
||||
|
||||
property int extruderIndex: 0
|
||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||
property bool isClusterPrinter:
|
||||
{
|
||||
if(Cura.MachineManager.printerOutputDevices.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize;
|
||||
// This is not a cluster printer or the cluster it is just one printer
|
||||
if(clusterSize == undefined || clusterSize == 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
MenuItem
|
||||
Cura.NozzleModel
|
||||
{
|
||||
id: automaticNozzle
|
||||
text:
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
var nozzleName = Cura.MachineManager.printerOutputDevices[0].hotendIds[extruderIndex];
|
||||
return catalog.i18nc("@title:menuitem %1 is the nozzle currently loaded in the printer", "Automatic: %1").arg(nozzleName);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds != undefined && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex && !isClusterPrinter
|
||||
onTriggered:
|
||||
{
|
||||
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
|
||||
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
||||
var hotendId = Cura.MachineManager.printerOutputDevices[0].hotendIds[extruderIndex];
|
||||
var itemIndex = nozzleInstantiator.model.find("name", hotendId);
|
||||
if(itemIndex > -1)
|
||||
{
|
||||
Cura.MachineManager.setActiveVariant(nozzleInstantiator.model.getItem(itemIndex).id);
|
||||
}
|
||||
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator
|
||||
{
|
||||
visible: automaticNozzle.visible
|
||||
id: nozzleModel
|
||||
}
|
||||
|
||||
Instantiator
|
||||
{
|
||||
id: nozzleInstantiator
|
||||
model: UM.InstanceContainersModel
|
||||
{
|
||||
filter:
|
||||
{
|
||||
var filter_dict =
|
||||
{
|
||||
"type": "variant",
|
||||
"definition": Cura.MachineManager.activeQualityDefinitionId //Only show variants of this machine
|
||||
}
|
||||
if (Cura.MachineManager.hasVariantBuildplates)
|
||||
{
|
||||
filter_dict["hardware_type"] = "nozzle"
|
||||
}
|
||||
model: nozzleModel
|
||||
|
||||
return filter_dict
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: model.name
|
||||
MenuItem
|
||||
{
|
||||
text: model.hotend_name
|
||||
checkable: true
|
||||
checked: model.id == Cura.MachineManager.allActiveVariantIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
|
||||
checked: {
|
||||
return Cura.MachineManager.activeVariantNames[extruderIndex] == model.hotend_name
|
||||
}
|
||||
exclusiveGroup: group
|
||||
onTriggered:
|
||||
{
|
||||
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
|
||||
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
||||
Cura.MachineManager.setActiveVariant(model.id);
|
||||
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
||||
onTriggered: {
|
||||
Cura.MachineManager.setVariantGroup(menu.extruderIndex, model.container_node);
|
||||
}
|
||||
}
|
||||
onObjectAdded: menu.insertItem(index, object)
|
||||
onObjectRemoved: menu.removeItem(object)
|
||||
|
||||
onObjectAdded: menu.insertItem(index, object);
|
||||
onObjectRemoved: menu.removeItem(object);
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: group }
|
||||
|
|
|
|||
|
|
@ -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.2
|
||||
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
|
||||
|
|
@ -13,15 +13,17 @@ Menu
|
|||
|
||||
Instantiator
|
||||
{
|
||||
model: Cura.ProfilesModel
|
||||
model: Cura.QualityProfilesDropDownMenuModel
|
||||
|
||||
MenuItem
|
||||
{
|
||||
text: (model.layer_height != "") ? model.name + " - " + model.layer_height : model.name
|
||||
text: (model.layer_height != "") ? model.name + " - " + model.layer_height + model.layer_height_unit : model.name
|
||||
checkable: true
|
||||
checked: Cura.MachineManager.activeQualityId == model.id
|
||||
checked: Cura.MachineManager.activeQualityOrQualityChangesName == model.name
|
||||
exclusiveGroup: group
|
||||
onTriggered: Cura.MachineManager.setActiveQuality(model.id)
|
||||
onTriggered: {
|
||||
Cura.MachineManager.setQualityGroup(model.quality_group)
|
||||
}
|
||||
visible: model.available
|
||||
}
|
||||
|
||||
|
|
@ -32,24 +34,27 @@ Menu
|
|||
MenuSeparator
|
||||
{
|
||||
id: customSeparator
|
||||
visible: Cura.UserProfilesModel.rowCount > 0
|
||||
visible: Cura.CustomQualityProfilesDropDownMenuModel.rowCount > 0
|
||||
}
|
||||
|
||||
Instantiator
|
||||
{
|
||||
id: customProfileInstantiator
|
||||
model: Cura.UserProfilesModel
|
||||
model: Cura.CustomQualityProfilesDropDownMenuModel
|
||||
|
||||
Connections
|
||||
{
|
||||
onModelReset: customSeparator.visible = rowCount() > 0
|
||||
target: Cura.CustomQualityProfilesDropDownMenuModel
|
||||
onModelReset: customSeparator.visible = Cura.CustomQualityProfilesDropDownMenuModel.rowCount() > 0
|
||||
}
|
||||
|
||||
MenuItem
|
||||
{
|
||||
text: model.name
|
||||
checkable: true
|
||||
checked: Cura.MachineManager.activeQualityChangesId == model.id
|
||||
checkable: model.available
|
||||
checked: Cura.MachineManager.activeQualityOrQualityChangesName == model.name
|
||||
exclusiveGroup: group
|
||||
onTriggered: Cura.MachineManager.setActiveQuality(model.id)
|
||||
onTriggered: Cura.MachineManager.setQualityChangesGroup(model.quality_changes_group)
|
||||
}
|
||||
|
||||
onObjectAdded:
|
||||
|
|
@ -73,23 +78,4 @@ Menu
|
|||
MenuItem { action: Cura.Actions.resetProfile }
|
||||
MenuSeparator { }
|
||||
MenuItem { action: Cura.Actions.manageProfiles }
|
||||
|
||||
function getFilter(initial_conditions)
|
||||
{
|
||||
var result = initial_conditions;
|
||||
|
||||
if(Cura.MachineManager.filterQualityByMachine)
|
||||
{
|
||||
result.definition = Cura.MachineManager.activeQualityDefinitionId;
|
||||
if(Cura.MachineManager.hasMaterials)
|
||||
{
|
||||
result.material = Cura.MachineManager.activeQualityMaterialId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.definition = "fdmprinter"
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import QtQuick 2.2
|
|||
import QtQuick.Controls 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.2 as Cura
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Menu
|
||||
{
|
||||
|
|
@ -13,6 +13,8 @@ Menu
|
|||
id: base
|
||||
enabled: !PrintInformation.preSliced
|
||||
|
||||
property var multiBuildPlateModel: CuraApplication.getMultiBuildPlateModel()
|
||||
|
||||
// main views
|
||||
Instantiator
|
||||
{
|
||||
|
|
@ -53,12 +55,12 @@ Menu
|
|||
visible: UM.Preferences.getValue("cura/use_multi_build_plate")
|
||||
Instantiator
|
||||
{
|
||||
model: Cura.BuildPlateModel
|
||||
model: base.multiBuildPlateModel
|
||||
MenuItem {
|
||||
text: Cura.BuildPlateModel.getItem(index).name;
|
||||
onTriggered: Cura.SceneController.setActiveBuildPlate(Cura.BuildPlateModel.getItem(index).buildPlateNumber);
|
||||
text: base.multiBuildPlateModel.getItem(index).name;
|
||||
onTriggered: Cura.SceneController.setActiveBuildPlate(base.multiBuildPlateModel.getItem(index).buildPlateNumber);
|
||||
checkable: true;
|
||||
checked: Cura.BuildPlateModel.getItem(index).buildPlateNumber == Cura.BuildPlateModel.activeBuildPlate;
|
||||
checked: base.multiBuildPlateModel.getItem(index).buildPlateNumber == base.multiBuildPlateModel.activeBuildPlate;
|
||||
exclusiveGroup: buildPlateGroup;
|
||||
visible: UM.Preferences.getValue("cura/use_multi_build_plate")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import QtQuick.Layouts 1.1
|
|||
import QtQuick.Dialogs 1.1
|
||||
|
||||
import UM 1.3 as UM
|
||||
import Cura 1.2 as Cura
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
import "Menus"
|
||||
|
||||
|
|
@ -31,7 +31,9 @@ Rectangle
|
|||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: UM.Theme.getColor("lining")
|
||||
|
||||
property bool collapsed: true;
|
||||
property bool collapsed: true
|
||||
|
||||
property var multiBuildPlateModel: CuraApplication.getMultiBuildPlateModel()
|
||||
|
||||
SystemPalette { id: palette }
|
||||
|
||||
|
|
@ -67,7 +69,7 @@ Rectangle
|
|||
Rectangle
|
||||
{
|
||||
height: childrenRect.height
|
||||
color: Cura.BuildPlateModel.getItem(index).buildPlateNumber == Cura.BuildPlateModel.activeBuildPlate ? palette.highlight : index % 2 ? palette.base : palette.alternateBase
|
||||
color: multiBuildPlateModel.getItem(index).buildPlateNumber == multiBuildPlateModel.activeBuildPlate ? palette.highlight : index % 2 ? palette.base : palette.alternateBase
|
||||
width: parent.width
|
||||
Label
|
||||
{
|
||||
|
|
@ -75,8 +77,8 @@ Rectangle
|
|||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
width: parent.width - 2 * UM.Theme.getSize("default_margin").width - 30
|
||||
text: Cura.BuildPlateModel.getItem(index) ? Cura.BuildPlateModel.getItem(index).name : "";
|
||||
color: Cura.BuildPlateModel.activeBuildPlate == index ? palette.highlightedText : palette.text
|
||||
text: multiBuildPlateModel.getItem(index) ? multiBuildPlateModel.getItem(index).name : "";
|
||||
color: multiBuildPlateModel.activeBuildPlate == index ? palette.highlightedText : palette.text
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
|
|
@ -118,13 +120,12 @@ Rectangle
|
|||
ListView
|
||||
{
|
||||
id: buildPlateListView
|
||||
model: Cura.BuildPlateModel
|
||||
model: multiBuildPlateModel
|
||||
width: parent.width
|
||||
delegate: buildPlateDelegate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Component {
|
||||
id: objectDelegate
|
||||
Rectangle
|
||||
|
|
@ -200,7 +201,6 @@ Rectangle
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
CheckBox
|
||||
{
|
||||
id: filterBuildPlateCheckbox
|
||||
|
|
@ -260,6 +260,4 @@ Rectangle
|
|||
}
|
||||
action: Cura.Actions.arrangeAll;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,13 +57,13 @@ Item
|
|||
height: UM.Theme.getSize("setting_control").height
|
||||
anchors.left: globalProfileLabel.right
|
||||
anchors.right: parent.right
|
||||
tooltip: Cura.MachineManager.activeQualityName
|
||||
tooltip: Cura.MachineManager.activeQualityOrQualityChangesName
|
||||
style: UM.Theme.styles.sidebar_header_button
|
||||
activeFocusOnPress: true
|
||||
menu: ProfileMenu { }
|
||||
|
||||
function generateActiveQualityText () {
|
||||
var result = Cura.MachineManager.activeQualityName;
|
||||
var result = Cura.MachineManager.activeQualityOrQualityChangesName;
|
||||
|
||||
if (Cura.MachineManager.isActiveQualitySupported) {
|
||||
if (Cura.MachineManager.activeQualityLayerHeight > 0) {
|
||||
|
|
@ -142,7 +142,7 @@ Item
|
|||
TextField
|
||||
{
|
||||
id: filter;
|
||||
|
||||
height: parent.height
|
||||
anchors.left: parent.left
|
||||
anchors.right: clearFilterButton.left
|
||||
anchors.rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width)
|
||||
|
|
@ -544,4 +544,4 @@ Item
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -526,15 +526,12 @@ Rectangle
|
|||
weights = ["0"];
|
||||
costs = ["0.00"];
|
||||
}
|
||||
var result = lengths.join(" + ") + "m / ~ " + weights.join(" + ") + "g";
|
||||
if(someCostsKnown)
|
||||
{
|
||||
return catalog.i18nc("@label Print estimates: m for meters, g for grams, %4 is currency and %3 is print cost", "%1m / ~ %2g / ~ %4 %3").arg(lengths.join(" + "))
|
||||
.arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return catalog.i18nc("@label Print estimates: m for meters, g for grams", "%1m / ~ %2g").arg(lengths.join(" + ")).arg(weights.join(" + "));
|
||||
result += " / ~ " + costs.join(" + ") + " " + UM.Preferences.getValue("cura/currency");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
MouseArea
|
||||
{
|
||||
|
|
|
|||
|
|
@ -295,10 +295,20 @@ Column
|
|||
{
|
||||
id: materialSelection
|
||||
|
||||
text: Cura.MachineManager.activeMaterialName
|
||||
tooltip: Cura.MachineManager.activeMaterialName
|
||||
property var currentRootMaterialName:
|
||||
{
|
||||
var materials = Cura.MachineManager.currentRootMaterialName;
|
||||
var materialName = "";
|
||||
if (base.currentExtruderIndex in materials) {
|
||||
materialName = materials[base.currentExtruderIndex];
|
||||
}
|
||||
return materialName;
|
||||
}
|
||||
|
||||
text: currentRootMaterialName
|
||||
tooltip: currentRootMaterialName
|
||||
visible: Cura.MachineManager.hasMaterials
|
||||
enabled: !extrudersList.visible || base.currentExtruderIndex > -1
|
||||
enabled: !extrudersList.visible || base.currentExtruderIndex > -1
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width
|
||||
anchors.right: parent.right
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2017 Ultimaker B.V.
|
||||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.7
|
||||
|
|
@ -7,7 +7,7 @@ import QtQuick.Controls.Styles 1.4
|
|||
import QtQuick.Layouts 1.3
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.2 as Cura
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Item
|
||||
{
|
||||
|
|
@ -57,7 +57,10 @@ Item
|
|||
interval: 50
|
||||
running: false
|
||||
repeat: false
|
||||
onTriggered: Cura.MachineManager.setActiveQuality(Cura.ProfilesModel.getItem(qualitySlider.value).id)
|
||||
onTriggered: {
|
||||
var item = Cura.QualityProfilesDropDownMenuModel.getItem(qualitySlider.value);
|
||||
Cura.MachineManager.activeQualityGroup = item.quality_group;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: qualityModel.update()
|
||||
|
|
@ -102,14 +105,14 @@ Item
|
|||
var availableMin = -1
|
||||
var availableMax = -1
|
||||
|
||||
for (var i = 0; i < Cura.ProfilesModel.rowCount(); i++) {
|
||||
var qualityItem = Cura.ProfilesModel.getItem(i)
|
||||
for (var i = 0; i < Cura.QualityProfilesDropDownMenuModel.rowCount(); i++) {
|
||||
var qualityItem = Cura.QualityProfilesDropDownMenuModel.getItem(i)
|
||||
|
||||
// Add each quality item to the UI quality model
|
||||
qualityModel.append(qualityItem)
|
||||
|
||||
// Set selected value
|
||||
if (Cura.MachineManager.activeQualityType == qualityItem.metadata.quality_type) {
|
||||
if (Cura.MachineManager.activeQualityType == qualityItem.quality_type) {
|
||||
|
||||
// set to -1 when switching to user created profile so all ticks are clickable
|
||||
if (Cura.SimpleModeSettingsManager.isProfileUserCreated) {
|
||||
|
|
@ -134,7 +137,7 @@ Item
|
|||
|
||||
// Set total available ticks for active slider part
|
||||
if (availableMin != -1) {
|
||||
qualityModel.availableTotalTicks = availableMax - availableMin
|
||||
qualityModel.availableTotalTicks = availableMax - availableMin + 1
|
||||
}
|
||||
|
||||
// Calculate slider values
|
||||
|
|
@ -161,11 +164,11 @@ Item
|
|||
|
||||
function reset () {
|
||||
qualityModel.clear()
|
||||
qualityModel.availableTotalTicks = -1
|
||||
qualityModel.availableTotalTicks = 0
|
||||
qualityModel.existingQualityProfile = 0
|
||||
|
||||
// check, the ticks count cannot be less than zero
|
||||
qualityModel.totalTicks = Math.max(0, Cura.ProfilesModel.rowCount() - 1)
|
||||
qualityModel.totalTicks = Math.max(0, Cura.QualityProfilesDropDownMenuModel.rowCount() - 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -191,13 +194,13 @@ Item
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height / 2)
|
||||
color: (Cura.MachineManager.activeMachine != null && Cura.ProfilesModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||
color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||
text:
|
||||
{
|
||||
var result = ""
|
||||
if(Cura.MachineManager.activeMachine != null)
|
||||
{
|
||||
result = Cura.ProfilesModel.getItem(index).layer_height_without_unit
|
||||
result = Cura.QualityProfilesDropDownMenuModel.getItem(index).layer_height
|
||||
|
||||
if(result == undefined)
|
||||
{
|
||||
|
|
@ -262,7 +265,7 @@ Item
|
|||
Rectangle
|
||||
{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: Cura.ProfilesModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||
color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||
width: 1 * screenScaleFactor
|
||||
height: 6 * screenScaleFactor
|
||||
y: 0
|
||||
|
|
@ -270,32 +273,24 @@ Item
|
|||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: disabledHandleButton
|
||||
visible: !qualitySlider.visible
|
||||
anchors.centerIn: parent
|
||||
color: UM.Theme.getColor("quality_slider_unavailable")
|
||||
implicitWidth: 10 * screenScaleFactor
|
||||
implicitHeight: implicitWidth
|
||||
radius: Math.round(width / 2)
|
||||
}
|
||||
|
||||
Slider
|
||||
{
|
||||
id: qualitySlider
|
||||
height: UM.Theme.getSize("sidebar_margin").height
|
||||
anchors.bottom: speedSlider.bottom
|
||||
enabled: qualityModel.availableTotalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized
|
||||
visible: qualityModel.totalTicks > 0
|
||||
enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized
|
||||
visible: qualityModel.availableTotalTicks > 0
|
||||
updateValueWhileDragging : false
|
||||
|
||||
minimumValue: qualityModel.qualitySliderAvailableMin >= 0 ? qualityModel.qualitySliderAvailableMin : 0
|
||||
maximumValue: qualityModel.qualitySliderAvailableMax >= 0 ? qualityModel.qualitySliderAvailableMax : 0
|
||||
// maximumValue must be greater than minimumValue to be able to see the handle. While the value is strictly
|
||||
// speaking not always correct, it seems to have the correct behavior (switching from 0 available to 1 available)
|
||||
maximumValue: qualityModel.qualitySliderAvailableMax >= 1 ? qualityModel.qualitySliderAvailableMax : 1
|
||||
stepSize: 1
|
||||
|
||||
value: qualityModel.qualitySliderActiveIndex
|
||||
|
||||
width: qualityModel.qualitySliderStepWidth * qualityModel.availableTotalTicks
|
||||
width: qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks - 1)
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: qualityModel.qualitySliderMarginRight
|
||||
|
|
@ -373,7 +368,7 @@ Item
|
|||
|
||||
text: catalog.i18nc("@label", "Slower")
|
||||
font: UM.Theme.getFont("default")
|
||||
color: (qualityModel.availableTotalTicks > 0) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||
color: (qualityModel.availableTotalTicks > 1) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
}
|
||||
|
||||
|
|
@ -384,7 +379,7 @@ Item
|
|||
|
||||
text: catalog.i18nc("@label", "Faster")
|
||||
font: UM.Theme.getFont("default")
|
||||
color: (qualityModel.availableTotalTicks > 0) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||
color: (qualityModel.availableTotalTicks > 1) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||
horizontalAlignment: Text.AlignRight
|
||||
}
|
||||
|
||||
|
|
@ -408,9 +403,10 @@ Item
|
|||
// if the current profile is user-created, switch to a built-in quality
|
||||
if (Cura.SimpleModeSettingsManager.isProfileUserCreated)
|
||||
{
|
||||
if (Cura.ProfilesModel.rowCount() > 0)
|
||||
if (Cura.QualityProfilesDropDownMenuModel.rowCount() > 0)
|
||||
{
|
||||
Cura.MachineManager.setActiveQuality(Cura.ProfilesModel.getItem(0).id)
|
||||
var item = Cura.QualityProfilesDropDownMenuModel.getItem(0);
|
||||
Cura.MachineManager.activeQualityGroup = item.quality_group;
|
||||
}
|
||||
}
|
||||
if (Cura.SimpleModeSettingsManager.isProfileCustomized)
|
||||
|
|
@ -522,8 +518,7 @@ Item
|
|||
// Update the slider value to represent the rounded value
|
||||
infillSlider.value = roundedSliderValue
|
||||
|
||||
// Explicitly cast to string to make sure the value passed to Python is an integer.
|
||||
infillDensity.setPropertyValue("value", String(roundedSliderValue))
|
||||
Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", roundedSliderValue)
|
||||
}
|
||||
|
||||
style: SliderStyle
|
||||
|
|
@ -653,14 +648,20 @@ Item
|
|||
|
||||
onClicked: {
|
||||
// Set to 90% only when enabling gradual infill
|
||||
var newInfillDensity;
|
||||
if (parseInt(infillSteps.properties.value) == 0) {
|
||||
previousInfillDensity = parseInt(infillDensity.properties.value)
|
||||
infillDensity.setPropertyValue("value", String(90))
|
||||
newInfillDensity = 90;
|
||||
} else {
|
||||
infillDensity.setPropertyValue("value", String(previousInfillDensity))
|
||||
newInfillDensity = previousInfillDensity;
|
||||
}
|
||||
Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity))
|
||||
|
||||
infillSteps.setPropertyValue("value", (parseInt(infillSteps.properties.value) == 0) ? 5 : 0)
|
||||
var infill_steps_value = 0;
|
||||
if (parseInt(infillSteps.properties.value) == 0)
|
||||
infill_steps_value = 5;
|
||||
|
||||
Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value)
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ UM.Dialog
|
|||
}
|
||||
Label
|
||||
{
|
||||
text: Cura.MachineManager.activeDefinitionName
|
||||
text: Cura.MachineManager.activeMachine.definition.name
|
||||
width: (parent.width / 3) | 0
|
||||
}
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ UM.Dialog
|
|||
|
||||
Repeater
|
||||
{
|
||||
model: Cura.MachineManager.activeMaterialNames
|
||||
model: Cura.MachineManager.currentExtruderPositions
|
||||
delegate: Column
|
||||
{
|
||||
Item // Spacer
|
||||
|
|
@ -158,7 +158,7 @@ UM.Dialog
|
|||
}
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@action:label", "Extruder %1").arg(index+1)
|
||||
text: catalog.i18nc("@action:label", "Extruder %1").arg(modelData)
|
||||
}
|
||||
height: childrenRect.height
|
||||
width: parent.width
|
||||
|
|
@ -173,7 +173,7 @@ UM.Dialog
|
|||
}
|
||||
Label
|
||||
{
|
||||
text: Cura.MachineManager.activeVariantNames[index] + ", " + modelData
|
||||
text: Cura.MachineManager.activeVariantNames[modelData] + ", " + Cura.MachineManager.currentRootMaterialName[modelData]
|
||||
width: (parent.width / 3) | 0
|
||||
}
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ UM.Dialog
|
|||
}
|
||||
Label
|
||||
{
|
||||
text: Cura.MachineManager.activeQualityName
|
||||
text: Cura.MachineManager.activeQualityOrQualityChangesName
|
||||
width: (parent.width / 3) | 0
|
||||
}
|
||||
|
||||
|
|
@ -294,4 +294,4 @@ UM.Dialog
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue