mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-11 08:47:50 -06:00
We now check if a setting can also be removed to get the same state
THis should prevent the reset buttons from showing up when there is nothing going on. CURA-1758
This commit is contained in:
parent
fa61a9e3f0
commit
be252fb84f
1 changed files with 21 additions and 1 deletions
|
@ -234,7 +234,27 @@ class MachineManager(QObject):
|
||||||
for container in extruder_stack.getContainers():
|
for container in extruder_stack.getContainers():
|
||||||
if container.__class__ == UM.Settings.InstanceContainer and container.getInstance(key) != None:
|
if container.__class__ == UM.Settings.InstanceContainer and container.getInstance(key) != None:
|
||||||
if container.getProperty(key, "value") != new_value:
|
if container.getProperty(key, "value") != new_value:
|
||||||
extruder_stack.getTop().setProperty(key, "value", new_value)
|
# It could be that the setting needs to be removed instead of updated.
|
||||||
|
temp = extruder_stack
|
||||||
|
containers = extruder_stack.getContainers()
|
||||||
|
# Ensure we have the entire 'chain'
|
||||||
|
while temp.getNextStack():
|
||||||
|
temp = temp.getNextStack()
|
||||||
|
containers.extend(temp.getContainers())
|
||||||
|
instance_needs_removal = False
|
||||||
|
|
||||||
|
if len(containers) > 1:
|
||||||
|
for index in range(1, len(containers)):
|
||||||
|
deeper_container = containers[index]
|
||||||
|
if deeper_container.getProperty(key, "value") == new_value:
|
||||||
|
# Removal will result in correct value, so do that.
|
||||||
|
# We do this to prevent the reset from showing up unneeded.
|
||||||
|
instance_needs_removal = True
|
||||||
|
break
|
||||||
|
if instance_needs_removal:
|
||||||
|
extruder_stack.getTop().removeInstance(key)
|
||||||
|
else:
|
||||||
|
extruder_stack.getTop().setProperty(key, "value", new_value)
|
||||||
else:
|
else:
|
||||||
# Check if we really need to remove something.
|
# Check if we really need to remove something.
|
||||||
if extruder_stack.getProperty(key, "value") != new_value:
|
if extruder_stack.getProperty(key, "value") != new_value:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue