mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 01:37:51 -06:00
Update material_diameter when editing the material in MaterialView.qml
This commit is contained in:
parent
5550fe0da8
commit
1f49a87acb
2 changed files with 30 additions and 1 deletions
|
@ -235,6 +235,31 @@ class ContainerManager(QObject):
|
|||
|
||||
return True
|
||||
|
||||
## Set a metadata entry of the specified container.
|
||||
#
|
||||
# \param container_id \type{str} The ID of the container to change.
|
||||
# \param setting_key \type{str} The key of the setting.
|
||||
# \param property_name \type{str} The name of the property, eg "value".
|
||||
# \param property_value \type{str} The new value of the property.
|
||||
#
|
||||
# \return True if successful, False if not.
|
||||
@pyqtSlot(str, str, str, str, result = bool)
|
||||
def setContainerProperty(self, container_id, setting_key, property_name, value_value):
|
||||
containers = self._container_registry.findContainers(None, id = container_id)
|
||||
if not containers:
|
||||
Logger.log("w", "Could not set properties of container %s because it was not found.", container_id)
|
||||
return False
|
||||
|
||||
container = containers[0]
|
||||
|
||||
if container.isReadOnly():
|
||||
Logger.log("w", "Cannot set properties of read-only container %s.", container_id)
|
||||
return False
|
||||
|
||||
container.setProperty(setting_key, property_name, value_value)
|
||||
|
||||
return True
|
||||
|
||||
## Set the name of the specified container.
|
||||
@pyqtSlot(str, str, result = bool)
|
||||
def setContainerName(self, container_id, new_name):
|
||||
|
|
|
@ -164,7 +164,11 @@ TabView
|
|||
stepSize: 0.01
|
||||
readOnly: !base.editingEnabled
|
||||
|
||||
onEditingFinished: base.setMetaDataEntry("properties/diameter", properties.diameter, value)
|
||||
onEditingFinished:
|
||||
{
|
||||
Cura.ContainerManager.setContainerProperty(base.containerId, "material_diameter", "value", value)
|
||||
base.setMetaDataEntry("properties/diameter", properties.diameter, value)
|
||||
}
|
||||
onValueChanged: updateCostPerMeter()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue