mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 09:47:50 -06:00
Add a cache for settable_per_extruder property
This commit is contained in:
parent
51737dccd6
commit
9c904f95ce
2 changed files with 13 additions and 1 deletions
|
@ -60,6 +60,8 @@ class CuraContainerStack(ContainerStack):
|
||||||
import cura.CuraApplication #Here to prevent circular imports.
|
import cura.CuraApplication #Here to prevent circular imports.
|
||||||
self.setMetaDataEntry("setting_version", cura.CuraApplication.CuraApplication.SettingVersion)
|
self.setMetaDataEntry("setting_version", cura.CuraApplication.CuraApplication.SettingVersion)
|
||||||
|
|
||||||
|
self._settable_per_extruder_cache = {}
|
||||||
|
|
||||||
self.setDirty(False)
|
self.setDirty(False)
|
||||||
|
|
||||||
# This is emitted whenever the containersChanged signal from the ContainerStack base class is emitted.
|
# This is emitted whenever the containersChanged signal from the ContainerStack base class is emitted.
|
||||||
|
@ -387,6 +389,16 @@ class CuraContainerStack(ContainerStack):
|
||||||
value = int(Application.getInstance().getMachineManager().defaultExtruderPosition)
|
value = int(Application.getInstance().getMachineManager().defaultExtruderPosition)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
def getProperty(self, key: str, property_name: str, context = None) -> Any:
|
||||||
|
if property_name == "settable_per_extruder":
|
||||||
|
# Setable per extruder isn't a value that can ever change. So once we requested it once, we can just keep
|
||||||
|
# that in memory.
|
||||||
|
if key not in self._settable_per_extruder_cache:
|
||||||
|
self._settable_per_extruder_cache[key] = super().getProperty(key, property_name, context)
|
||||||
|
return self._settable_per_extruder_cache[key]
|
||||||
|
|
||||||
|
return super().getProperty(key, property_name, context)
|
||||||
|
|
||||||
|
|
||||||
class _ContainerIndexes:
|
class _ContainerIndexes:
|
||||||
"""Private helper class to keep track of container positions and their types."""
|
"""Private helper class to keep track of container positions and their types."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue