mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-31 18:46:02 +08:00
Apply code consistency suggestions
CURA-11475
This commit is contained in:
parent
d16c7a84a9
commit
70f18c1143
@ -168,7 +168,7 @@ class SettingInheritanceManager(QObject):
|
|||||||
def settingsWithInheritanceWarning(self) -> List[str]:
|
def settingsWithInheritanceWarning(self) -> List[str]:
|
||||||
return self._settings_with_inheritance_warning
|
return self._settings_with_inheritance_warning
|
||||||
|
|
||||||
def _userSettingIsOverwritingInheritance(self, key: str, stack: ContainerStack, all_keys: Set[str]) -> bool:
|
def _userSettingIsOverwritingInheritance(self, key: str, stack: ContainerStack, all_keys: Set[str] = set()) -> bool:
|
||||||
"""Check if a setting known as having a User state has an inheritance function that is overwritten"""
|
"""Check if a setting known as having a User state has an inheritance function that is overwritten"""
|
||||||
|
|
||||||
has_setting_function = False
|
has_setting_function = False
|
||||||
@ -180,11 +180,14 @@ class SettingInheritanceManager(QObject):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
user_container = stack.getTop()
|
user_container = stack.getTop()
|
||||||
"""Also check if the top container is not a setting function (this happens if the inheritance is restored)."""
|
# Also check if the top container is not a setting function (this happens if the inheritance is restored).
|
||||||
|
|
||||||
if user_container and isinstance(user_container.getProperty(key, "value"), SettingFunction):
|
if user_container and isinstance(user_container.getProperty(key, "value"), SettingFunction):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if not all_keys:
|
||||||
|
all_keys = self._active_container_stack.getAllKeys()
|
||||||
|
|
||||||
## Mash all containers for all the stacks together.
|
## Mash all containers for all the stacks together.
|
||||||
while stack:
|
while stack:
|
||||||
containers.extend(stack.getContainers())
|
containers.extend(stack.getContainers())
|
||||||
@ -231,9 +234,7 @@ class SettingInheritanceManager(QObject):
|
|||||||
if not has_user_state:
|
if not has_user_state:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
all_keys = self._active_container_stack.getAllKeys()
|
return self._userSettingIsOverwritingInheritance(key, stack)
|
||||||
|
|
||||||
return self._userSettingIsOverwritingInheritance(key, stack, all_keys)
|
|
||||||
|
|
||||||
def _update(self) -> None:
|
def _update(self) -> None:
|
||||||
self._settings_with_inheritance_warning = [] # Reset previous data.
|
self._settings_with_inheritance_warning = [] # Reset previous data.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user