Merge branch 'speedup_inherit_button'

This commit is contained in:
Ghostkeeper 2021-11-02 17:59:28 +01:00
commit e929decce5
No known key found for this signature in database
GPG Key ID: 68F39EA88EEED5FF
3 changed files with 9 additions and 5 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

View File

@ -302,7 +302,7 @@ Item
{ {
target: provider target: provider
property: "containerStackId" property: "containerStackId"
when: model.settable_per_extruder || (inheritStackProvider.properties.limit_to_extruder !== null && inheritStackProvider.properties.limit_to_extruder >= 0); when: model.settable_per_extruder || (inheritStackProvider.properties.limit_to_extruder !== undefined && inheritStackProvider.properties.limit_to_extruder >= 0);
value: value:
{ {
// Associate this binding with Cura.MachineManager.activeMachine.id in the beginning so this // Associate this binding with Cura.MachineManager.activeMachine.id in the beginning so this
@ -315,10 +315,10 @@ Item
//Not settable per extruder or there only is global, so we must pick global. //Not settable per extruder or there only is global, so we must pick global.
return contents.activeMachineId return contents.activeMachineId
} }
if (inheritStackProvider.properties.limit_to_extruder !== null && inheritStackProvider.properties.limit_to_extruder >= 0) if (inheritStackProvider.properties.limit_to_extruder !== undefined && inheritStackProvider.properties.limit_to_extruder >= 0)
{ {
//We have limit_to_extruder, so pick that stack. //We have limit_to_extruder, so pick that stack.
return Cura.ExtruderManager.extruderIds[String(inheritStackProvider.properties.limit_to_extruder)]; return Cura.ExtruderManager.extruderIds[inheritStackProvider.properties.limit_to_extruder];
} }
if (Cura.ExtruderManager.activeExtruderStackId) if (Cura.ExtruderManager.activeExtruderStackId)
{ {