From 58fec04650af09e4acabfbad3a3c2f7e99efc533 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 8 Oct 2019 10:53:58 +0200 Subject: [PATCH] Don't emit a globalcontainer changed signal when only the name changed Apart form it being way to agressive (and thus, slowing things down), it also caused a re-slice to be done when a printer was connected with another printer. --- cura/Settings/MachineManager.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index a4ff8fbbfa..c43463f64d 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -221,10 +221,6 @@ class MachineManager(QObject): def _onGlobalContainerChanged(self) -> None: if self._global_container_stack: - try: - self._global_container_stack.nameChanged.disconnect(self._onMachineNameChanged) - except TypeError: # pyQtSignal gives a TypeError when disconnecting from something that was already disconnected. - pass try: self._global_container_stack.containersChanged.disconnect(self._onContainersChanged) except TypeError: @@ -249,7 +245,6 @@ class MachineManager(QObject): if self._global_container_stack: self._application.getPreferences().setValue("cura/active_machine", self._global_container_stack.getId()) - self._global_container_stack.nameChanged.connect(self._onMachineNameChanged) self._global_container_stack.containersChanged.connect(self._onContainersChanged) self._global_container_stack.propertyChanged.connect(self._onPropertyChanged) @@ -1058,9 +1053,6 @@ class MachineManager(QObject): self.activeMaterialChanged.emit() self.activeIntentChanged.emit() - def _onMachineNameChanged(self) -> None: - self.globalContainerChanged.emit() - def _onMaterialNameChanged(self) -> None: self.activeMaterialChanged.emit() @@ -1390,10 +1382,10 @@ class MachineManager(QObject): # instance with the same network key. @pyqtSlot(str) def switchPrinterType(self, machine_name: str) -> None: - Logger.log("i", "Attempting to switch the printer type to [%s]", machine_name) # Don't switch if the user tries to change to the same type of printer if self._global_container_stack is None or self.activeMachineDefinitionName == machine_name: return + Logger.log("i", "Attempting to switch the printer type to [%s]", machine_name) # Get the definition id corresponding to this machine name machine_definition_id = CuraContainerRegistry.getInstance().findDefinitionContainers(name = machine_name)[0].getId() # Try to find a machine with the same network key