Improve speed of the inherit button

A few unneeded conversions were done. Also moved one check to python from JS
This commit is contained in:
Jaime van Kessel 2021-10-08 18:12:35 +02:00
parent 2c9f31cbde
commit 285a4584e7
2 changed files with 6 additions and 2 deletions

View file

@ -61,6 +61,10 @@ class SettingInheritanceManager(QObject):
result.append(key) result.append(key)
return result return result
@pyqtSlot(str, str, result = bool)
def hasOverrides(self, key: str, extruder_index: str):
return key in self.getOverridesForExtruder(key, extruder_index)
@pyqtSlot(str, str, result = "QStringList") @pyqtSlot(str, str, result = "QStringList")
def getOverridesForExtruder(self, key: str, extruder_index: str) -> List[str]: def getOverridesForExtruder(self, key: str, extruder_index: str) -> List[str]:
if self._global_container_stack is None: if self._global_container_stack is None:

View file

@ -269,7 +269,7 @@ Item
} }
// If the setting does not have a limit_to_extruder property (or is -1), use the active stack. // If the setting does not have a limit_to_extruder property (or is -1), use the active stack.
if (globalPropertyProvider.properties.limit_to_extruder === null || String(globalPropertyProvider.properties.limit_to_extruder) === "-1") if (globalPropertyProvider.properties.limit_to_extruder === null || globalPropertyProvider.properties.limit_to_extruder === "-1")
{ {
return Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0 return Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0
} }
@ -283,7 +283,7 @@ Item
{ {
return false return false
} }
return Cura.SettingInheritanceManager.getOverridesForExtruder(definition.key, String(globalPropertyProvider.properties.limit_to_extruder)).indexOf(definition.key) >= 0 return Cura.SettingInheritanceManager.hasOverrides(definition.key, globalPropertyProvider.properties.limit_to_extruder)
} }
anchors.top: parent.top anchors.top: parent.top