Simplify getting layer height

The stack already makes it fall through properly, so there's no need to implement the fallback again here.

The only change is that it now displays 0.1mm as default layer height if there is no quality profile active. I don't think this makes a difference since we don't show the layer height then anyway. And technically it would be more correct too.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-27 11:06:35 +02:00
parent 0db99e8f21
commit 01796b99cd
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276

View file

@ -570,22 +570,15 @@ class MachineManager(QObject):
# This is indicated together with the name of the active quality profile.
#
# \return The layer height of the currently active quality profile. If
# there is no quality profile, this returns 0.
# there is no quality profile, this returns the default layer height.
@pyqtProperty(float, notify = activeQualityGroupChanged)
def activeQualityLayerHeight(self) -> float:
if not self._global_container_stack:
return 0
if self._current_quality_changes_group:
value = self._global_container_stack.getRawProperty("layer_height", "value", skip_until_container = self._global_container_stack.qualityChanges.getId())
if isinstance(value, SettingFunction):
value = value(self._global_container_stack)
return value
elif self._current_quality_group:
value = self._global_container_stack.getRawProperty("layer_height", "value", skip_until_container = self._global_container_stack.quality.getId())
if isinstance(value, SettingFunction):
value = value(self._global_container_stack)
return value
return 0
value = self._global_container_stack.getRawProperty("layer_height", "value", skip_until_container = self._global_container_stack.qualityChanges.getId())
if isinstance(value, SettingFunction):
value = value(self._global_container_stack)
return value
@pyqtProperty(str, notify = activeVariantChanged)
def globalVariantName(self) -> str: