No longer reset to default intent when configuration changed

This caused the intent to be reset every time a change was made.

CURA-6600
This commit is contained in:
Jaime van Kessel 2019-09-18 14:52:51 +02:00
parent ede007b860
commit 78ab218cc2
No known key found for this signature in database
GPG Key ID: 3710727397403C91
2 changed files with 3 additions and 19 deletions

View File

@ -10,7 +10,7 @@ from cura.Settings.IntentManager import IntentManager
from UM.Qt.ListModel import ListModel from UM.Qt.ListModel import ListModel
from UM.Settings.ContainerRegistry import ContainerRegistry #To update the list if anything changes. from UM.Settings.ContainerRegistry import ContainerRegistry #To update the list if anything changes.
from PyQt5.QtCore import pyqtProperty, pyqtSignal from PyQt5.QtCore import pyqtProperty, pyqtSignal
import cura.CuraApplication
if TYPE_CHECKING: if TYPE_CHECKING:
from UM.Settings.ContainerRegistry import ContainerInterface from UM.Settings.ContainerRegistry import ContainerInterface
@ -48,7 +48,7 @@ class IntentCategoryModel(ListModel):
ContainerRegistry.getInstance().containerAdded.connect(self._onContainerChange) ContainerRegistry.getInstance().containerAdded.connect(self._onContainerChange)
ContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChange) ContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChange)
IntentManager.getInstance().configurationChanged.connect(self.update) cura.CuraApplication.CuraApplication.getInstance().getMachineManager().activeStackChanged.connect(self.update)
self.update() self.update()

View File

@ -18,12 +18,6 @@ if TYPE_CHECKING:
class IntentManager(QObject): class IntentManager(QObject):
__instance = None __instance = None
def __init__(self) -> None:
super().__init__()
cura.CuraApplication.CuraApplication.getInstance().getMachineManager().activeStackChanged.connect(self.configurationChanged)
self.configurationChanged.connect(self.selectDefaultIntent)
pass
## This class is a singleton. ## This class is a singleton.
@classmethod @classmethod
def getInstance(cls): def getInstance(cls):
@ -31,7 +25,6 @@ class IntentManager(QObject):
cls.__instance = IntentManager() cls.__instance = IntentManager()
return cls.__instance return cls.__instance
configurationChanged = pyqtSignal() #Triggered when something changed in the rest of the stack.
intentCategoryChanged = pyqtSignal() #Triggered when we switch categories. intentCategoryChanged = pyqtSignal() #Triggered when we switch categories.
## Gets the metadata dictionaries of all intent profiles for a given ## Gets the metadata dictionaries of all intent profiles for a given
@ -150,13 +143,4 @@ class IntentManager(QObject):
extruder_stack.intent = self.getDefaultIntent() extruder_stack.intent = self.getDefaultIntent()
application.getMachineManager().setQualityGroupByQualityType(quality_type) application.getMachineManager().setQualityGroupByQualityType(quality_type)
if old_intent_category != intent_category: if old_intent_category != intent_category:
self.intentCategoryChanged.emit() self.intentCategoryChanged.emit()
## Selects the default intents on every extruder.
def selectDefaultIntent(self) -> None:
application = cura.CuraApplication.CuraApplication.getInstance()
global_stack = application.getGlobalContainerStack()
if global_stack is None:
return
for extruder_stack in global_stack.extruderList:
extruder_stack.intent = self.getDefaultIntent()