mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Create extruder stack for single extruder machines on start - CURA-4482
This commit is contained in:
parent
b91824aab1
commit
d718e6e36c
20 changed files with 268 additions and 224 deletions
|
@ -12,6 +12,7 @@ from PyQt5.QtWidgets import QMessageBox
|
||||||
from UM.Decorators import override
|
from UM.Decorators import override
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
from UM.Settings.ContainerStack import ContainerStack
|
from UM.Settings.ContainerStack import ContainerStack
|
||||||
|
from UM.Settings.DefinitionContainer import DefinitionContainer
|
||||||
from UM.Settings.InstanceContainer import InstanceContainer
|
from UM.Settings.InstanceContainer import InstanceContainer
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
|
@ -42,6 +43,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
# Global stack based on metadata information.
|
# Global stack based on metadata information.
|
||||||
@override(ContainerRegistry)
|
@override(ContainerRegistry)
|
||||||
def addContainer(self, container):
|
def addContainer(self, container):
|
||||||
|
|
||||||
# Note: Intentional check with type() because we want to ignore subclasses
|
# Note: Intentional check with type() because we want to ignore subclasses
|
||||||
if type(container) == ContainerStack:
|
if type(container) == ContainerStack:
|
||||||
container = self._convertContainerStack(container)
|
container = self._convertContainerStack(container)
|
||||||
|
@ -256,7 +258,8 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
@override(ContainerRegistry)
|
@override(ContainerRegistry)
|
||||||
def load(self):
|
def load(self):
|
||||||
super().load()
|
super().load()
|
||||||
self._fixupExtruders()
|
self._registerSingleExtrusionMachinesExtruderStacks()
|
||||||
|
self._connectUpgradedExtruderStacksToMachines()
|
||||||
|
|
||||||
## Update an imported profile to match the current machine configuration.
|
## Update an imported profile to match the current machine configuration.
|
||||||
#
|
#
|
||||||
|
@ -357,8 +360,8 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
return global_container_stack.material.getId()
|
return global_container_stack.material.getId()
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
## Returns true if the current machien requires its own quality profiles
|
## Returns true if the current machine requires its own quality profiles
|
||||||
# \return true if the current machien requires its own quality profiles
|
# \return true if the current machine requires its own quality profiles
|
||||||
def _machineHasOwnQualities(self):
|
def _machineHasOwnQualities(self):
|
||||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
if global_container_stack:
|
if global_container_stack:
|
||||||
|
@ -391,12 +394,59 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
|
|
||||||
return new_stack
|
return new_stack
|
||||||
|
|
||||||
|
def _registerSingleExtrusionMachinesExtruderStacks(self):
|
||||||
|
machines = ContainerRegistry.getInstance().findContainerStacks(machine_extruder_trains = {"0": "fdmextruder"})
|
||||||
|
for machine in machines:
|
||||||
|
self._addExtruderStackForSingleExtrusionMachine(machine, "fdmextruder")
|
||||||
|
|
||||||
|
def _addExtruderStackForSingleExtrusionMachine(self, machine, extruder_id):
|
||||||
|
new_extruder_id = extruder_id
|
||||||
|
|
||||||
|
if machine.extruders and len(machine.extruders) > 0:
|
||||||
|
new_extruder_id = machine.extruders["0"].getId()
|
||||||
|
|
||||||
|
extruder_definitions = self.findDefinitionContainers(id = new_extruder_id)
|
||||||
|
|
||||||
|
if not extruder_definitions:
|
||||||
|
Logger.log("w", "Could not find definition containers for extruder %s", new_extruder_id)
|
||||||
|
return
|
||||||
|
|
||||||
|
extruder_definition = extruder_definitions[0]
|
||||||
|
unique_name = self.uniqueName(machine.getId() + " " + new_extruder_id)
|
||||||
|
|
||||||
|
extruder_stack = ExtruderStack.ExtruderStack(unique_name)
|
||||||
|
extruder_stack.setName(extruder_definition.getName())
|
||||||
|
extruder_stack.setDefinition(extruder_definition)
|
||||||
|
extruder_stack.addMetaDataEntry("machine", machine.getId())
|
||||||
|
extruder_stack.addMetaDataEntry("position", "0")
|
||||||
|
extruder_stack.setNextStack(machine)
|
||||||
|
|
||||||
|
# if machine.userChanges:
|
||||||
|
# # set existing user changes if found
|
||||||
|
# extruder_stack.setUserChanges(machine.userChanges)
|
||||||
|
# else:
|
||||||
|
# # create empty user changes container otherwise
|
||||||
|
# user_container = InstanceContainer(extruder_stack.getId() + "_user")
|
||||||
|
# user_container.addMetaDataEntry("type", "user")
|
||||||
|
# user_container.addMetaDataEntry("machine", extruder_stack.getId())
|
||||||
|
# from cura.CuraApplication import CuraApplication
|
||||||
|
# user_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
|
||||||
|
# user_container.setDefinition(extruder_definition)
|
||||||
|
# extruder_stack.setUserChanges(user_container)
|
||||||
|
# self.addContainer(user_container)
|
||||||
|
|
||||||
|
# extruder_stack.setVariantById("default")
|
||||||
|
# extruder_stack.setMaterialById("default")
|
||||||
|
# extruder_stack.setQualityById("default")
|
||||||
|
|
||||||
|
self.addContainer(extruder_stack)
|
||||||
|
|
||||||
# Fix the extruders that were upgraded to ExtruderStack instances during addContainer.
|
# Fix the extruders that were upgraded to ExtruderStack instances during addContainer.
|
||||||
# The stacks are now responsible for setting the next stack on deserialize. However,
|
# The stacks are now responsible for setting the next stack on deserialize. However,
|
||||||
# due to problems with loading order, some stacks may not have the proper next stack
|
# due to problems with loading order, some stacks may not have the proper next stack
|
||||||
# set after upgrading, because the proper global stack was not yet loaded. This method
|
# set after upgrading, because the proper global stack was not yet loaded. This method
|
||||||
# makes sure those extruders also get the right stack set.
|
# makes sure those extruders also get the right stack set.
|
||||||
def _fixupExtruders(self):
|
def _connectUpgradedExtruderStacksToMachines(self):
|
||||||
extruder_stacks = self.findContainers(ExtruderStack.ExtruderStack)
|
extruder_stacks = self.findContainers(ExtruderStack.ExtruderStack)
|
||||||
for extruder_stack in extruder_stacks:
|
for extruder_stack in extruder_stacks:
|
||||||
if extruder_stack.getNextStack():
|
if extruder_stack.getNextStack():
|
||||||
|
|
|
@ -62,7 +62,7 @@ class CuraStackBuilder:
|
||||||
variant = "default",
|
variant = "default",
|
||||||
next_stack = new_global_stack
|
next_stack = new_global_stack
|
||||||
)
|
)
|
||||||
new_global_stack.addExtruder(new_extruder)
|
# new_global_stack.addExtruder(new_extruder)
|
||||||
|
|
||||||
return new_global_stack
|
return new_global_stack
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,13 @@ from UM.FlameProfiler import pyqtSlot
|
||||||
|
|
||||||
from UM.Application import Application # To get the global container stack to find the current machine.
|
from UM.Application import Application # To get the global container stack to find the current machine.
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Decorators import deprecated
|
|
||||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||||
from UM.Scene.SceneNode import SceneNode
|
from UM.Scene.SceneNode import SceneNode
|
||||||
from UM.Scene.Selection import Selection
|
from UM.Scene.Selection import Selection
|
||||||
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry # Finding containers by ID.
|
from UM.Settings.ContainerRegistry import ContainerRegistry # Finding containers by ID.
|
||||||
from UM.Settings.InstanceContainer import InstanceContainer
|
|
||||||
from UM.Settings.SettingFunction import SettingFunction
|
from UM.Settings.SettingFunction import SettingFunction
|
||||||
from UM.Settings.ContainerStack import ContainerStack
|
from UM.Settings.ContainerStack import ContainerStack
|
||||||
from UM.Settings.Interfaces import DefinitionContainerInterface
|
|
||||||
from UM.Settings.PropertyEvaluationContext import PropertyEvaluationContext
|
from UM.Settings.PropertyEvaluationContext import PropertyEvaluationContext
|
||||||
from typing import Optional, List, TYPE_CHECKING, Union
|
from typing import Optional, List, TYPE_CHECKING, Union
|
||||||
|
|
||||||
|
@ -214,39 +211,39 @@ class ExtruderManager(QObject):
|
||||||
result.append(self.getExtruderStack(i))
|
result.append(self.getExtruderStack(i))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
## Adds all extruders of a specific machine definition to the extruder
|
# ## Adds all extruders of a specific machine definition to the extruder
|
||||||
# manager.
|
# # manager.
|
||||||
|
# #
|
||||||
|
# # \param machine_definition The machine definition to add the extruders for.
|
||||||
|
# # \param machine_id The machine_id to add the extruders for.
|
||||||
|
# @deprecated("Use CuraStackBuilder", "2.6")
|
||||||
|
# def addMachineExtruders(self, machine_definition: DefinitionContainerInterface, machine_id: str) -> None:
|
||||||
|
# changed = False
|
||||||
|
# machine_definition_id = machine_definition.getId()
|
||||||
|
# if machine_id not in self._extruder_trains:
|
||||||
|
# self._extruder_trains[machine_id] = { }
|
||||||
|
# changed = True
|
||||||
|
# container_registry = ContainerRegistry.getInstance()
|
||||||
|
# if container_registry:
|
||||||
|
# # Add the extruder trains that don't exist yet.
|
||||||
|
# for extruder_definition in container_registry.findDefinitionContainers(machine = machine_definition_id):
|
||||||
|
# position = extruder_definition.getMetaDataEntry("position", None)
|
||||||
|
# if not position:
|
||||||
|
# Logger.log("w", "Extruder definition %s specifies no position metadata entry.", extruder_definition.getId())
|
||||||
|
# if not container_registry.findContainerStacks(machine = machine_id, position = position): # Doesn't exist yet.
|
||||||
|
# self.createExtruderTrain(extruder_definition, machine_definition, position, machine_id)
|
||||||
|
# changed = True
|
||||||
#
|
#
|
||||||
# \param machine_definition The machine definition to add the extruders for.
|
# # Gets the extruder trains that we just created as well as any that still existed.
|
||||||
# \param machine_id The machine_id to add the extruders for.
|
# extruder_trains = container_registry.findContainerStacks(type = "extruder_train", machine = machine_id)
|
||||||
@deprecated("Use CuraStackBuilder", "2.6")
|
# for extruder_train in extruder_trains:
|
||||||
def addMachineExtruders(self, machine_definition: DefinitionContainerInterface, machine_id: str) -> None:
|
# self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train
|
||||||
changed = False
|
#
|
||||||
machine_definition_id = machine_definition.getId()
|
# # regardless of what the next stack is, we have to set it again, because of signal routing.
|
||||||
if machine_id not in self._extruder_trains:
|
# extruder_train.setNextStack(Application.getInstance().getGlobalContainerStack())
|
||||||
self._extruder_trains[machine_id] = { }
|
# changed = True
|
||||||
changed = True
|
# if changed:
|
||||||
container_registry = ContainerRegistry.getInstance()
|
# self.extrudersChanged.emit(machine_id)
|
||||||
if container_registry:
|
|
||||||
# Add the extruder trains that don't exist yet.
|
|
||||||
for extruder_definition in container_registry.findDefinitionContainers(machine = machine_definition_id):
|
|
||||||
position = extruder_definition.getMetaDataEntry("position", None)
|
|
||||||
if not position:
|
|
||||||
Logger.log("w", "Extruder definition %s specifies no position metadata entry.", extruder_definition.getId())
|
|
||||||
if not container_registry.findContainerStacks(machine = machine_id, position = position): # Doesn't exist yet.
|
|
||||||
self.createExtruderTrain(extruder_definition, machine_definition, position, machine_id)
|
|
||||||
changed = True
|
|
||||||
|
|
||||||
# Gets the extruder trains that we just created as well as any that still existed.
|
|
||||||
extruder_trains = container_registry.findContainerStacks(type = "extruder_train", machine = machine_id)
|
|
||||||
for extruder_train in extruder_trains:
|
|
||||||
self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train
|
|
||||||
|
|
||||||
# regardless of what the next stack is, we have to set it again, because of signal routing.
|
|
||||||
extruder_train.setNextStack(Application.getInstance().getGlobalContainerStack())
|
|
||||||
changed = True
|
|
||||||
if changed:
|
|
||||||
self.extrudersChanged.emit(machine_id)
|
|
||||||
|
|
||||||
def registerExtruder(self, extruder_train, machine_id):
|
def registerExtruder(self, extruder_train, machine_id):
|
||||||
changed = False
|
changed = False
|
||||||
|
@ -267,137 +264,137 @@ class ExtruderManager(QObject):
|
||||||
if changed:
|
if changed:
|
||||||
self.extrudersChanged.emit(machine_id)
|
self.extrudersChanged.emit(machine_id)
|
||||||
|
|
||||||
## Creates a container stack for an extruder train.
|
# ## Creates a container stack for an extruder train.
|
||||||
|
# #
|
||||||
|
# # The container stack has an extruder definition at the bottom, which is
|
||||||
|
# # linked to a machine definition. Then it has a variant profile, a material
|
||||||
|
# # profile, a quality profile and a user profile, in that order.
|
||||||
|
# #
|
||||||
|
# # The resulting container stack is added to the registry.
|
||||||
|
# #
|
||||||
|
# # \param extruder_definition The extruder to create the extruder train for.
|
||||||
|
# # \param machine_definition The machine that the extruder train belongs to.
|
||||||
|
# # \param position The position of this extruder train in the extruder slots of the machine.
|
||||||
|
# # \param machine_id The id of the "global" stack this extruder is linked to.
|
||||||
|
# @deprecated("Use CuraStackBuilder::createExtruderStack", "2.6")
|
||||||
|
# def createExtruderTrain(self, extruder_definition: DefinitionContainerInterface, machine_definition: DefinitionContainerInterface,
|
||||||
|
# position, machine_id: str) -> None:
|
||||||
|
# # Cache some things.
|
||||||
|
# container_registry = ContainerRegistry.getInstance()
|
||||||
|
# machine_definition_id = Application.getInstance().getMachineManager().getQualityDefinitionId(machine_definition)
|
||||||
#
|
#
|
||||||
# The container stack has an extruder definition at the bottom, which is
|
# # Create a container stack for this extruder.
|
||||||
# linked to a machine definition. Then it has a variant profile, a material
|
# extruder_stack_id = container_registry.uniqueName(extruder_definition.getId())
|
||||||
# profile, a quality profile and a user profile, in that order.
|
# container_stack = ContainerStack(extruder_stack_id)
|
||||||
|
# container_stack.setName(extruder_definition.getName()) # Take over the display name to display the stack with.
|
||||||
|
# container_stack.addMetaDataEntry("type", "extruder_train")
|
||||||
|
# container_stack.addMetaDataEntry("machine", machine_id)
|
||||||
|
# container_stack.addMetaDataEntry("position", position)
|
||||||
|
# container_stack.addContainer(extruder_definition)
|
||||||
#
|
#
|
||||||
# The resulting container stack is added to the registry.
|
# # Find the variant to use for this extruder.
|
||||||
|
# variant = container_registry.findInstanceContainers(id = "empty_variant")[0]
|
||||||
|
# if machine_definition.getMetaDataEntry("has_variants"):
|
||||||
|
# # First add any variant. Later, overwrite with preference if the preference is valid.
|
||||||
|
# variants = container_registry.findInstanceContainers(definition = machine_definition_id, type = "variant")
|
||||||
|
# if len(variants) >= 1:
|
||||||
|
# variant = variants[0]
|
||||||
|
# preferred_variant_id = machine_definition.getMetaDataEntry("preferred_variant")
|
||||||
|
# if preferred_variant_id:
|
||||||
|
# preferred_variants = container_registry.findInstanceContainers(id = preferred_variant_id, definition = machine_definition_id, type = "variant")
|
||||||
|
# if len(preferred_variants) >= 1:
|
||||||
|
# variant = preferred_variants[0]
|
||||||
|
# else:
|
||||||
|
# Logger.log("w", "The preferred variant \"%s\" of machine %s doesn't exist or is not a variant profile.", preferred_variant_id, machine_id)
|
||||||
|
# # And leave it at the default variant.
|
||||||
|
# container_stack.addContainer(variant)
|
||||||
#
|
#
|
||||||
# \param extruder_definition The extruder to create the extruder train for.
|
# # Find a material to use for this variant.
|
||||||
# \param machine_definition The machine that the extruder train belongs to.
|
# material = container_registry.findInstanceContainers(id = "empty_material")[0]
|
||||||
# \param position The position of this extruder train in the extruder slots of the machine.
|
# if machine_definition.getMetaDataEntry("has_materials"):
|
||||||
# \param machine_id The id of the "global" stack this extruder is linked to.
|
# # First add any material. Later, overwrite with preference if the preference is valid.
|
||||||
@deprecated("Use CuraStackBuilder::createExtruderStack", "2.6")
|
# machine_has_variant_materials = machine_definition.getMetaDataEntry("has_variant_materials", default = False)
|
||||||
def createExtruderTrain(self, extruder_definition: DefinitionContainerInterface, machine_definition: DefinitionContainerInterface,
|
# if machine_has_variant_materials or machine_has_variant_materials == "True":
|
||||||
position, machine_id: str) -> None:
|
# materials = container_registry.findInstanceContainers(type = "material", definition = machine_definition_id, variant = variant.getId())
|
||||||
# Cache some things.
|
# else:
|
||||||
container_registry = ContainerRegistry.getInstance()
|
# materials = container_registry.findInstanceContainers(type = "material", definition = machine_definition_id)
|
||||||
machine_definition_id = Application.getInstance().getMachineManager().getQualityDefinitionId(machine_definition)
|
# if len(materials) >= 1:
|
||||||
|
# material = materials[0]
|
||||||
# Create a container stack for this extruder.
|
# preferred_material_id = machine_definition.getMetaDataEntry("preferred_material")
|
||||||
extruder_stack_id = container_registry.uniqueName(extruder_definition.getId())
|
# if preferred_material_id:
|
||||||
container_stack = ContainerStack(extruder_stack_id)
|
# global_stack = ContainerRegistry.getInstance().findContainerStacks(id = machine_id)
|
||||||
container_stack.setName(extruder_definition.getName()) # Take over the display name to display the stack with.
|
# if global_stack:
|
||||||
container_stack.addMetaDataEntry("type", "extruder_train")
|
# approximate_material_diameter = str(round(global_stack[0].getProperty("material_diameter", "value")))
|
||||||
container_stack.addMetaDataEntry("machine", machine_id)
|
# else:
|
||||||
container_stack.addMetaDataEntry("position", position)
|
# approximate_material_diameter = str(round(machine_definition.getProperty("material_diameter", "value")))
|
||||||
container_stack.addContainer(extruder_definition)
|
#
|
||||||
|
# search_criteria = { "type": "material", "id": preferred_material_id, "approximate_diameter": approximate_material_diameter}
|
||||||
# Find the variant to use for this extruder.
|
# if machine_definition.getMetaDataEntry("has_machine_materials"):
|
||||||
variant = container_registry.findInstanceContainers(id = "empty_variant")[0]
|
# search_criteria["definition"] = machine_definition_id
|
||||||
if machine_definition.getMetaDataEntry("has_variants"):
|
#
|
||||||
# First add any variant. Later, overwrite with preference if the preference is valid.
|
# if machine_definition.getMetaDataEntry("has_variants") and variant:
|
||||||
variants = container_registry.findInstanceContainers(definition = machine_definition_id, type = "variant")
|
# search_criteria["variant"] = variant.id
|
||||||
if len(variants) >= 1:
|
# else:
|
||||||
variant = variants[0]
|
# search_criteria["definition"] = "fdmprinter"
|
||||||
preferred_variant_id = machine_definition.getMetaDataEntry("preferred_variant")
|
#
|
||||||
if preferred_variant_id:
|
# preferred_materials = container_registry.findInstanceContainers(**search_criteria)
|
||||||
preferred_variants = container_registry.findInstanceContainers(id = preferred_variant_id, definition = machine_definition_id, type = "variant")
|
# if len(preferred_materials) >= 1:
|
||||||
if len(preferred_variants) >= 1:
|
# # In some cases we get multiple materials. In that case, prefer materials that are marked as read only.
|
||||||
variant = preferred_variants[0]
|
# read_only_preferred_materials = [preferred_material for preferred_material in preferred_materials if preferred_material.isReadOnly()]
|
||||||
else:
|
# if len(read_only_preferred_materials) >= 1:
|
||||||
Logger.log("w", "The preferred variant \"%s\" of machine %s doesn't exist or is not a variant profile.", preferred_variant_id, machine_id)
|
# material = read_only_preferred_materials[0]
|
||||||
# And leave it at the default variant.
|
# else:
|
||||||
container_stack.addContainer(variant)
|
# material = preferred_materials[0]
|
||||||
|
# else:
|
||||||
# Find a material to use for this variant.
|
# Logger.log("w", "The preferred material \"%s\" of machine %s doesn't exist or is not a material profile.", preferred_material_id, machine_id)
|
||||||
material = container_registry.findInstanceContainers(id = "empty_material")[0]
|
# # And leave it at the default material.
|
||||||
if machine_definition.getMetaDataEntry("has_materials"):
|
# container_stack.addContainer(material)
|
||||||
# First add any material. Later, overwrite with preference if the preference is valid.
|
#
|
||||||
machine_has_variant_materials = machine_definition.getMetaDataEntry("has_variant_materials", default = False)
|
# # Find a quality to use for this extruder.
|
||||||
if machine_has_variant_materials or machine_has_variant_materials == "True":
|
# quality = container_registry.getEmptyInstanceContainer()
|
||||||
materials = container_registry.findInstanceContainers(type = "material", definition = machine_definition_id, variant = variant.getId())
|
#
|
||||||
else:
|
# search_criteria = { "type": "quality" }
|
||||||
materials = container_registry.findInstanceContainers(type = "material", definition = machine_definition_id)
|
# if machine_definition.getMetaDataEntry("has_machine_quality"):
|
||||||
if len(materials) >= 1:
|
# search_criteria["definition"] = machine_definition_id
|
||||||
material = materials[0]
|
# if machine_definition.getMetaDataEntry("has_materials") and material:
|
||||||
preferred_material_id = machine_definition.getMetaDataEntry("preferred_material")
|
# search_criteria["material"] = material.id
|
||||||
if preferred_material_id:
|
# else:
|
||||||
global_stack = ContainerRegistry.getInstance().findContainerStacks(id = machine_id)
|
# search_criteria["definition"] = "fdmprinter"
|
||||||
if global_stack:
|
#
|
||||||
approximate_material_diameter = str(round(global_stack[0].getProperty("material_diameter", "value")))
|
# preferred_quality = machine_definition.getMetaDataEntry("preferred_quality")
|
||||||
else:
|
# if preferred_quality:
|
||||||
approximate_material_diameter = str(round(machine_definition.getProperty("material_diameter", "value")))
|
# search_criteria["id"] = preferred_quality
|
||||||
|
#
|
||||||
search_criteria = { "type": "material", "id": preferred_material_id, "approximate_diameter": approximate_material_diameter}
|
# containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria)
|
||||||
if machine_definition.getMetaDataEntry("has_machine_materials"):
|
# if not containers and preferred_quality:
|
||||||
search_criteria["definition"] = machine_definition_id
|
# Logger.log("w", "The preferred quality \"%s\" of machine %s doesn't exist or is not a quality profile.", preferred_quality, machine_id)
|
||||||
|
# search_criteria.pop("id", None)
|
||||||
if machine_definition.getMetaDataEntry("has_variants") and variant:
|
# containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria)
|
||||||
search_criteria["variant"] = variant.id
|
# if containers:
|
||||||
else:
|
# quality = containers[0]
|
||||||
search_criteria["definition"] = "fdmprinter"
|
#
|
||||||
|
# container_stack.addContainer(quality)
|
||||||
preferred_materials = container_registry.findInstanceContainers(**search_criteria)
|
#
|
||||||
if len(preferred_materials) >= 1:
|
# empty_quality_changes = container_registry.findInstanceContainers(id = "empty_quality_changes")[0]
|
||||||
# In some cases we get multiple materials. In that case, prefer materials that are marked as read only.
|
# container_stack.addContainer(empty_quality_changes)
|
||||||
read_only_preferred_materials = [preferred_material for preferred_material in preferred_materials if preferred_material.isReadOnly()]
|
#
|
||||||
if len(read_only_preferred_materials) >= 1:
|
# user_profile = container_registry.findInstanceContainers(type = "user", extruder = extruder_stack_id)
|
||||||
material = read_only_preferred_materials[0]
|
# if user_profile: # There was already a user profile, loaded from settings.
|
||||||
else:
|
# user_profile = user_profile[0]
|
||||||
material = preferred_materials[0]
|
# else:
|
||||||
else:
|
# user_profile = InstanceContainer(extruder_stack_id + "_current_settings") # Add an empty user profile.
|
||||||
Logger.log("w", "The preferred material \"%s\" of machine %s doesn't exist or is not a material profile.", preferred_material_id, machine_id)
|
# user_profile.addMetaDataEntry("type", "user")
|
||||||
# And leave it at the default material.
|
# user_profile.addMetaDataEntry("extruder", extruder_stack_id)
|
||||||
container_stack.addContainer(material)
|
# from cura.CuraApplication import CuraApplication
|
||||||
|
# user_profile.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
|
||||||
# Find a quality to use for this extruder.
|
# user_profile.setDefinition(machine_definition)
|
||||||
quality = container_registry.getEmptyInstanceContainer()
|
# container_registry.addContainer(user_profile)
|
||||||
|
# container_stack.addContainer(user_profile)
|
||||||
search_criteria = { "type": "quality" }
|
#
|
||||||
if machine_definition.getMetaDataEntry("has_machine_quality"):
|
# # regardless of what the next stack is, we have to set it again, because of signal routing.
|
||||||
search_criteria["definition"] = machine_definition_id
|
# container_stack.setNextStack(Application.getInstance().getGlobalContainerStack())
|
||||||
if machine_definition.getMetaDataEntry("has_materials") and material:
|
#
|
||||||
search_criteria["material"] = material.id
|
# container_registry.addContainer(container_stack)
|
||||||
else:
|
|
||||||
search_criteria["definition"] = "fdmprinter"
|
|
||||||
|
|
||||||
preferred_quality = machine_definition.getMetaDataEntry("preferred_quality")
|
|
||||||
if preferred_quality:
|
|
||||||
search_criteria["id"] = preferred_quality
|
|
||||||
|
|
||||||
containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria)
|
|
||||||
if not containers and preferred_quality:
|
|
||||||
Logger.log("w", "The preferred quality \"%s\" of machine %s doesn't exist or is not a quality profile.", preferred_quality, machine_id)
|
|
||||||
search_criteria.pop("id", None)
|
|
||||||
containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria)
|
|
||||||
if containers:
|
|
||||||
quality = containers[0]
|
|
||||||
|
|
||||||
container_stack.addContainer(quality)
|
|
||||||
|
|
||||||
empty_quality_changes = container_registry.findInstanceContainers(id = "empty_quality_changes")[0]
|
|
||||||
container_stack.addContainer(empty_quality_changes)
|
|
||||||
|
|
||||||
user_profile = container_registry.findInstanceContainers(type = "user", extruder = extruder_stack_id)
|
|
||||||
if user_profile: # There was already a user profile, loaded from settings.
|
|
||||||
user_profile = user_profile[0]
|
|
||||||
else:
|
|
||||||
user_profile = InstanceContainer(extruder_stack_id + "_current_settings") # Add an empty user profile.
|
|
||||||
user_profile.addMetaDataEntry("type", "user")
|
|
||||||
user_profile.addMetaDataEntry("extruder", extruder_stack_id)
|
|
||||||
from cura.CuraApplication import CuraApplication
|
|
||||||
user_profile.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
|
|
||||||
user_profile.setDefinition(machine_definition)
|
|
||||||
container_registry.addContainer(user_profile)
|
|
||||||
container_stack.addContainer(user_profile)
|
|
||||||
|
|
||||||
# regardless of what the next stack is, we have to set it again, because of signal routing.
|
|
||||||
container_stack.setNextStack(Application.getInstance().getGlobalContainerStack())
|
|
||||||
|
|
||||||
container_registry.addContainer(container_stack)
|
|
||||||
|
|
||||||
def getAllExtruderValues(self, setting_key):
|
def getAllExtruderValues(self, setting_key):
|
||||||
return self.getAllExtruderSettings(setting_key, "value")
|
return self.getAllExtruderSettings(setting_key, "value")
|
||||||
|
@ -545,7 +542,6 @@ class ExtruderManager(QObject):
|
||||||
if self._active_extruder_index == -1:
|
if self._active_extruder_index == -1:
|
||||||
self.setActiveExtruderIndex(0)
|
self.setActiveExtruderIndex(0)
|
||||||
|
|
||||||
self.activeExtruderChanged.emit()
|
|
||||||
self.resetSelectedObjectExtruders()
|
self.resetSelectedObjectExtruders()
|
||||||
|
|
||||||
## Adds the extruders of the currently active machine.
|
## Adds the extruders of the currently active machine.
|
||||||
|
@ -562,7 +558,7 @@ class ExtruderManager(QObject):
|
||||||
for extruder_train in extruder_trains:
|
for extruder_train in extruder_trains:
|
||||||
self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train
|
self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train
|
||||||
|
|
||||||
# regardless of what the next stack is, we have to set it again, because of signal routing.
|
# regardless of what the next stack is, we have to set it again, because of signal routing. ???
|
||||||
extruder_train.setNextStack(global_stack)
|
extruder_train.setNextStack(global_stack)
|
||||||
extruders_changed = True
|
extruders_changed = True
|
||||||
|
|
||||||
|
@ -582,7 +578,7 @@ class ExtruderManager(QObject):
|
||||||
global_stack = Application.getInstance().getGlobalContainerStack()
|
global_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
for extruder in ExtruderManager.getMachineExtruders(global_stack.getId()):
|
for extruder in ExtruderManager.getInstance().getMachineExtruders(global_stack.getId()):
|
||||||
# only include values from extruders that are "active" for the current machine instance
|
# only include values from extruders that are "active" for the current machine instance
|
||||||
if int(extruder.getMetaDataEntry("position")) >= global_stack.getProperty("machine_extruder_count", "value"):
|
if int(extruder.getMetaDataEntry("position")) >= global_stack.getProperty("machine_extruder_count", "value"):
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -201,7 +201,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
default_color = self.defaultColors[position] if 0 <= position < len(self.defaultColors) else self.defaultColors[0]
|
default_color = self.defaultColors[position] if 0 <= position < len(self.defaultColors) else self.defaultColors[0]
|
||||||
color = extruder.material.getMetaDataEntry("color_code", default = default_color) if material else default_color
|
color = extruder.material.getMetaDataEntry("color_code", default = default_color) if extruder.material else default_color
|
||||||
|
|
||||||
# construct an item with only the relevant information
|
# construct an item with only the relevant information
|
||||||
item = {
|
item = {
|
||||||
|
@ -210,7 +210,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
||||||
"color": color,
|
"color": color,
|
||||||
"index": position,
|
"index": position,
|
||||||
"definition": extruder.getBottom().getId(),
|
"definition": extruder.getBottom().getId(),
|
||||||
"material": extruder.material.getName() if material else "",
|
"material": extruder.material.getName() if extruder.material else "",
|
||||||
"variant": extruder.variant.getName() if extruder.variant else "", # e.g. print core
|
"variant": extruder.variant.getName() if extruder.variant else "", # e.g. print core
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -300,6 +300,17 @@ class MachineManager(QObject):
|
||||||
if global_material != self._empty_material_container:
|
if global_material != self._empty_material_container:
|
||||||
self._global_container_stack.setMaterial(self._empty_material_container)
|
self._global_container_stack.setMaterial(self._empty_material_container)
|
||||||
|
|
||||||
|
# TODO: update stack builder since this is not always a user created stack
|
||||||
|
# if len(self._global_container_stack.extruders) == 0:
|
||||||
|
# extruder_stack = CuraStackBuilder.createExtruderStack(
|
||||||
|
# self._global_container_stack.getId(),
|
||||||
|
# definition = self._global_container_stack.definition,
|
||||||
|
# machine_definition = self._global_container_stack.definition,
|
||||||
|
# )
|
||||||
|
# extruder_stack.setNextStack(self._global_container_stack)
|
||||||
|
# extruder_stack.propertyChanged.connect(self._onPropertyChanged)
|
||||||
|
# extruder_stack.containersChanged.connect(self._onInstanceContainersChanged)
|
||||||
|
|
||||||
# Listen for changes on all extruder stacks
|
# Listen for changes on all extruder stacks
|
||||||
for extruder_stack in ExtruderManager.getInstance().getActiveExtruderStacks():
|
for extruder_stack in ExtruderManager.getInstance().getActiveExtruderStacks():
|
||||||
extruder_stack.propertyChanged.connect(self._onPropertyChanged)
|
extruder_stack.propertyChanged.connect(self._onPropertyChanged)
|
||||||
|
@ -320,8 +331,8 @@ class MachineManager(QObject):
|
||||||
old_active_container_stack = self._active_container_stack
|
old_active_container_stack = self._active_container_stack
|
||||||
|
|
||||||
self._active_container_stack = ExtruderManager.getInstance().getActiveExtruderStack()
|
self._active_container_stack = ExtruderManager.getInstance().getActiveExtruderStack()
|
||||||
if not self._active_container_stack:
|
# if not self._active_container_stack:
|
||||||
self._active_container_stack = self._global_container_stack
|
# self._active_container_stack = self._global_container_stack
|
||||||
|
|
||||||
self._error_check_timer.start()
|
self._error_check_timer.start()
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,8 @@ class SettingInheritanceManager(QObject):
|
||||||
|
|
||||||
def _onActiveExtruderChanged(self):
|
def _onActiveExtruderChanged(self):
|
||||||
new_active_stack = ExtruderManager.getInstance().getActiveExtruderStack()
|
new_active_stack = ExtruderManager.getInstance().getActiveExtruderStack()
|
||||||
if not new_active_stack:
|
# if not new_active_stack:
|
||||||
new_active_stack = self._global_container_stack
|
# new_active_stack = self._global_container_stack
|
||||||
|
|
||||||
if new_active_stack != self._active_container_stack: # Check if changed
|
if new_active_stack != self._active_container_stack: # Check if changed
|
||||||
if self._active_container_stack: # Disconnect signal from old container (if any)
|
if self._active_container_stack: # Disconnect signal from old container (if any)
|
||||||
|
|
|
@ -27,11 +27,7 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
||||||
self._stack = PerObjectContainerStack(stack_id = id(self))
|
self._stack = PerObjectContainerStack(stack_id = id(self))
|
||||||
self._stack.setDirty(False) # This stack does not need to be saved.
|
self._stack.setDirty(False) # This stack does not need to be saved.
|
||||||
self._stack.addContainer(InstanceContainer(container_id = "SettingOverrideInstanceContainer"))
|
self._stack.addContainer(InstanceContainer(container_id = "SettingOverrideInstanceContainer"))
|
||||||
|
|
||||||
if ExtruderManager.getInstance().extruderCount > 1:
|
|
||||||
self._extruder_stack = ExtruderManager.getInstance().getExtruderStack(0).getId()
|
self._extruder_stack = ExtruderManager.getInstance().getExtruderStack(0).getId()
|
||||||
else:
|
|
||||||
self._extruder_stack = None
|
|
||||||
|
|
||||||
self._stack.propertyChanged.connect(self._onSettingChanged)
|
self._stack.propertyChanged.connect(self._onSettingChanged)
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
"visible": true,
|
"visible": true,
|
||||||
"author": "rikky",
|
"author": "rikky",
|
||||||
"manufacturer": "101Hero",
|
"manufacturer": "101Hero",
|
||||||
"machine_extruder_trains":
|
|
||||||
{
|
|
||||||
"0": "fdmextruder"
|
|
||||||
},
|
|
||||||
"file_formats": "text/x-gcode",
|
"file_formats": "text/x-gcode",
|
||||||
"platform": "101hero-platform.stl",
|
"platform": "101hero-platform.stl",
|
||||||
"supports_usb_connection": true
|
"supports_usb_connection": true
|
||||||
|
|
|
@ -10,11 +10,7 @@
|
||||||
"file_formats": "text/x-gcode",
|
"file_formats": "text/x-gcode",
|
||||||
"icon": "icon_ultimaker2",
|
"icon": "icon_ultimaker2",
|
||||||
"supports_usb_connection": true,
|
"supports_usb_connection": true,
|
||||||
"platform": "3dator_platform.stl",
|
"platform": "3dator_platform.stl"
|
||||||
"machine_extruder_trains":
|
|
||||||
{
|
|
||||||
"0": "fdmextruder"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"overrides": {
|
"overrides": {
|
||||||
|
@ -29,7 +25,6 @@
|
||||||
"layer_height": { "default_value": 0.2 },
|
"layer_height": { "default_value": 0.2 },
|
||||||
"speed_print": { "default_value": 50 },
|
"speed_print": { "default_value": 50 },
|
||||||
"speed_infill": { "default_value": 60 },
|
"speed_infill": { "default_value": 60 },
|
||||||
"machine_extruder_count": { "default_value": 1 },
|
|
||||||
"machine_heated_bed": { "default_value": true },
|
"machine_heated_bed": { "default_value": true },
|
||||||
"machine_center_is_zero": { "default_value": false },
|
"machine_center_is_zero": { "default_value": false },
|
||||||
"machine_height": { "default_value": 260 },
|
"machine_height": { "default_value": 260 },
|
||||||
|
|
|
@ -177,7 +177,7 @@ UM.MainWindow
|
||||||
|
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
|
|
||||||
MenuItem { text: catalog.i18nc("@action:inmenu", "Set as Active Extruder"); onTriggered: ExtruderManager.setActiveExtruderIndex(model.index) }
|
MenuItem { text: catalog.i18nc("@action:inmenu", "Set as Active Extruder"); onTriggered: Cura.ExtruderManager.setActiveExtruderIndex(model.index) }
|
||||||
}
|
}
|
||||||
onObjectAdded: settingsMenu.insertItem(index, object)
|
onObjectAdded: settingsMenu.insertItem(index, object)
|
||||||
onObjectRemoved: settingsMenu.removeItem(object)
|
onObjectRemoved: settingsMenu.removeItem(object)
|
||||||
|
|
|
@ -18,7 +18,7 @@ Button
|
||||||
style: UM.Theme.styles.tool_button;
|
style: UM.Theme.styles.tool_button;
|
||||||
iconSource: UM.Theme.getIcon("extruder_button")
|
iconSource: UM.Theme.getIcon("extruder_button")
|
||||||
|
|
||||||
checked: ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1
|
checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1
|
||||||
enabled: UM.Selection.hasSelection
|
enabled: UM.Selection.hasSelection
|
||||||
|
|
||||||
property color customColor: base.hovered ? UM.Theme.getColor("button_hover") : UM.Theme.getColor("button");
|
property color customColor: base.hovered ? UM.Theme.getColor("button_hover") : UM.Theme.getColor("button");
|
||||||
|
|
|
@ -31,7 +31,7 @@ Menu
|
||||||
visible: base.shouldShowExtruders
|
visible: base.shouldShowExtruders
|
||||||
enabled: UM.Selection.hasSelection
|
enabled: UM.Selection.hasSelection
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: ExtruderManager.selectedObjectExtruders.indexOf(model.id) != -1
|
checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(model.id) != -1
|
||||||
onTriggered: CuraActions.setExtruderForSelection(model.id)
|
onTriggered: CuraActions.setExtruderForSelection(model.id)
|
||||||
shortcut: "Ctrl+" + (model.index + 1)
|
shortcut: "Ctrl+" + (model.index + 1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,16 +72,16 @@ Menu
|
||||||
{
|
{
|
||||||
text: model.name
|
text: model.name
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: model.id == Cura.MachineManager.allActiveMaterialIds[ExtruderManager.extruderIds[extruderIndex]]
|
checked: model.id == Cura.MachineManager.allActiveMaterialIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
// This workaround is done because of the application menus for materials and variants for multiextrusion printers.
|
// This workaround is done because of the application menus for materials and variants for multiextrusion printers.
|
||||||
// The extruder menu would always act on the correspoding extruder only, instead of acting on the extruder selected in the UI.
|
// The extruder menu would always act on the correspoding extruder only, instead of acting on the extruder selected in the UI.
|
||||||
var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
|
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
|
||||||
ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
||||||
Cura.MachineManager.setActiveMaterial(model.id);
|
Cura.MachineManager.setActiveMaterial(model.id);
|
||||||
ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onObjectAdded: menu.insertItem(index, object)
|
onObjectAdded: menu.insertItem(index, object)
|
||||||
|
@ -115,16 +115,16 @@ Menu
|
||||||
{
|
{
|
||||||
text: model.name
|
text: model.name
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: model.id == Cura.MachineManager.allActiveMaterialIds[ExtruderManager.extruderIds[extruderIndex]]
|
checked: model.id == Cura.MachineManager.allActiveMaterialIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
// This workaround is done because of the application menus for materials and variants for multiextrusion printers.
|
// This workaround is done because of the application menus for materials and variants for multiextrusion printers.
|
||||||
// The extruder menu would always act on the correspoding extruder only, instead of acting on the extruder selected in the UI.
|
// The extruder menu would always act on the correspoding extruder only, instead of acting on the extruder selected in the UI.
|
||||||
var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
|
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
|
||||||
ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
||||||
Cura.MachineManager.setActiveMaterial(model.id);
|
Cura.MachineManager.setActiveMaterial(model.id);
|
||||||
ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onObjectAdded: brandMaterialsMenu.insertItem(index, object)
|
onObjectAdded: brandMaterialsMenu.insertItem(index, object)
|
||||||
|
|
|
@ -38,15 +38,15 @@ Menu
|
||||||
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex && !isClusterPrinter
|
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex && !isClusterPrinter
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
|
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
|
||||||
ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
||||||
var hotendId = Cura.MachineManager.printerOutputDevices[0].hotendIds[extruderIndex];
|
var hotendId = Cura.MachineManager.printerOutputDevices[0].hotendIds[extruderIndex];
|
||||||
var itemIndex = nozzleInstantiator.model.find("name", hotendId);
|
var itemIndex = nozzleInstantiator.model.find("name", hotendId);
|
||||||
if(itemIndex > -1)
|
if(itemIndex > -1)
|
||||||
{
|
{
|
||||||
Cura.MachineManager.setActiveVariant(nozzleInstantiator.model.getItem(itemIndex).id);
|
Cura.MachineManager.setActiveVariant(nozzleInstantiator.model.getItem(itemIndex).id);
|
||||||
}
|
}
|
||||||
ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,14 +69,14 @@ Menu
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: model.name
|
text: model.name
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: model.id == Cura.MachineManager.allActiveVariantIds[ExtruderManager.extruderIds[extruderIndex]]
|
checked: model.id == Cura.MachineManager.allActiveVariantIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
|
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
|
||||||
ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
|
||||||
Cura.MachineManager.setActiveVariant(model.id);
|
Cura.MachineManager.setActiveVariant(model.id);
|
||||||
ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onObjectAdded: menu.insertItem(index, object)
|
onObjectAdded: menu.insertItem(index, object)
|
||||||
|
|
|
@ -208,7 +208,7 @@ UM.ManagementPage
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
currentIndex: ExtruderManager.extruderCount > 0 ? ExtruderManager.activeExtruderIndex + 1 : 0
|
currentIndex: Cura.ExtruderManager.extruderCount > 0 ? Cura.ExtruderManager.activeExtruderIndex + 1 : 0
|
||||||
|
|
||||||
ProfileTab
|
ProfileTab
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,7 +87,7 @@ Column
|
||||||
|
|
||||||
Label //Extruder name.
|
Label //Extruder name.
|
||||||
{
|
{
|
||||||
text: ExtruderManager.getExtruderName(index) != "" ? ExtruderManager.getExtruderName(index) : catalog.i18nc("@label", "Extruder")
|
text: Cura.ExtruderManager.getExtruderName(index) != "" ? Cura.ExtruderManager.getExtruderName(index) : catalog.i18nc("@label", "Extruder")
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
|
|
@ -157,7 +157,7 @@ Item {
|
||||||
var tooltipText = catalog.i18nc("@label", "This setting is always shared between all extruders. Changing it here will change the value for all extruders") + ".";
|
var tooltipText = catalog.i18nc("@label", "This setting is always shared between all extruders. Changing it here will change the value for all extruders") + ".";
|
||||||
if ((resolve != "None") && (stackLevel != 0)) {
|
if ((resolve != "None") && (stackLevel != 0)) {
|
||||||
// We come here if a setting has a resolve and the setting is not manually edited.
|
// We come here if a setting has a resolve and the setting is not manually edited.
|
||||||
tooltipText += " " + catalog.i18nc("@label", "The value is resolved from per-extruder values ") + "[" + ExtruderManager.getInstanceExtruderValues(definition.key) + "].";
|
tooltipText += " " + catalog.i18nc("@label", "The value is resolved from per-extruder values ") + "[" + Cura.ExtruderManager.getInstanceExtruderValues(definition.key) + "].";
|
||||||
}
|
}
|
||||||
base.showTooltip(tooltipText);
|
base.showTooltip(tooltipText);
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,7 +268,7 @@ Item
|
||||||
Behavior on opacity { NumberAnimation { duration: 100 } }
|
Behavior on opacity { NumberAnimation { duration: 100 } }
|
||||||
enabled:
|
enabled:
|
||||||
{
|
{
|
||||||
if(!ExtruderManager.activeExtruderStackId && machineExtruderCount.properties.value > 1)
|
if (!Cura.ExtruderManager.activeExtruderStackId && machineExtruderCount.properties.value > 1)
|
||||||
{
|
{
|
||||||
// disable all controls on the global tab, except categories
|
// disable all controls on the global tab, except categories
|
||||||
return model.type == "category"
|
return model.type == "category"
|
||||||
|
@ -338,12 +338,12 @@ Item
|
||||||
if(inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0)
|
if(inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0)
|
||||||
{
|
{
|
||||||
//We have limit_to_extruder, so pick that stack.
|
//We have limit_to_extruder, so pick that stack.
|
||||||
return ExtruderManager.extruderIds[String(inheritStackProvider.properties.limit_to_extruder)];
|
return Cura.ExtruderManager.extruderIds[String(inheritStackProvider.properties.limit_to_extruder)];
|
||||||
}
|
}
|
||||||
if(ExtruderManager.activeExtruderStackId)
|
if(Cura.ExtruderManager.activeExtruderStackId)
|
||||||
{
|
{
|
||||||
//We're on an extruder tab. Pick the current extruder.
|
//We're on an extruder tab. Pick the current extruder.
|
||||||
return ExtruderManager.activeExtruderStackId;
|
return Cura.ExtruderManager.activeExtruderStackId;
|
||||||
}
|
}
|
||||||
//No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab.
|
//No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab.
|
||||||
return activeMachineId;
|
return activeMachineId;
|
||||||
|
|
|
@ -14,7 +14,7 @@ Column
|
||||||
{
|
{
|
||||||
id: base;
|
id: base;
|
||||||
|
|
||||||
property int currentExtruderIndex: ExtruderManager.activeExtruderIndex;
|
property int currentExtruderIndex: Cura.ExtruderManager.activeExtruderIndex;
|
||||||
property bool currentExtruderVisible: extrudersList.visible;
|
property bool currentExtruderVisible: extrudersList.visible;
|
||||||
|
|
||||||
spacing: Math.floor(UM.Theme.getSize("sidebar_margin").width * 0.9)
|
spacing: Math.floor(UM.Theme.getSize("sidebar_margin").width * 0.9)
|
||||||
|
@ -93,7 +93,7 @@ Column
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values.
|
forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values.
|
||||||
ExtruderManager.setActiveExtruderIndex(index);
|
Cura.ExtruderManager.setActiveExtruderIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
style: ButtonStyle
|
style: ButtonStyle
|
||||||
|
|
|
@ -19,7 +19,7 @@ Item
|
||||||
property Action configureSettings;
|
property Action configureSettings;
|
||||||
property variant minimumPrintTime: PrintInformation.minimumPrintTime;
|
property variant minimumPrintTime: PrintInformation.minimumPrintTime;
|
||||||
property variant maximumPrintTime: PrintInformation.maximumPrintTime;
|
property variant maximumPrintTime: PrintInformation.maximumPrintTime;
|
||||||
property bool settingsEnabled: ExtruderManager.activeExtruderStackId || machineExtruderCount.properties.value == 1
|
property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || machineExtruderCount.properties.value == 1
|
||||||
|
|
||||||
Component.onCompleted: PrintInformation.enabled = true
|
Component.onCompleted: PrintInformation.enabled = true
|
||||||
Component.onDestruction: PrintInformation.enabled = false
|
Component.onDestruction: PrintInformation.enabled = false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue