mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-21 20:19:32 +08:00
Fix lost settings on sync to diff printer type
When syncing to a different printer type only the global user changes where kept, while the per-extruder user changes were not copied at all, since the extruder list is empty before the new machine becomes active. This commit fixes this problem by keeping a copy of the per-extruder user changes before the new machine (of different type) is activated. The copied user changes are then transfered to the new global stack after the new machine is set as active. CURA-6127
This commit is contained in:
parent
da1a5d1be6
commit
2b6b7a1f81
@ -1257,8 +1257,19 @@ class MachineManager(QObject):
|
|||||||
new_machine.setMetaDataEntry("hidden", False)
|
new_machine.setMetaDataEntry("hidden", False)
|
||||||
self._global_container_stack.setMetaDataEntry("hidden", True)
|
self._global_container_stack.setMetaDataEntry("hidden", True)
|
||||||
|
|
||||||
|
# The new_machine only has the global user changes and not the per-extruder user changes (since it has an empty
|
||||||
|
# extruderList before it becomes active). Keep a temporary copy of the per-extruder user changes and transfer
|
||||||
|
# it to the user changes of the new machine after the new_machine becomes active.
|
||||||
|
per_extruder_user_changes = {}
|
||||||
|
for extruder_name, extruder_stack in self._global_container_stack.extruders.items():
|
||||||
|
per_extruder_user_changes[extruder_name] = extruder_stack.userChanges
|
||||||
|
|
||||||
self.setActiveMachine(new_machine.getId())
|
self.setActiveMachine(new_machine.getId())
|
||||||
|
|
||||||
|
# Apply the per-extruder userChanges to the new_machine (which is of different type than the previous one).
|
||||||
|
for extruder_name in self._global_container_stack.extruders.keys():
|
||||||
|
self._global_container_stack.extruders[extruder_name].setUserChanges(per_extruder_user_changes[extruder_name])
|
||||||
|
|
||||||
@pyqtSlot(QObject)
|
@pyqtSlot(QObject)
|
||||||
def applyRemoteConfiguration(self, configuration: PrinterConfigurationModel) -> None:
|
def applyRemoteConfiguration(self, configuration: PrinterConfigurationModel) -> None:
|
||||||
if self._global_container_stack is None:
|
if self._global_container_stack is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user