mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Don't create a context when it's not provided
The rest of the functions already assume that None is an empty context
This commit is contained in:
parent
4c00a8ff2c
commit
51737dccd6
2 changed files with 15 additions and 12 deletions
|
|
@ -131,12 +131,12 @@ class ExtruderStack(CuraContainerStack):
|
|||
if not self._next_stack:
|
||||
raise Exceptions.NoGlobalStackError("Extruder {id} is missing the next stack!".format(id = self.id))
|
||||
|
||||
if context is None:
|
||||
context = PropertyEvaluationContext()
|
||||
if context:
|
||||
context.pushContainer(self)
|
||||
|
||||
if not super().getProperty(key, "settable_per_extruder", context):
|
||||
result = self.getNextStack().getProperty(key, property_name, context)
|
||||
if context:
|
||||
context.popContainer()
|
||||
return result
|
||||
|
||||
|
|
@ -150,12 +150,14 @@ class ExtruderStack(CuraContainerStack):
|
|||
try:
|
||||
result = self.getNextStack().extruderList[int(limit_to_extruder)].getProperty(key, property_name, context)
|
||||
if result is not None:
|
||||
if context:
|
||||
context.popContainer()
|
||||
return result
|
||||
except IndexError:
|
||||
pass
|
||||
|
||||
result = super().getProperty(key, property_name, context)
|
||||
if context:
|
||||
context.popContainer()
|
||||
return result
|
||||
|
||||
|
|
|
|||
|
|
@ -211,8 +211,7 @@ class GlobalStack(CuraContainerStack):
|
|||
if not self.definition.findDefinitions(key = key):
|
||||
return None
|
||||
|
||||
if context is None:
|
||||
context = PropertyEvaluationContext()
|
||||
if context:
|
||||
context.pushContainer(self)
|
||||
|
||||
# Handle the "resolve" property.
|
||||
|
|
@ -238,12 +237,14 @@ class GlobalStack(CuraContainerStack):
|
|||
if super().getProperty(key, "settable_per_extruder", context):
|
||||
result = self._extruders[str(limit_to_extruder)].getProperty(key, property_name, context)
|
||||
if result is not None:
|
||||
if context:
|
||||
context.popContainer()
|
||||
return result
|
||||
else:
|
||||
Logger.log("e", "Setting {setting} has limit_to_extruder but is not settable per extruder!", setting = key)
|
||||
|
||||
result = super().getProperty(key, property_name, context)
|
||||
if context:
|
||||
context.popContainer()
|
||||
return result
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue