Add property to get the current profile's layer height

This will then be displayed in the profile selection menu.

Contributes to issue CURA-2723.
This commit is contained in:
Ghostkeeper 2016-10-20 17:14:45 +02:00
parent de45d25f0b
commit 021023a932
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -474,6 +474,26 @@ class MachineManager(QObject):
return result return result
## Gets the layer height of the currently active quality profile.
#
# This is indicated together with the name of the active quality profile.
#
# \return The layer height of the currently active quality profile.
@pyqtProperty(float, notify=activeQualityChanged)
def activeQualityLayerHeight(self):
if not self._global_container_stack:
return 0
quality = self._global_container_stack.findContainer({"type": "quality_changes"})
if quality and quality.hasProperty("layer_height", "value"):
print(quality.getProperty("layer_height", "value"))
return quality.getProperty("layer_height", "value")
quality = self._global_container_stack.findContainer({"type": "quality"})
if quality and quality.hasProperty("layer_height", "value"): #This depends on layer_height always being present in the quality.
#If it isn't, there is no way we can find the layer_height while excluding any layer_height in the user profile.
return quality.getProperty("layer_height", "value")
return 0
## Get the Material ID associated with the currently active material ## Get the Material ID associated with the currently active material
# \returns MaterialID (string) if found, empty string otherwise # \returns MaterialID (string) if found, empty string otherwise
@pyqtProperty(str, notify=activeQualityChanged) @pyqtProperty(str, notify=activeQualityChanged)