mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 12:47:49 -06:00
Add "all" as a setting visibility preset
CURA-7082
This commit is contained in:
parent
1915100118
commit
8b393317ff
4 changed files with 12 additions and 26 deletions
|
@ -77,6 +77,10 @@ class SettingVisibilityPresetsModel(QObject):
|
||||||
|
|
||||||
items.append(setting_visibility_preset)
|
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)
|
# Sort them on weight (and if that fails, use ID)
|
||||||
items.sort(key = lambda k: (int(k.weight), k.presetId))
|
items.sort(key = lambda k: (int(k.weight), k.presetId))
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,11 @@
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
import unicodedata
|
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 PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal, QTimer
|
||||||
|
|
||||||
from UM.ConfigurationErrorMessage import ConfigurationErrorMessage
|
from UM.ConfigurationErrorMessage import ConfigurationErrorMessage
|
||||||
from UM.Decorators import deprecated
|
|
||||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||||
from UM.Settings.InstanceContainer import InstanceContainer
|
from UM.Settings.InstanceContainer import InstanceContainer
|
||||||
from UM.Settings.Interfaces import ContainerInterface
|
from UM.Settings.Interfaces import ContainerInterface
|
||||||
|
@ -212,10 +211,13 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
@pyqtProperty(int, constant=True)
|
@pyqtProperty(int, constant=True)
|
||||||
def totalNumberOfSettings(self) -> int:
|
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:
|
if not general_definition_containers:
|
||||||
return 0
|
return set()
|
||||||
return len(general_definition_containers[0].getAllKeys())
|
return general_definition_containers[0].getAllKeys()
|
||||||
|
|
||||||
## Triggered when the global container stack is changed in CuraApplication.
|
## Triggered when the global container stack is changed in CuraApplication.
|
||||||
def _onGlobalContainerChanged(self) -> None:
|
def _onGlobalContainerChanged(self) -> None:
|
||||||
|
|
|
@ -14,8 +14,6 @@ Menu
|
||||||
|
|
||||||
property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
|
property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
|
||||||
|
|
||||||
signal showAllSettings()
|
|
||||||
|
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
model: settingVisibilityPresetsModel.items
|
model: settingVisibilityPresetsModel.items
|
||||||
|
@ -36,17 +34,6 @@ Menu
|
||||||
onObjectRemoved: menu.removeItem(object)
|
onObjectRemoved: menu.removeItem(object)
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuSeparator {}
|
|
||||||
MenuItem
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@action:inmenu", "Show All Settings")
|
|
||||||
checkable: false
|
|
||||||
exclusiveGroup: group
|
|
||||||
onTriggered:
|
|
||||||
{
|
|
||||||
showAllSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuSeparator {}
|
MenuSeparator {}
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
|
|
|
@ -185,14 +185,7 @@ Item
|
||||||
label: Label {}
|
label: Label {}
|
||||||
}
|
}
|
||||||
|
|
||||||
menu: SettingVisibilityPresetsMenu
|
menu: SettingVisibilityPresetsMenu {}
|
||||||
{
|
|
||||||
onShowAllSettings:
|
|
||||||
{
|
|
||||||
definitionsModel.setAllVisible(true)
|
|
||||||
filter.updateDefinitionModel()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mouse area that gathers the scroll events to not propagate it to the main view.
|
// Mouse area that gathers the scroll events to not propagate it to the main view.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue