Browse Source

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.
Ghostkeeper 5 years ago
parent
commit
01796b99cd
1 changed files with 5 additions and 12 deletions
  1. 5 12
      cura/Settings/MachineManager.py

+ 5 - 12
cura/Settings/MachineManager.py

@@ -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: