mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-18 04:07:57 -06:00
Merge branch '2.3'
This commit is contained in:
commit
86d682daae
10 changed files with 170 additions and 70 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue