Use CuraContainerStack.definition instead of ContainerStack.getBottom()

We know now that it must be a Cura Container Stack. This should be a bit faster, and makes the error message I was getting a bit more clear.

Contributes to issue CURA-3803.
This commit is contained in:
Ghostkeeper 2017-05-22 12:58:15 +02:00
parent 5ae02fb4c6
commit 8c166ea770
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -1,4 +1,4 @@
# Copyright (c) 2016 Ultimaker B.V. # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher. # Cura is released under the terms of the AGPLv3 or higher.
from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal
@ -35,7 +35,7 @@ class SettingInheritanceManager(QObject):
## Get the keys of all children settings with an override. ## Get the keys of all children settings with an override.
@pyqtSlot(str, result = "QStringList") @pyqtSlot(str, result = "QStringList")
def getChildrenKeysWithOverride(self, key): def getChildrenKeysWithOverride(self, key):
definitions = self._global_container_stack.getBottom().findDefinitions(key=key) definitions = self._global_container_stack.definition.findDefinitions(key=key)
if not definitions: if not definitions:
Logger.log("w", "Could not find definition for key [%s]", key) Logger.log("w", "Could not find definition for key [%s]", key)
return [] return []
@ -55,7 +55,7 @@ class SettingInheritanceManager(QObject):
Logger.log("w", "Unable to find extruder for current machine with index %s", extruder_index) Logger.log("w", "Unable to find extruder for current machine with index %s", extruder_index)
return [] return []
definitions = self._global_container_stack.getBottom().findDefinitions(key=key) definitions = self._global_container_stack.definition.findDefinitions(key=key)
if not definitions: if not definitions:
Logger.log("w", "Could not find definition for key [%s] (2)", key) Logger.log("w", "Could not find definition for key [%s] (2)", key)
return [] return []
@ -93,7 +93,7 @@ class SettingInheritanceManager(QObject):
def _onPropertyChanged(self, key, property_name): def _onPropertyChanged(self, key, property_name):
if (property_name == "value" or property_name == "enabled") and self._global_container_stack: if (property_name == "value" or property_name == "enabled") and self._global_container_stack:
definitions = self._global_container_stack.getBottom().findDefinitions(key = key) definitions = self._global_container_stack.definition.findDefinitions(key = key)
if not definitions: if not definitions:
return return
@ -209,7 +209,7 @@ class SettingInheritanceManager(QObject):
self._settings_with_inheritance_warning.append(setting_key) self._settings_with_inheritance_warning.append(setting_key)
# Check all the categories if any of their children have their inheritance overwritten. # Check all the categories if any of their children have their inheritance overwritten.
for category in self._global_container_stack.getBottom().findDefinitions(type = "category"): for category in self._global_container_stack.definition.findDefinitions(type = "category"):
if self._recursiveCheck(category): if self._recursiveCheck(category):
self._settings_with_inheritance_warning.append(category.key) self._settings_with_inheritance_warning.append(category.key)