mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 05:45:55 +08:00
Get build plate shape options from the fdmprinter definition
This commit is contained in:
parent
ff0f63eb94
commit
86383b2be0
@ -137,11 +137,32 @@ Cura.MachineAction
|
|||||||
id: shapesModel
|
id: shapesModel
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
shapesModel.append({ text: catalog.i18nc("@option:build plate shape", "Rectangular"), value: "rectangular" });
|
// Options come in as a string-representation of an OrderedDict
|
||||||
shapesModel.append({ text: catalog.i18nc("@option:build plate shape", "Elliptic"), value: "elliptic" });
|
var options = machineShapeProvider.properties.options.match(/^OrderedDict\(\[\((.*)\)\]\)$/);
|
||||||
shapeComboBox.currentIndex = machineShapeProvider.properties.value != shapesModel.get(1).value ? 0 : 1
|
if(options)
|
||||||
|
{
|
||||||
|
options = options[1].split("), (")
|
||||||
|
for(var i = 0; i < options.length; i++)
|
||||||
|
{
|
||||||
|
var option = options[i].substring(1, options[i].length - 1).split("', '")
|
||||||
|
shapesModel.append({text: option[1], value: option[0]});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
currentIndex:
|
||||||
|
{
|
||||||
|
var currentValue = machineShapeProvider.properties.value;
|
||||||
|
var index = 0;
|
||||||
|
for(var i = 0; i < shapesModel.count; i++)
|
||||||
|
{
|
||||||
|
if(shapesModel.get(i).value == currentValue) {
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return index
|
||||||
|
}
|
||||||
onActivated:
|
onActivated:
|
||||||
{
|
{
|
||||||
machineShapeProvider.setPropertyValue("value", shapesModel.get(index).value);
|
machineShapeProvider.setPropertyValue("value", shapesModel.get(index).value);
|
||||||
@ -467,7 +488,7 @@ Cura.MachineAction
|
|||||||
|
|
||||||
containerStackId: Cura.MachineManager.activeMachineId
|
containerStackId: Cura.MachineManager.activeMachineId
|
||||||
key: "machine_shape"
|
key: "machine_shape"
|
||||||
watchedProperties: [ "value" ]
|
watchedProperties: [ "value", "options" ]
|
||||||
storeIndex: manager.containerIndex
|
storeIndex: manager.containerIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user