Postpone containersChanged signals when doign setActive* calls

This makes sure we do not trigger everything three times when switching
variants.
This commit is contained in:
Arjen Hiemstra 2017-02-07 16:26:44 +01:00
parent aeb8fbd82e
commit 927055806c

View File

@ -10,6 +10,7 @@ from UM.Application import Application
from UM.Preferences import Preferences
from UM.Logger import Logger
from UM.Message import Message
from UM.Signal import postponeSignals
import UM.Settings
@ -694,6 +695,7 @@ class MachineManager(QObject):
# Depending on from/to material+current variant, a quality profile is chosen and set.
@pyqtSlot(str)
def setActiveMaterial(self, material_id):
with postponeSignals(self._global_container_stack.containersChanged, self._active_container_stack.containersChanged, compress = True):
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = material_id)
if not containers or not self._active_container_stack:
return
@ -751,7 +753,9 @@ class MachineManager(QObject):
self.setActiveQuality(new_quality_id)
@pyqtSlot(str)
@profile
def setActiveVariant(self, variant_id):
with postponeSignals(self._global_container_stack.containersChanged, self._active_container_stack.containersChanged, compress = True):
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = variant_id)
if not containers or not self._active_container_stack:
return
@ -775,6 +779,7 @@ class MachineManager(QObject):
# \param quality_id The quality_id of either a quality or a quality_changes
@pyqtSlot(str)
def setActiveQuality(self, quality_id):
with postponeSignals(self._global_container_stack.containersChanged, self._active_container_stack.containersChanged, compress = True):
self.blurSettings.emit()
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = quality_id)