mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 18:27:51 -06:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
15c65396a9
7 changed files with 62 additions and 14 deletions
|
@ -223,6 +223,9 @@ class MachineManager(QObject):
|
|||
|
||||
def _onActiveExtruderStackChanged(self):
|
||||
self.blurSettings.emit() # Ensure no-one has focus.
|
||||
|
||||
old_active_container_stack = self._active_container_stack
|
||||
|
||||
if self._active_container_stack and self._active_container_stack != self._global_container_stack:
|
||||
self._active_container_stack.containersChanged.disconnect(self._onInstanceContainersChanged)
|
||||
self._active_container_stack.propertyChanged.disconnect(self._onPropertyChanged)
|
||||
|
@ -232,8 +235,16 @@ class MachineManager(QObject):
|
|||
self._active_container_stack.propertyChanged.connect(self._onPropertyChanged)
|
||||
else:
|
||||
self._active_container_stack = self._global_container_stack
|
||||
|
||||
old_active_stack_valid = self._active_stack_valid
|
||||
self._active_stack_valid = not self._checkStackForErrors(self._active_container_stack)
|
||||
self.activeStackValidationChanged.emit()
|
||||
if old_active_stack_valid != self._active_stack_valid:
|
||||
self.activeStackValidationChanged.emit()
|
||||
|
||||
if old_active_container_stack != self._active_container_stack:
|
||||
# Many methods and properties related to the active quality actually depend
|
||||
# on _active_container_stack. If it changes, then the properties change.
|
||||
self.activeQualityChanged.emit()
|
||||
|
||||
def _onInstanceContainersChanged(self, container):
|
||||
container_type = container.getMetaDataEntry("type")
|
||||
|
@ -475,11 +486,11 @@ class MachineManager(QObject):
|
|||
|
||||
@pyqtProperty(str, notify=activeQualityChanged)
|
||||
def activeQualityId(self):
|
||||
if self._global_container_stack:
|
||||
quality = self._global_container_stack.findContainer({"type": "quality_changes"})
|
||||
if self._active_container_stack:
|
||||
quality = self._active_container_stack.findContainer({"type": "quality_changes"})
|
||||
if quality and quality != self._empty_quality_changes_container:
|
||||
return quality.getId()
|
||||
quality = self._global_container_stack.findContainer({"type": "quality"})
|
||||
quality = self._active_container_stack.findContainer({"type": "quality"})
|
||||
if quality:
|
||||
return quality.getId()
|
||||
return ""
|
||||
|
@ -492,6 +503,21 @@ class MachineManager(QObject):
|
|||
return quality.getMetaDataEntry("quality_type")
|
||||
return ""
|
||||
|
||||
## Get the Quality ID associated with the currently active extruder
|
||||
# Note that this only returns the "quality", not the "quality_changes"
|
||||
# \returns QualityID (string) if found, empty string otherwise
|
||||
# \sa activeQualityId()
|
||||
# \todo Ideally, this method would be named activeQualityId(), and the other one
|
||||
# would be named something like activeQualityOrQualityChanges() for consistency
|
||||
@pyqtProperty(str, notify = activeQualityChanged)
|
||||
def activeQualityContainerId(self):
|
||||
# We're using the active stack instead of the global stack in case the list of qualities differs per extruder
|
||||
if self._active_container_stack:
|
||||
quality = self._active_container_stack.findContainer(type = "quality")
|
||||
if quality:
|
||||
return quality.getId()
|
||||
return ""
|
||||
|
||||
@pyqtProperty(str, notify = activeQualityChanged)
|
||||
def activeQualityChangesId(self):
|
||||
if self._global_container_stack:
|
||||
|
|
|
@ -120,7 +120,11 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||
quality_container = quality_container[0]
|
||||
|
||||
quality_type = quality_container.getMetaDataEntry("quality_type")
|
||||
definition_id = quality_container.getDefinition().getId()
|
||||
definition = quality_container.getDefinition()
|
||||
if definition:
|
||||
definition_id = definition.getId()
|
||||
else:
|
||||
definition_id = "empty_quality"
|
||||
|
||||
criteria = {"type": "quality", "quality_type": quality_type, "definition": definition_id}
|
||||
|
||||
|
@ -136,9 +140,9 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||
new_criteria.pop("extruder")
|
||||
containers = self._container_registry.findInstanceContainers(**new_criteria)
|
||||
|
||||
if not containers:
|
||||
if not containers and "material" in criteria:
|
||||
# Try again, this time without material
|
||||
criteria.pop("material")
|
||||
criteria.pop("material", None)
|
||||
containers = self._container_registry.findInstanceContainers(**criteria)
|
||||
|
||||
if not containers:
|
||||
|
@ -147,7 +151,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||
containers = self._container_registry.findInstanceContainers(**criteria)
|
||||
|
||||
if not containers:
|
||||
UM.Logger.log("Could not find any quality containers matching the search criteria %s" % str(criteria))
|
||||
UM.Logger.log("w", "Could not find any quality containers matching the search criteria %s" % str(criteria))
|
||||
return
|
||||
|
||||
if quality_changes_container:
|
||||
|
|
|
@ -61,6 +61,15 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
|||
def getActiveExtruder(self):
|
||||
return self._extruder_stack
|
||||
|
||||
## Gets the currently active extruders position
|
||||
#
|
||||
# \return An extruder's position, or None if no position info is available.
|
||||
def getActiveExtruderPosition(self):
|
||||
containers = ContainerRegistry.getInstance().findContainers(id = self.getActiveExtruder())
|
||||
if containers:
|
||||
container_stack = containers[0]
|
||||
return container_stack.getMetaDataEntry("position", default=None)
|
||||
|
||||
def _onSettingChanged(self, instance, property_name): # Reminder: 'property' is a built-in function
|
||||
if property_name == "value": # Only reslice if the value has changed.
|
||||
Application.getInstance().getBackend().forceSlice()
|
||||
|
|
|
@ -84,11 +84,20 @@ class PerObjectSettingsTool(Tool):
|
|||
default_stack = ExtruderManager.getInstance().getExtruderStack(0)
|
||||
if default_stack:
|
||||
default_stack_id = default_stack.getId()
|
||||
else: default_stack_id = global_container_stack.getId()
|
||||
else:
|
||||
default_stack_id = global_container_stack.getId()
|
||||
|
||||
root_node = Application.getInstance().getController().getScene().getRoot()
|
||||
for node in DepthFirstIterator(root_node):
|
||||
node.callDecoration("setActiveExtruder", default_stack_id)
|
||||
new_stack_id = default_stack_id
|
||||
# Get position of old extruder stack for this node
|
||||
old_extruder_pos = node.callDecoration("getActiveExtruderPosition")
|
||||
if old_extruder_pos is not None:
|
||||
# Fetch current (new) extruder stack at position
|
||||
new_stack = ExtruderManager.getInstance().getExtruderStack(old_extruder_pos)
|
||||
if new_stack:
|
||||
new_stack_id = new_stack.getId()
|
||||
node.callDecoration("setActiveExtruder", new_stack_id)
|
||||
|
||||
self._updateEnabled()
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ Item
|
|||
Action
|
||||
{
|
||||
id: addProfileAction;
|
||||
enabled: Cura.MachineManager.isActiveStackValid && Cura.MachineManager.hasUserSettings
|
||||
enabled: Cura.MachineManager.isActiveStackValid && Cura.MachineManager.hasUserSettings && Cura.MachineManager.activeQualityId != "empty_quality"
|
||||
text: catalog.i18nc("@action:inmenu menubar:profile","&Create profile from current settings...");
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ UM.ManagementPage
|
|||
Button
|
||||
{
|
||||
text: catalog.i18nc("@label", "Create")
|
||||
enabled: base.canCreateProfile()
|
||||
enabled: base.canCreateProfile() && Cura.MachineManager.activeQualityId != "empty_quality"
|
||||
visible: base.canCreateProfile()
|
||||
iconName: "list-add";
|
||||
|
||||
|
@ -78,7 +78,7 @@ UM.ManagementPage
|
|||
Button
|
||||
{
|
||||
text: catalog.i18nc("@label", "Duplicate")
|
||||
enabled: ! base.canCreateProfile()
|
||||
enabled: ! base.canCreateProfile() && Cura.MachineManager.activeQualityId != "empty_quality"
|
||||
visible: ! base.canCreateProfile()
|
||||
iconName: "list-add";
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ Column
|
|||
}
|
||||
|
||||
}
|
||||
property var valueWarning: Cura.MachineManager.activeQualityId == "empty_quality"
|
||||
property var valueWarning: Cura.MachineManager.activeQualityContainerId == "empty_quality"
|
||||
|
||||
enabled: !extrudersList.visible || base.currentExtruderIndex > -1
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue