mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 13:17:51 -06:00
Added coments and simplified "user" metadata check
CURA-4333
This commit is contained in:
parent
7f5aed7ead
commit
61cdfcd3e8
1 changed files with 11 additions and 8 deletions
|
@ -413,8 +413,10 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
## Check whether user containers have adjusted settings or not
|
||||||
def getAllActiveUserChanges(self, skip_keys = {}) -> bool:
|
# \param skip_keys \type{list} List of setting keys which will be not taken into account ("support_enable" , "infill_sparse_density"...)
|
||||||
|
# \return \type{boole} Return true if user containers have any of adjusted settings
|
||||||
|
def hasUserCustomSettings(self, skip_keys = {}) -> bool:
|
||||||
|
|
||||||
user_setting_keys = []
|
user_setting_keys = []
|
||||||
|
|
||||||
|
@ -424,16 +426,16 @@ class MachineManager(QObject):
|
||||||
allContainers = self._global_container_stack.getContainers()
|
allContainers = self._global_container_stack.getContainers()
|
||||||
|
|
||||||
for container in allContainers:
|
for container in allContainers:
|
||||||
meta = container.getMetaData()
|
meta_type = container.getMetaDataEntry("type", None)
|
||||||
if meta and meta["type"] and meta["type"] == "user":
|
if meta_type == "user":
|
||||||
user_setting_keys.extend(container.getAllKeys())
|
user_setting_keys.extend(container.getAllKeys())
|
||||||
|
|
||||||
stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
|
stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
|
||||||
for stack in stacks:
|
for stack in stacks:
|
||||||
|
|
||||||
for container in stack.getContainers():
|
for container in stack.getContainers():
|
||||||
meta = container.getMetaData()
|
meta_type = container.getMetaDataEntry("type", None)
|
||||||
if meta and meta["type"] and meta["type"] == "user":
|
if meta_type == "user":
|
||||||
user_setting_keys.extend(container.getAllKeys())
|
user_setting_keys.extend(container.getAllKeys())
|
||||||
|
|
||||||
for skip_key in skip_keys:
|
for skip_key in skip_keys:
|
||||||
|
@ -442,12 +444,13 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
return len(user_setting_keys) > 0
|
return len(user_setting_keys) > 0
|
||||||
|
|
||||||
|
# These setting keys are used in SettingSimple.qml. They used to validate whether show notification(reset) icon or not
|
||||||
|
# If a changed setting is in the ignore list then this setting should be skipped and the notification not shown
|
||||||
ignore_list = ["support_enable", "infill_sparse_density", "gradual_infill_steps", "adhesion_type", "support_extruder_nr"]
|
ignore_list = ["support_enable", "infill_sparse_density", "gradual_infill_steps", "adhesion_type", "support_extruder_nr"]
|
||||||
|
|
||||||
@pyqtProperty(bool, notify = activeStackValueChanged)
|
@pyqtProperty(bool, notify = activeStackValueChanged)
|
||||||
def allActiveUserSettings(self):
|
def allActiveUserSettings(self):
|
||||||
return self.getAllActiveUserChanges(skip_keys = self.ignore_list)
|
return self.hasUserCustomSettings(skip_keys = self.ignore_list)
|
||||||
|
|
||||||
@pyqtProperty(int, notify = activeStackValueChanged)
|
@pyqtProperty(int, notify = activeStackValueChanged)
|
||||||
def numUserSettings(self) -> int:
|
def numUserSettings(self) -> int:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue