Browse Source

Merge branch '2.3'

Tim Kuipers 8 years ago
parent
commit
86d682daae

+ 28 - 2
cura/Settings/MachineManager.py

@@ -474,6 +474,32 @@ class MachineManager(QObject):
 
         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. If
+    #   there is no quality profile, this returns 0.
+    @pyqtProperty(float, notify=activeQualityChanged)
+    def activeQualityLayerHeight(self):
+        if not self._global_container_stack:
+            return 0
+
+        quality_changes = self._global_container_stack.findContainer({"type": "quality_changes"})
+        if quality_changes:
+            value = self._global_container_stack.getRawProperty("layer_height", "value", skip_until_container = quality_changes.getId())
+            if isinstance(value, UM.Settings.SettingFunction):
+                value = value(self._global_container_stack)
+            return value
+        quality = self._global_container_stack.findContainer({"type": "quality"})
+        if quality:
+            value = self._global_container_stack.getRawProperty("layer_height", "value", skip_until_container = quality.getId())
+            if isinstance(value, UM.Settings.SettingFunction):
+                value = value(self._global_container_stack)
+            return value
+
+        return 0 #No quality profile.
+
     ##  Get the Material ID associated with the currently active material
     #   \returns MaterialID (string) if found, empty string otherwise
     @pyqtProperty(str, notify=activeQualityChanged)
@@ -687,7 +713,7 @@ class MachineManager(QObject):
 
         # Get quality container and optionally the quality_changes container.
         if container_type == "quality":
-            new_quality_settings_list = self._determineQualityAndQualityChangesForQualityType(quality_type)
+            new_quality_settings_list = self.determineQualityAndQualityChangesForQualityType(quality_type)
         elif container_type == "quality_changes":
             new_quality_settings_list = self._determineQualityAndQualityChangesForQualityChanges(quality_name)
         else:
@@ -723,7 +749,7 @@ class MachineManager(QObject):
     #
     #   \param quality_name \type{str} the name of the quality.
     #   \return \type{List[Dict]} with keys "stack", "quality" and "quality_changes".
-    def _determineQualityAndQualityChangesForQualityType(self, quality_type):
+    def determineQualityAndQualityChangesForQualityType(self, quality_type):
         quality_manager = QualityManager.getInstance()
         result = []
         empty_quality_changes = self._empty_quality_changes_container

+ 56 - 2
cura/Settings/ProfilesModel.py

@@ -1,18 +1,23 @@
 # Copyright (c) 2016 Ultimaker B.V.
-# Uranium is released under the terms of the AGPLv3 or higher.
+# Cura is released under the terms of the AGPLv3 or higher.
+
+from PyQt5.QtCore import Qt
 
 from UM.Application import Application
+from UM.Settings.ContainerRegistry import ContainerRegistry
 from UM.Settings.Models.InstanceContainersModel import InstanceContainersModel
 
 from cura.QualityManager import QualityManager
 from cura.Settings.ExtruderManager import ExtruderManager
-from cura.Settings.MachineManager import MachineManager
 
 ##  QML Model for listing the current list of valid quality profiles.
 #
 class ProfilesModel(InstanceContainersModel):
+    LayerHeightRole = Qt.UserRole + 1001
+
     def __init__(self, parent = None):
         super().__init__(parent)
+        self.addRoleName(self.LayerHeightRole, "layer_height")
 
         Application.getInstance().globalContainerStackChanged.connect(self._update)
 
@@ -40,3 +45,52 @@ class ProfilesModel(InstanceContainersModel):
         # The actual list of quality profiles come from the first extruder in the extruder list.
         return QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack,
                                                                                          extruder_stacks)
+
+    ##  Re-computes the items in this model, and adds the layer height role.
+    def _recomputeItems(self):
+        #Some globals that we can re-use.
+        global_container_stack = Application.getInstance().getGlobalContainerStack()
+        if global_container_stack is None:
+            return
+        container_registry = ContainerRegistry.getInstance()
+        machine_manager = Application.getInstance().getMachineManager()
+
+        unit = global_container_stack.getBottom().getProperty("layer_height", "unit")
+
+        for item in super()._recomputeItems():
+            profile = container_registry.findContainers(id = item["id"])
+            if not profile:
+                item["layer_height"] = "" #Can't update a profile that is unknown.
+                yield item
+                continue
+
+            #Easy case: This profile defines its own layer height.
+            profile = profile[0]
+            if profile.hasProperty("layer_height", "value"):
+                item["layer_height"] = str(profile.getProperty("layer_height", "value")) + unit
+                yield item
+                continue
+
+            #Quality-changes profile that has no value for layer height. Get the corresponding quality profile and ask that profile.
+            quality_type = profile.getMetaDataEntry("quality_type", None)
+            if quality_type:
+                quality_results = machine_manager.determineQualityAndQualityChangesForQualityType(quality_type)
+                for quality_result in quality_results:
+                    if quality_result["stack"] is global_container_stack:
+                        quality = quality_result["quality"]
+                        break
+                else: #No global container stack in the results:
+                    quality = quality_results[0]["quality"] #Take any of the extruders.
+                if quality and quality.hasProperty("layer_height", "value"):
+                    item["layer_height"] = str(quality.getProperty("layer_height", "value")) + unit
+                    yield item
+                    continue
+
+            #Quality has no value for layer height either. Get the layer height from somewhere lower in the stack.
+            skip_until_container = global_container_stack.findContainer({"type": "material"})
+            if not skip_until_container: #No material in stack.
+                skip_until_container = global_container_stack.findContainer({"type": "variant"})
+                if not skip_until_container: #No variant in stack.
+                    skip_until_container = global_container_stack.getBottom()
+            item["layer_height"] = str(global_container_stack.getRawProperty("layer_height", "value", skip_until_container = skip_until_container.getId())) + unit #Fall through to the currently loaded material.
+            yield item

+ 10 - 0
plugins/ChangeLogPlugin/ChangeLog.txt

@@ -1,3 +1,13 @@
+[2.3.1]
+*Layer Height in Profile Selection
+The layer height of each profile is now shown in the profile selection menu.
+
+*Bug fixes
+Upgrading from version 2.1 on OSX works again.
+You can import g-code from related machines as profile.
+Fixed inheritance taking from the wrong extruder.
+Moved z-hop and extruder selection settings to a better category.
+
 [2.3.0]
 
 *Speed improvements

+ 2 - 2
resources/qml/Menus/ProfileMenu.qml

@@ -17,7 +17,7 @@ Menu
 
         MenuItem
         {
-            text: model.name
+            text: model.name + " - " + model.layer_height
             checkable: true
             checked: Cura.MachineManager.activeQualityChangesId == "empty_quality_changes" && Cura.MachineManager.activeQualityType == model.metadata.quality_type
             exclusiveGroup: group
@@ -40,7 +40,7 @@ Menu
 
         MenuItem
         {
-            text: model.name
+            text: model.name + " - " + model.layer_height
             checkable: true
             checked: Cura.MachineManager.globalQualityId == model.id
             exclusiveGroup: group

+ 10 - 1
resources/qml/SidebarHeader.qml

@@ -285,7 +285,16 @@ Column
         ToolButton
         {
             id: globalProfileSelection
-            text: Cura.MachineManager.activeQualityName
+            text: {
+                var result = Cura.MachineManager.activeQualityName;
+                if (Cura.MachineManager.activeQualityLayerHeight > 0) {
+                    result += " <font color=\"" + UM.Theme.getColor("text_detail") + "\">";
+                    result += " - ";
+                    result += Cura.MachineManager.activeQualityLayerHeight + "mm";
+                    result += "</font>";
+                }
+                return result;
+            }
             enabled: !extrudersList.visible || base.currentExtruderIndex  > -1
 
             width: parent.width * 0.55 + UM.Theme.getSize("default_margin").width

+ 15 - 15
resources/quality/ultimaker3/um3_aa0.4_ABS_Draft_Print.inst.cfg

@@ -25,7 +25,7 @@ acceleration_wall_x = =acceleration_wall
 adhesion_type = brim
 brim_width = 7
 cool_fan_full_at_height = =layer_height_0 + 4 * layer_height
-cool_fan_speed = 50
+cool_fan_speed = 5
 cool_fan_speed_max = 100
 cool_min_layer_time = 5
 cool_min_speed = 5
@@ -95,20 +95,20 @@ travel_compensate_overlapping_walls_enabled = True
 wall_0_inset = 0
 wall_line_width_x = =round(line_width * 0.3 / 0.35, 2)
 wall_thickness = 1
-support_line_width = =line_width
-support_pattern = zigzag
-support_infill_rate = 15
-support_join_distance = 2
-support_offset = 0.2
-support_interface_enable = False
-support_use_towers = True
-raft_margin = 15
-raft_airgap = 0.3
-raft_surface_layers = 2
-raft_surface_thickness = =resolveOrValue('layer_height')
-raft_interface_thickness = =resolveOrValue('layer_height') * 1.5
-raft_interface_line_width = =line_width * 2
-raft_interface_line_spacing = =raft_interface_line_width + 0.2
+support_line_width = =line_width
+support_pattern = zigzag
+support_infill_rate = 15
+support_join_distance = 2
+support_offset = 0.2
+support_interface_enable = False
+support_use_towers = True
+raft_margin = 15
+raft_airgap = 0.3
+raft_surface_layers = 2
+raft_surface_thickness = =resolveOrValue('layer_height')
+raft_interface_thickness = =resolveOrValue('layer_height') * 1.5
+raft_interface_line_width = =line_width * 2
+raft_interface_line_spacing = =raft_interface_line_width + 0.2
 support_bottom_height = =extruderValue(support_interface_extruder_nr, 'support_interface_height')
 retraction_amount = 6.5
 

+ 16 - 16
resources/quality/ultimaker3/um3_aa0.4_ABS_Fast_Print.inst.cfg

@@ -25,7 +25,7 @@ acceleration_wall_x = =acceleration_wall
 adhesion_type = brim
 brim_width = 7
 cool_fan_full_at_height = =layer_height_0 + 4 * layer_height
-cool_fan_speed = 50
+cool_fan_speed = 5
 cool_fan_speed_max = 100
 cool_min_layer_time = 5
 cool_min_speed = 7
@@ -95,21 +95,21 @@ travel_compensate_overlapping_walls_enabled = True
 wall_0_inset = 0
 wall_line_width_x = =round(line_width * 0.3 / 0.35, 2)
 wall_thickness = 1.3
-support_line_width = =line_width
-support_pattern = zigzag
-support_infill_rate = 15
-support_join_distance = 2
-support_offset = 0.2
-support_interface_enable = False
-support_use_towers = True
-raft_margin = 15
-raft_airgap = 0.3
-raft_surface_layers = 2
-raft_surface_thickness = =resolveOrValue('layer_height')
-raft_interface_thickness = =resolveOrValue('layer_height') * 1.5
-raft_interface_line_width = =line_width * 2
-raft_interface_line_spacing = =raft_interface_line_width + 0.2
-support_bottom_height = =extruderValue(support_interface_extruder_nr, 'support_interface_height')
+support_line_width = =line_width
+support_pattern = zigzag
+support_infill_rate = 15
+support_join_distance = 2
+support_offset = 0.2
+support_interface_enable = False
+support_use_towers = True
+raft_margin = 15
+raft_airgap = 0.3
+raft_surface_layers = 2
+raft_surface_thickness = =resolveOrValue('layer_height')
+raft_interface_thickness = =resolveOrValue('layer_height') * 1.5
+raft_interface_line_width = =line_width * 2
+raft_interface_line_spacing = =raft_interface_line_width + 0.2
+support_bottom_height = =extruderValue(support_interface_extruder_nr, 'support_interface_height')
 retraction_amount = 6.5
 
 cool_min_layer_time_fan_speed_max = 10

+ 16 - 16
resources/quality/ultimaker3/um3_aa0.4_ABS_High_Quality.inst.cfg

@@ -25,7 +25,7 @@ acceleration_wall_x = =acceleration_wall
 adhesion_type = brim
 brim_width = 7
 cool_fan_full_at_height = =layer_height_0 + 4 * layer_height
-cool_fan_speed = 50
+cool_fan_speed = 5
 cool_fan_speed_max = 100
 cool_min_layer_time = 5
 cool_min_speed = 12
@@ -95,21 +95,21 @@ travel_compensate_overlapping_walls_enabled = True
 wall_0_inset = 0
 wall_line_width_x = =round(line_width * 0.3 / 0.35, 2)
 wall_thickness = 1.3
-support_line_width = =line_width
-support_pattern = zigzag
-support_infill_rate = 15
-support_join_distance = 2
-support_offset = 0.2
-support_interface_enable = False
-support_use_towers = True
-raft_margin = 15
-raft_airgap = 0.3
-raft_surface_layers = 2
-raft_surface_thickness = =resolveOrValue('layer_height')
-raft_interface_thickness = =resolveOrValue('layer_height') * 1.5
-raft_interface_line_width = =line_width * 2
-raft_interface_line_spacing = =raft_interface_line_width + 0.2
-support_bottom_height = =extruderValue(support_interface_extruder_nr, 'support_interface_height')
+support_line_width = =line_width
+support_pattern = zigzag
+support_infill_rate = 15
+support_join_distance = 2
+support_offset = 0.2
+support_interface_enable = False
+support_use_towers = True
+raft_margin = 15
+raft_airgap = 0.3
+raft_surface_layers = 2
+raft_surface_thickness = =resolveOrValue('layer_height')
+raft_interface_thickness = =resolveOrValue('layer_height') * 1.5
+raft_interface_line_width = =line_width * 2
+raft_interface_line_spacing = =raft_interface_line_width + 0.2
+support_bottom_height = =extruderValue(support_interface_extruder_nr, 'support_interface_height')
 retraction_amount = 6.5
 
 cool_min_layer_time_fan_speed_max = 10

+ 16 - 16
resources/quality/ultimaker3/um3_aa0.4_ABS_Normal_Quality.inst.cfg

@@ -25,7 +25,7 @@ acceleration_wall_x = =acceleration_wall
 adhesion_type = brim
 brim_width = 7
 cool_fan_full_at_height = =layer_height_0 + 4 * layer_height
-cool_fan_speed = 50
+cool_fan_speed = 5
 cool_fan_speed_max = 100
 cool_min_layer_time = 5
 cool_min_speed = 5
@@ -95,21 +95,21 @@ travel_compensate_overlapping_walls_enabled = True
 wall_0_inset = 0
 wall_line_width_x = =round(line_width * 0.3 / 0.35, 2)
 wall_thickness = 1.3
-support_line_width = =line_width
-support_pattern = zigzag
-support_infill_rate = 15
-support_join_distance = 2
-support_offset = 0.2
-support_interface_enable = False
-support_use_towers = True
-raft_margin = 15
-raft_airgap = 0.3
-raft_surface_layers = 2
-raft_surface_thickness = =resolveOrValue('layer_height')
-raft_interface_thickness = =resolveOrValue('layer_height') * 1.5
-raft_interface_line_width = =line_width * 2
-raft_interface_line_spacing = =raft_interface_line_width + 0.2
-support_bottom_height = =extruderValue(support_interface_extruder_nr, 'support_interface_height')
+support_line_width = =line_width
+support_pattern = zigzag
+support_infill_rate = 15
+support_join_distance = 2
+support_offset = 0.2
+support_interface_enable = False
+support_use_towers = True
+raft_margin = 15
+raft_airgap = 0.3
+raft_surface_layers = 2
+raft_surface_thickness = =resolveOrValue('layer_height')
+raft_interface_thickness = =resolveOrValue('layer_height') * 1.5
+raft_interface_line_width = =line_width * 2
+raft_interface_line_spacing = =raft_interface_line_width + 0.2
+support_bottom_height = =extruderValue(support_interface_extruder_nr, 'support_interface_height')
 retraction_amount = 6.5
 
 cool_min_layer_time_fan_speed_max = 10

+ 1 - 0
resources/themes/cura/theme.json

@@ -52,6 +52,7 @@
         "secondary": [245, 245, 245, 255],
 
         "text": [24, 41, 77, 255],
+        "text_detail": [174, 174, 174, 128],
         "text_link": [12, 169, 227, 255],
         "text_inactive": [174, 174, 174, 255],
         "text_hover": [70, 84, 113, 255],