diff options
author | Jaime van Kessel <nallath@gmail.com> | 2020-01-02 12:51:40 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2020-01-02 12:51:40 +0300 |
commit | 8b393317ff1ca5024b203f2fe85642a3bf5334f4 (patch) | |
tree | 2689b6e2f5398c6920e35554c2a6f65ec69e6e5d /cura | |
parent | 1915100118d836c70e6f7a8047063b4bfa6b38eb (diff) |
Add "all" as a setting visibility preset
CURA-7082
Diffstat (limited to 'cura')
-rw-r--r-- | cura/Machines/Models/SettingVisibilityPresetsModel.py | 4 | ||||
-rwxr-xr-x | cura/Settings/MachineManager.py | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/cura/Machines/Models/SettingVisibilityPresetsModel.py b/cura/Machines/Models/SettingVisibilityPresetsModel.py index baa8e3ed29..6b5766c127 100644 --- a/cura/Machines/Models/SettingVisibilityPresetsModel.py +++ b/cura/Machines/Models/SettingVisibilityPresetsModel.py @@ -77,6 +77,10 @@ class SettingVisibilityPresetsModel(QObject): items.append(setting_visibility_preset) + # Add the "all" visibility: + all_setting_visibility_preset = SettingVisibilityPreset(preset_id = "all", name = "All", weight = 9001) + all_setting_visibility_preset.setSettings(list(CuraApplication.getInstance().getMachineManager().getAllSettingKeys())) + items.append(all_setting_visibility_preset) # Sort them on weight (and if that fails, use ID) items.sort(key = lambda k: (int(k.weight), k.presetId)) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 876f10ebf8..2a9b2e8f83 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -4,12 +4,11 @@ import time import re import unicodedata -from typing import Any, List, Dict, TYPE_CHECKING, Optional, cast +from typing import Any, List, Dict, TYPE_CHECKING, Optional, cast, Set from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal, QTimer from UM.ConfigurationErrorMessage import ConfigurationErrorMessage -from UM.Decorators import deprecated from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Settings.InstanceContainer import InstanceContainer from UM.Settings.Interfaces import ContainerInterface @@ -212,10 +211,13 @@ class MachineManager(QObject): @pyqtProperty(int, constant=True) def totalNumberOfSettings(self) -> int: - general_definition_containers = CuraContainerRegistry.getInstance().findDefinitionContainers(id = "fdmprinter") + return len(self.getAllSettingKeys()) + + def getAllSettingKeys(self) -> Set[str]: + general_definition_containers = CuraContainerRegistry.getInstance().findDefinitionContainers(id="fdmprinter") if not general_definition_containers: - return 0 - return len(general_definition_containers[0].getAllKeys()) + return set() + return general_definition_containers[0].getAllKeys() ## Triggered when the global container stack is changed in CuraApplication. def _onGlobalContainerChanged(self) -> None: |