mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 16:48:58 +08: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
@ -131,13 +131,13 @@ class ExtruderStack(CuraContainerStack):
|
|||||||
if not self._next_stack:
|
if not self._next_stack:
|
||||||
raise Exceptions.NoGlobalStackError("Extruder {id} is missing the next stack!".format(id = self.id))
|
raise Exceptions.NoGlobalStackError("Extruder {id} is missing the next stack!".format(id = self.id))
|
||||||
|
|
||||||
if context is None:
|
if context:
|
||||||
context = PropertyEvaluationContext()
|
context.pushContainer(self)
|
||||||
context.pushContainer(self)
|
|
||||||
|
|
||||||
if not super().getProperty(key, "settable_per_extruder", context):
|
if not super().getProperty(key, "settable_per_extruder", context):
|
||||||
result = self.getNextStack().getProperty(key, property_name, context)
|
result = self.getNextStack().getProperty(key, property_name, context)
|
||||||
context.popContainer()
|
if context:
|
||||||
|
context.popContainer()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
limit_to_extruder = super().getProperty(key, "limit_to_extruder", context)
|
limit_to_extruder = super().getProperty(key, "limit_to_extruder", context)
|
||||||
@ -150,13 +150,15 @@ class ExtruderStack(CuraContainerStack):
|
|||||||
try:
|
try:
|
||||||
result = self.getNextStack().extruderList[int(limit_to_extruder)].getProperty(key, property_name, context)
|
result = self.getNextStack().extruderList[int(limit_to_extruder)].getProperty(key, property_name, context)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
context.popContainer()
|
if context:
|
||||||
|
context.popContainer()
|
||||||
return result
|
return result
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
result = super().getProperty(key, property_name, context)
|
result = super().getProperty(key, property_name, context)
|
||||||
context.popContainer()
|
if context:
|
||||||
|
context.popContainer()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@override(CuraContainerStack)
|
@override(CuraContainerStack)
|
||||||
|
@ -211,9 +211,8 @@ class GlobalStack(CuraContainerStack):
|
|||||||
if not self.definition.findDefinitions(key = key):
|
if not self.definition.findDefinitions(key = key):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if context is None:
|
if context:
|
||||||
context = PropertyEvaluationContext()
|
context.pushContainer(self)
|
||||||
context.pushContainer(self)
|
|
||||||
|
|
||||||
# Handle the "resolve" property.
|
# Handle the "resolve" property.
|
||||||
#TODO: Why the hell does this involve threading?
|
#TODO: Why the hell does this involve threading?
|
||||||
@ -238,13 +237,15 @@ class GlobalStack(CuraContainerStack):
|
|||||||
if super().getProperty(key, "settable_per_extruder", context):
|
if super().getProperty(key, "settable_per_extruder", context):
|
||||||
result = self._extruders[str(limit_to_extruder)].getProperty(key, property_name, context)
|
result = self._extruders[str(limit_to_extruder)].getProperty(key, property_name, context)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
context.popContainer()
|
if context:
|
||||||
|
context.popContainer()
|
||||||
return result
|
return result
|
||||||
else:
|
else:
|
||||||
Logger.log("e", "Setting {setting} has limit_to_extruder but is not settable per extruder!", setting = key)
|
Logger.log("e", "Setting {setting} has limit_to_extruder but is not settable per extruder!", setting = key)
|
||||||
|
|
||||||
result = super().getProperty(key, property_name, context)
|
result = super().getProperty(key, property_name, context)
|
||||||
context.popContainer()
|
if context:
|
||||||
|
context.popContainer()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@override(ContainerStack)
|
@override(ContainerStack)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user