mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 04:37:51 -06:00
Merge remote-tracking branch 'origin/3.3'
This commit is contained in:
commit
6d2e49c228
3 changed files with 24 additions and 9 deletions
|
@ -927,6 +927,8 @@ class MachineManager(QObject):
|
||||||
ExtruderManager.getInstance().extrudersChanged.emit(self._global_container_stack.getId())
|
ExtruderManager.getInstance().extrudersChanged.emit(self._global_container_stack.getId())
|
||||||
# Make sure the front end reflects changes
|
# Make sure the front end reflects changes
|
||||||
self.forceUpdateAllSettings()
|
self.forceUpdateAllSettings()
|
||||||
|
# Also trigger the build plate compatibility to update
|
||||||
|
self.activeMaterialChanged.emit()
|
||||||
|
|
||||||
def _onMachineNameChanged(self):
|
def _onMachineNameChanged(self):
|
||||||
self.globalContainerChanged.emit()
|
self.globalContainerChanged.emit()
|
||||||
|
@ -1024,17 +1026,25 @@ class MachineManager(QObject):
|
||||||
self.activeQualityGroupChanged.emit()
|
self.activeQualityGroupChanged.emit()
|
||||||
self.activeQualityChangesGroupChanged.emit()
|
self.activeQualityChangesGroupChanged.emit()
|
||||||
|
|
||||||
|
def _fixQualityChangesGroupToNotSupported(self, quality_changes_group):
|
||||||
|
nodes = [quality_changes_group.node_for_global] + list(quality_changes_group.nodes_for_extruders.values())
|
||||||
|
containers = [n.getContainer() for n in nodes if n is not None]
|
||||||
|
for container in containers:
|
||||||
|
container.setMetaDataEntry("quality_type", "not_supported")
|
||||||
|
quality_changes_group.quality_type = "not_supported"
|
||||||
|
|
||||||
def _setQualityChangesGroup(self, quality_changes_group):
|
def _setQualityChangesGroup(self, quality_changes_group):
|
||||||
if self._global_container_stack is None:
|
if self._global_container_stack is None:
|
||||||
return #Can't change that.
|
return #Can't change that.
|
||||||
quality_type = quality_changes_group.quality_type
|
quality_type = quality_changes_group.quality_type
|
||||||
# A custom quality can be created based on "not supported".
|
# A custom quality can be created based on "not supported".
|
||||||
# In that case, do not set quality containers to empty.
|
# In that case, do not set quality containers to empty.
|
||||||
if quality_type == "not_supported":
|
|
||||||
quality_group = None
|
quality_group = None
|
||||||
else:
|
if quality_type != "not_supported":
|
||||||
quality_group_dict = self._quality_manager.getQualityGroups(self._global_container_stack)
|
quality_group_dict = self._quality_manager.getQualityGroups(self._global_container_stack)
|
||||||
quality_group = quality_group_dict[quality_type]
|
quality_group = quality_group_dict.get(quality_type)
|
||||||
|
if quality_group is None:
|
||||||
|
self._fixQualityChangesGroupToNotSupported(quality_changes_group)
|
||||||
|
|
||||||
quality_changes_container = self._empty_quality_changes_container
|
quality_changes_container = self._empty_quality_changes_container
|
||||||
quality_container = self._empty_quality_container
|
quality_container = self._empty_quality_container
|
||||||
|
|
|
@ -42,6 +42,8 @@ class GCodeWriter(MeshWriter):
|
||||||
re.escape("\r"): "\\r" # Carriage return. Windows users may need this for visualisation in their editors.
|
re.escape("\r"): "\\r" # Carriage return. Windows users may need this for visualisation in their editors.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_setting_keyword = ";SETTING_"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
@ -69,9 +71,13 @@ class GCodeWriter(MeshWriter):
|
||||||
return False
|
return False
|
||||||
gcode_list = gcode_dict.get(active_build_plate, None)
|
gcode_list = gcode_dict.get(active_build_plate, None)
|
||||||
if gcode_list is not None:
|
if gcode_list is not None:
|
||||||
|
has_settings = False
|
||||||
for gcode in gcode_list:
|
for gcode in gcode_list:
|
||||||
|
if gcode[:len(self._setting_keyword)] == self._setting_keyword:
|
||||||
|
has_settings = True
|
||||||
stream.write(gcode)
|
stream.write(gcode)
|
||||||
# Serialise the current container stack and put it at the end of the file.
|
# Serialise the current container stack and put it at the end of the file.
|
||||||
|
if not has_settings:
|
||||||
settings = self._serialiseSettings(Application.getInstance().getGlobalContainerStack())
|
settings = self._serialiseSettings(Application.getInstance().getGlobalContainerStack())
|
||||||
stream.write(settings)
|
stream.write(settings)
|
||||||
return True
|
return True
|
||||||
|
@ -108,7 +114,7 @@ class GCodeWriter(MeshWriter):
|
||||||
container_registry = self._application.getContainerRegistry()
|
container_registry = self._application.getContainerRegistry()
|
||||||
quality_manager = self._application.getQualityManager()
|
quality_manager = self._application.getQualityManager()
|
||||||
|
|
||||||
prefix = ";SETTING_" + str(GCodeWriter.version) + " " # The prefix to put before each line.
|
prefix = self._setting_keyword + str(GCodeWriter.version) + " " # The prefix to put before each line.
|
||||||
prefix_length = len(prefix)
|
prefix_length = len(prefix)
|
||||||
|
|
||||||
quality_type = stack.quality.getMetaDataEntry("quality_type")
|
quality_type = stack.quality.getMetaDataEntry("quality_type")
|
||||||
|
|
|
@ -51,8 +51,7 @@ Menu
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
text: model.name
|
text: model.name
|
||||||
checkable: model.available
|
checkable: true
|
||||||
enabled: model.available
|
|
||||||
checked: Cura.MachineManager.activeQualityOrQualityChangesName == model.name
|
checked: Cura.MachineManager.activeQualityOrQualityChangesName == model.name
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
onTriggered: Cura.MachineManager.setQualityChangesGroup(model.quality_changes_group)
|
onTriggered: Cura.MachineManager.setQualityChangesGroup(model.quality_changes_group)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue