mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00
Merge remote-tracking branch 'origin/master' into cura_connect_improvements
This commit is contained in:
commit
0ecac9f01e
25 changed files with 85 additions and 130 deletions
|
@ -528,7 +528,7 @@ class BuildVolume(SceneNode):
|
|||
def _onStackChanged(self):
|
||||
if self._global_container_stack:
|
||||
self._global_container_stack.propertyChanged.disconnect(self._onSettingPropertyChanged)
|
||||
extruders = ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())
|
||||
extruders = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||
for extruder in extruders:
|
||||
extruder.propertyChanged.disconnect(self._onSettingPropertyChanged)
|
||||
|
||||
|
@ -536,7 +536,7 @@ class BuildVolume(SceneNode):
|
|||
|
||||
if self._global_container_stack:
|
||||
self._global_container_stack.propertyChanged.connect(self._onSettingPropertyChanged)
|
||||
extruders = ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())
|
||||
extruders = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||
for extruder in extruders:
|
||||
extruder.propertyChanged.connect(self._onSettingPropertyChanged)
|
||||
|
||||
|
|
|
@ -429,6 +429,7 @@ class CuraApplication(QtApplication):
|
|||
# Readers & Writers:
|
||||
"GCodeWriter",
|
||||
"STLReader",
|
||||
"3MFWriter",
|
||||
|
||||
# Tools:
|
||||
"CameraTool",
|
||||
|
|
|
@ -304,7 +304,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
|||
if self._global_stack:
|
||||
self._global_stack.propertyChanged.disconnect(self._onSettingValueChanged)
|
||||
self._global_stack.containersChanged.disconnect(self._onChanged)
|
||||
extruders = ExtruderManager.getInstance().getMachineExtruders(self._global_stack.getId())
|
||||
extruders = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||
for extruder in extruders:
|
||||
extruder.propertyChanged.disconnect(self._onSettingValueChanged)
|
||||
|
||||
|
@ -314,7 +314,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
|||
self._global_stack.propertyChanged.connect(self._onSettingValueChanged)
|
||||
self._global_stack.containersChanged.connect(self._onChanged)
|
||||
|
||||
extruders = ExtruderManager.getInstance().getMachineExtruders(self._global_stack.getId())
|
||||
extruders = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||
for extruder in extruders:
|
||||
extruder.propertyChanged.connect(self._onSettingValueChanged)
|
||||
|
||||
|
|
|
@ -12,15 +12,15 @@ from UM.Scene.Selection import Selection
|
|||
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry # Finding containers by ID.
|
||||
from UM.Settings.SettingFunction import SettingFunction
|
||||
from UM.Settings.SettingInstance import SettingInstance
|
||||
from UM.Settings.ContainerStack import ContainerStack
|
||||
from UM.Settings.PropertyEvaluationContext import PropertyEvaluationContext
|
||||
|
||||
from typing import Optional, List, TYPE_CHECKING, Union, Dict
|
||||
from typing import Optional, TYPE_CHECKING, Dict, List, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from cura.Settings.ExtruderStack import ExtruderStack
|
||||
from cura.Settings.GlobalStack import GlobalStack
|
||||
from UM.Scene.SceneNode import SceneNode
|
||||
|
||||
|
||||
## Manages all existing extruder stacks.
|
||||
|
@ -38,9 +38,10 @@ class ExtruderManager(QObject):
|
|||
|
||||
self._application = cura.CuraApplication.CuraApplication.getInstance()
|
||||
|
||||
self._extruder_trains = {} # Per machine, a dictionary of extruder container stack IDs. Only for separately defined extruders.
|
||||
# Per machine, a dictionary of extruder container stack IDs. Only for separately defined extruders.
|
||||
self._extruder_trains = {} # type: Dict[str, Dict[str, ExtruderStack]]
|
||||
self._active_extruder_index = -1 # Indicates the index of the active extruder stack. -1 means no active extruder stack
|
||||
self._selected_object_extruders = []
|
||||
self._selected_object_extruders = [] # type: List[ExtruderStack]
|
||||
self._addCurrentMachineExtruders()
|
||||
|
||||
Selection.selectionChanged.connect(self.resetSelectedObjectExtruders)
|
||||
|
@ -68,7 +69,7 @@ class ExtruderManager(QObject):
|
|||
|
||||
## Return extruder count according to extruder trains.
|
||||
@pyqtProperty(int, notify = extrudersChanged)
|
||||
def extruderCount(self):
|
||||
def extruderCount(self) -> int:
|
||||
if not self._application.getGlobalContainerStack():
|
||||
return 0 # No active machine, so no extruders.
|
||||
try:
|
||||
|
@ -83,24 +84,10 @@ class ExtruderManager(QObject):
|
|||
|
||||
global_container_stack = self._application.getGlobalContainerStack()
|
||||
if global_container_stack:
|
||||
global_stack_id = global_container_stack.getId()
|
||||
|
||||
if global_stack_id in self._extruder_trains:
|
||||
for position in self._extruder_trains[global_stack_id]:
|
||||
extruder_stack_ids[position] = self._extruder_trains[global_stack_id][position].getId()
|
||||
extruder_stack_ids = {position: extruder.id for position, extruder in global_container_stack.extruders.items()}
|
||||
|
||||
return extruder_stack_ids
|
||||
|
||||
@pyqtSlot(str, result = str)
|
||||
def getQualityChangesIdByExtruderStackId(self, extruder_stack_id: str) -> str:
|
||||
global_container_stack = self._application.getGlobalContainerStack()
|
||||
if global_container_stack is not None:
|
||||
for position in self._extruder_trains[global_container_stack.getId()]:
|
||||
extruder = self._extruder_trains[global_container_stack.getId()][position]
|
||||
if extruder.getId() == extruder_stack_id:
|
||||
return extruder.qualityChanges.getId()
|
||||
return ""
|
||||
|
||||
## Changes the active extruder by index.
|
||||
#
|
||||
# \param index The index of the new active extruder.
|
||||
|
@ -117,9 +104,9 @@ class ExtruderManager(QObject):
|
|||
#
|
||||
# \param index The index of the extruder whose name to get.
|
||||
@pyqtSlot(int, result = str)
|
||||
def getExtruderName(self, index):
|
||||
def getExtruderName(self, index: int) -> str:
|
||||
try:
|
||||
return list(self.getActiveExtruderStacks())[index].getName()
|
||||
return self.getActiveExtruderStacks()[index].getName()
|
||||
except IndexError:
|
||||
return ""
|
||||
|
||||
|
@ -133,7 +120,7 @@ class ExtruderManager(QObject):
|
|||
object_extruders = set()
|
||||
|
||||
# First, build a list of the actual selected objects (including children of groups, excluding group nodes)
|
||||
selected_nodes = []
|
||||
selected_nodes = [] # type: List["SceneNode"]
|
||||
for node in Selection.getAllSelectedObjects():
|
||||
if node.callDecoration("isGroup"):
|
||||
for grouped_node in BreadthFirstIterator(node): #type: ignore #Ignore type error because iter() should get called automatically by Python syntax.
|
||||
|
@ -145,14 +132,13 @@ class ExtruderManager(QObject):
|
|||
selected_nodes.append(node)
|
||||
|
||||
# Then, figure out which nodes are used by those selected nodes.
|
||||
global_stack = self._application.getGlobalContainerStack()
|
||||
current_extruder_trains = self._extruder_trains.get(global_stack.getId())
|
||||
current_extruder_trains = self.getActiveExtruderStacks()
|
||||
for node in selected_nodes:
|
||||
extruder = node.callDecoration("getActiveExtruder")
|
||||
if extruder:
|
||||
object_extruders.add(extruder)
|
||||
elif current_extruder_trains:
|
||||
object_extruders.add(current_extruder_trains["0"].getId())
|
||||
object_extruders.add(current_extruder_trains[0].getId())
|
||||
|
||||
self._selected_object_extruders = list(object_extruders)
|
||||
|
||||
|
@ -168,14 +154,7 @@ class ExtruderManager(QObject):
|
|||
|
||||
@pyqtSlot(result = QObject)
|
||||
def getActiveExtruderStack(self) -> Optional["ExtruderStack"]:
|
||||
global_container_stack = self._application.getGlobalContainerStack()
|
||||
|
||||
if global_container_stack:
|
||||
if global_container_stack.getId() in self._extruder_trains:
|
||||
if str(self._active_extruder_index) in self._extruder_trains[global_container_stack.getId()]:
|
||||
return self._extruder_trains[global_container_stack.getId()][str(self._active_extruder_index)]
|
||||
|
||||
return None
|
||||
return self.getExtruderStack(self._active_extruder_index)
|
||||
|
||||
## Get an extruder stack by index
|
||||
def getExtruderStack(self, index) -> Optional["ExtruderStack"]:
|
||||
|
@ -186,16 +165,7 @@ class ExtruderManager(QObject):
|
|||
return self._extruder_trains[global_container_stack.getId()][str(index)]
|
||||
return None
|
||||
|
||||
## Get all extruder stacks
|
||||
def getExtruderStacks(self) -> List["ExtruderStack"]:
|
||||
result = []
|
||||
for i in range(self.extruderCount):
|
||||
stack = self.getExtruderStack(i)
|
||||
if stack:
|
||||
result.append(stack)
|
||||
return result
|
||||
|
||||
def registerExtruder(self, extruder_train, machine_id):
|
||||
def registerExtruder(self, extruder_train: "ExtruderStack", machine_id: str) -> None:
|
||||
changed = False
|
||||
|
||||
if machine_id not in self._extruder_trains:
|
||||
|
@ -214,23 +184,20 @@ class ExtruderManager(QObject):
|
|||
if changed:
|
||||
self.extrudersChanged.emit(machine_id)
|
||||
|
||||
def getAllExtruderValues(self, setting_key):
|
||||
return self.getAllExtruderSettings(setting_key, "value")
|
||||
|
||||
## Gets a property of a setting for all extruders.
|
||||
#
|
||||
# \param setting_key \type{str} The setting to get the property of.
|
||||
# \param property \type{str} The property to get.
|
||||
# \return \type{List} the list of results
|
||||
def getAllExtruderSettings(self, setting_key: str, prop: str):
|
||||
def getAllExtruderSettings(self, setting_key: str, prop: str) -> List:
|
||||
result = []
|
||||
for index in self.extruderIds:
|
||||
extruder_stack_id = self.extruderIds[str(index)]
|
||||
extruder_stack = ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0]
|
||||
|
||||
for extruder_stack in self.getActiveExtruderStacks():
|
||||
result.append(extruder_stack.getProperty(setting_key, prop))
|
||||
|
||||
return result
|
||||
|
||||
def extruderValueWithDefault(self, value):
|
||||
def extruderValueWithDefault(self, value: str) -> str:
|
||||
machine_manager = self._application.getMachineManager()
|
||||
if value == "-1":
|
||||
return machine_manager.defaultExtruderPosition
|
||||
|
@ -321,7 +288,7 @@ class ExtruderManager(QObject):
|
|||
## Removes the container stack and user profile for the extruders for a specific machine.
|
||||
#
|
||||
# \param machine_id The machine to remove the extruders for.
|
||||
def removeMachineExtruders(self, machine_id: str):
|
||||
def removeMachineExtruders(self, machine_id: str) -> None:
|
||||
for extruder in self.getMachineExtruders(machine_id):
|
||||
ContainerRegistry.getInstance().removeContainer(extruder.userChanges.getId())
|
||||
ContainerRegistry.getInstance().removeContainer(extruder.getId())
|
||||
|
@ -331,24 +298,11 @@ class ExtruderManager(QObject):
|
|||
## Returns extruders for a specific machine.
|
||||
#
|
||||
# \param machine_id The machine to get the extruders of.
|
||||
def getMachineExtruders(self, machine_id: str):
|
||||
def getMachineExtruders(self, machine_id: str) -> List["ExtruderStack"]:
|
||||
if machine_id not in self._extruder_trains:
|
||||
return []
|
||||
return [self._extruder_trains[machine_id][name] for name in self._extruder_trains[machine_id]]
|
||||
|
||||
## Returns a list containing the global stack and active extruder stacks.
|
||||
#
|
||||
# The first element is the global container stack, followed by any extruder stacks.
|
||||
# \return \type{List[ContainerStack]}
|
||||
def getActiveGlobalAndExtruderStacks(self) -> Optional[List[Union["ExtruderStack", "GlobalStack"]]]:
|
||||
global_stack = self._application.getGlobalContainerStack()
|
||||
if not global_stack:
|
||||
return None
|
||||
|
||||
result = [global_stack]
|
||||
result.extend(self.getActiveExtruderStacks())
|
||||
return result
|
||||
|
||||
## Returns the list of active extruder stacks, taking into account the machine extruder count.
|
||||
#
|
||||
# \return \type{List[ContainerStack]} a list of
|
||||
|
@ -357,10 +311,7 @@ class ExtruderManager(QObject):
|
|||
if not global_stack:
|
||||
return []
|
||||
|
||||
result = []
|
||||
if global_stack.getId() in self._extruder_trains:
|
||||
for extruder in sorted(self._extruder_trains[global_stack.getId()]):
|
||||
result.append(self._extruder_trains[global_stack.getId()][extruder])
|
||||
result = list(global_stack.extruders.values())
|
||||
|
||||
machine_extruder_count = global_stack.getProperty("machine_extruder_count", "value")
|
||||
|
||||
|
@ -406,7 +357,7 @@ class ExtruderManager(QObject):
|
|||
|
||||
# After 3.4, all single-extrusion machines have their own extruder definition files instead of reusing
|
||||
# "fdmextruder". We need to check a machine here so its extruder definition is correct according to this.
|
||||
def _fixSingleExtrusionMachineExtruderDefinition(self, global_stack):
|
||||
def _fixSingleExtrusionMachineExtruderDefinition(self, global_stack: "GlobalStack") -> None:
|
||||
expected_extruder_definition_0_id = global_stack.getMetaDataEntry("machine_extruder_trains")["0"]
|
||||
extruder_stack_0 = global_stack.extruders["0"]
|
||||
if extruder_stack_0.definition.getId() != expected_extruder_definition_0_id:
|
||||
|
@ -425,11 +376,11 @@ class ExtruderManager(QObject):
|
|||
# \return A list of values for all extruders. If an extruder does not have a value, it will not be in the list.
|
||||
# If no extruder has the value, the list will contain the global value.
|
||||
@staticmethod
|
||||
def getExtruderValues(key):
|
||||
def getExtruderValues(key: str) -> List[Any]:
|
||||
global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
|
||||
|
||||
result = []
|
||||
for extruder in ExtruderManager.getInstance().getMachineExtruders(global_stack.getId()):
|
||||
for extruder in ExtruderManager.getInstance().getActiveExtruderStacks():
|
||||
if not extruder.isEnabled:
|
||||
continue
|
||||
# only include values from extruders that are "active" for the current machine instance
|
||||
|
@ -460,7 +411,7 @@ class ExtruderManager(QObject):
|
|||
# \return A list of values for all extruders. If an extruder does not have a value, it will not be in the list.
|
||||
# If no extruder has the value, the list will contain the global value.
|
||||
@staticmethod
|
||||
def getDefaultExtruderValues(key):
|
||||
def getDefaultExtruderValues(key: str) -> List[Any]:
|
||||
global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
|
||||
context = PropertyEvaluationContext(global_stack)
|
||||
context.context["evaluate_from_container_index"] = 1 # skip the user settings container
|
||||
|
@ -471,7 +422,7 @@ class ExtruderManager(QObject):
|
|||
}
|
||||
|
||||
result = []
|
||||
for extruder in ExtruderManager.getInstance().getMachineExtruders(global_stack.getId()):
|
||||
for extruder in ExtruderManager.getInstance().getActiveExtruderStacks():
|
||||
# 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", context = context):
|
||||
continue
|
||||
|
@ -504,7 +455,7 @@ class ExtruderManager(QObject):
|
|||
#
|
||||
# \return String representing the extruder values
|
||||
@pyqtSlot(str, result="QVariant")
|
||||
def getInstanceExtruderValues(self, key):
|
||||
def getInstanceExtruderValues(self, key) -> List:
|
||||
return ExtruderManager.getExtruderValues(key)
|
||||
|
||||
## Get the value for a setting from a specific extruder.
|
||||
|
@ -517,7 +468,7 @@ class ExtruderManager(QObject):
|
|||
# \return The value of the setting for the specified extruder or for the
|
||||
# global stack if not found.
|
||||
@staticmethod
|
||||
def getExtruderValue(extruder_index, key):
|
||||
def getExtruderValue(extruder_index: int, key: str) -> Any:
|
||||
if extruder_index == -1:
|
||||
extruder_index = int(cura.CuraApplication.CuraApplication.getInstance().getMachineManager().defaultExtruderPosition)
|
||||
extruder = ExtruderManager.getInstance().getExtruderStack(extruder_index)
|
||||
|
@ -542,7 +493,7 @@ class ExtruderManager(QObject):
|
|||
# \return The value of the setting for the specified extruder or for the
|
||||
# global stack if not found.
|
||||
@staticmethod
|
||||
def getDefaultExtruderValue(extruder_index, key):
|
||||
def getDefaultExtruderValue(extruder_index: int, key: str) -> Any:
|
||||
extruder = ExtruderManager.getInstance().getExtruderStack(extruder_index)
|
||||
context = PropertyEvaluationContext(extruder)
|
||||
context.context["evaluate_from_container_index"] = 1 # skip the user settings container
|
||||
|
@ -569,7 +520,7 @@ class ExtruderManager(QObject):
|
|||
#
|
||||
# \return The effective value
|
||||
@staticmethod
|
||||
def getResolveOrValue(key):
|
||||
def getResolveOrValue(key: str) -> Any:
|
||||
global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
|
||||
resolved_value = global_stack.getProperty(key, "value")
|
||||
|
||||
|
@ -583,7 +534,7 @@ class ExtruderManager(QObject):
|
|||
#
|
||||
# \return The effective value
|
||||
@staticmethod
|
||||
def getDefaultResolveOrValue(key):
|
||||
def getDefaultResolveOrValue(key: str) -> Any:
|
||||
global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
|
||||
context = PropertyEvaluationContext(global_stack)
|
||||
context.context["evaluate_from_container_index"] = 1 # skip the user settings container
|
||||
|
|
|
@ -134,7 +134,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|||
# Link to new extruders
|
||||
self._active_machine_extruders = []
|
||||
extruder_manager = Application.getInstance().getExtruderManager()
|
||||
for extruder in extruder_manager.getExtruderStacks():
|
||||
for extruder in extruder_manager.getActiveExtruderStacks():
|
||||
if extruder is None: #This extruder wasn't loaded yet. This happens asynchronously while this model is constructed from QML.
|
||||
continue
|
||||
extruder.containersChanged.connect(self._onExtruderStackContainersChanged)
|
||||
|
@ -171,7 +171,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|||
# get machine extruder count for verification
|
||||
machine_extruder_count = global_container_stack.getProperty("machine_extruder_count", "value")
|
||||
|
||||
for extruder in Application.getInstance().getExtruderManager().getMachineExtruders(global_container_stack.getId()):
|
||||
for extruder in Application.getInstance().getExtruderManager().getActiveExtruderStacks():
|
||||
position = extruder.getMetaDataEntry("position", default = "0") # Get the position
|
||||
try:
|
||||
position = int(position)
|
||||
|
|
|
@ -385,7 +385,9 @@ class MachineManager(QObject):
|
|||
# \param definition_id \type{str} definition id that needs to look for
|
||||
# \param metadata_filter \type{dict} list of metadata keys and values used for filtering
|
||||
@staticmethod
|
||||
def getMachine(definition_id: str, metadata_filter: Dict[str, str] = None) -> Optional["GlobalStack"]:
|
||||
def getMachine(definition_id: str, metadata_filter: Optional[Dict[str, str]] = None) -> Optional["GlobalStack"]:
|
||||
if metadata_filter is None:
|
||||
metadata_filter = {}
|
||||
machines = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
|
||||
for machine in machines:
|
||||
if machine.definition.getId() == definition_id:
|
||||
|
@ -412,7 +414,7 @@ class MachineManager(QObject):
|
|||
|
||||
# Not a very pretty solution, but the extruder manager doesn't really know how many extruders there are
|
||||
machine_extruder_count = self._global_container_stack.getProperty("machine_extruder_count", "value")
|
||||
extruder_stacks = ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())
|
||||
extruder_stacks = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||
count = 1 # we start with the global stack
|
||||
for stack in extruder_stacks:
|
||||
md = stack.getMetaData()
|
||||
|
@ -435,7 +437,7 @@ class MachineManager(QObject):
|
|||
if self._global_container_stack.getTop().findInstances():
|
||||
return True
|
||||
|
||||
stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
|
||||
stacks = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||
for stack in stacks:
|
||||
if stack.getTop().findInstances():
|
||||
return True
|
||||
|
@ -448,7 +450,7 @@ class MachineManager(QObject):
|
|||
return 0
|
||||
num_user_settings = 0
|
||||
num_user_settings += len(self._global_container_stack.getTop().findInstances())
|
||||
stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
|
||||
stacks = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||
for stack in stacks:
|
||||
num_user_settings += len(stack.getTop().findInstances())
|
||||
return num_user_settings
|
||||
|
@ -473,7 +475,7 @@ class MachineManager(QObject):
|
|||
stack = ExtruderManager.getInstance().getActiveExtruderStack()
|
||||
stacks = [stack]
|
||||
else:
|
||||
stacks = ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())
|
||||
stacks = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||
|
||||
for stack in stacks:
|
||||
if stack is not None:
|
||||
|
@ -638,7 +640,7 @@ class MachineManager(QObject):
|
|||
if self._active_container_stack is None or self._global_container_stack is None:
|
||||
return
|
||||
new_value = self._active_container_stack.getProperty(key, "value")
|
||||
extruder_stacks = [stack for stack in ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())]
|
||||
extruder_stacks = [stack for stack in ExtruderManager.getInstance().getActiveExtruderStacks()]
|
||||
|
||||
# check in which stack the value has to be replaced
|
||||
for extruder_stack in extruder_stacks:
|
||||
|
|
|
@ -43,7 +43,9 @@ class UserChangesModel(ListModel):
|
|||
global_stack = Application.getInstance().getGlobalContainerStack()
|
||||
if not global_stack:
|
||||
return
|
||||
stacks = ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks()
|
||||
|
||||
stacks = [global_stack]
|
||||
stacks.extend(global_stack.extruders.values())
|
||||
|
||||
# Check if the definition container has a translation file and ensure it's loaded.
|
||||
definition = global_stack.getBottom()
|
||||
|
|
|
@ -343,7 +343,7 @@ class CuraEngineBackend(QObject, Backend):
|
|||
if not self._global_container_stack:
|
||||
Logger.log("w", "Global container stack not assigned to CuraEngineBackend!")
|
||||
return
|
||||
extruders = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
|
||||
extruders = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||
error_keys = [] #type: List[str]
|
||||
for extruder in extruders:
|
||||
error_keys.extend(extruder.getErrorKeys())
|
||||
|
|
|
@ -178,7 +178,7 @@ class ProcessSlicedLayersJob(Job):
|
|||
# Find out colors per extruder
|
||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||
manager = ExtruderManager.getInstance()
|
||||
extruders = list(manager.getMachineExtruders(global_container_stack.getId()))
|
||||
extruders = manager.getActiveExtruderStacks()
|
||||
if extruders:
|
||||
material_color_map = numpy.zeros((len(extruders), 4), dtype=numpy.float32)
|
||||
for extruder in extruders:
|
||||
|
|
|
@ -333,7 +333,7 @@ class StartSliceJob(Job):
|
|||
"-1": self._buildReplacementTokens(global_stack)
|
||||
}
|
||||
|
||||
for extruder_stack in ExtruderManager.getInstance().getMachineExtruders(global_stack.getId()):
|
||||
for extruder_stack in ExtruderManager.getInstance().getActiveExtruderStacks():
|
||||
extruder_nr = extruder_stack.getProperty("extruder_nr", "value")
|
||||
self._all_extruders_settings[str(extruder_nr)] = self._buildReplacementTokens(extruder_stack)
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ class FlavorParser:
|
|||
## For showing correct x, y offsets for each extruder
|
||||
def _extruderOffsets(self) -> Dict[int, List[float]]:
|
||||
result = {}
|
||||
for extruder in ExtruderManager.getInstance().getExtruderStacks():
|
||||
for extruder in ExtruderManager.getInstance().getActiveExtruderStacks():
|
||||
result[int(extruder.getMetaData().get("position", "0"))] = [
|
||||
extruder.getProperty("machine_nozzle_offset_x", "value"),
|
||||
extruder.getProperty("machine_nozzle_offset_y", "value")]
|
||||
|
|
|
@ -16,6 +16,8 @@ Cura.MachineAction
|
|||
property var extrudersModel: Cura.ExtrudersModel{}
|
||||
property int extruderTabsCount: 0
|
||||
|
||||
property var activeMachineId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.id : ""
|
||||
|
||||
Connections
|
||||
{
|
||||
target: base.extrudersModel
|
||||
|
@ -511,7 +513,7 @@ Cura.MachineAction
|
|||
}
|
||||
return "";
|
||||
}
|
||||
return Cura.MachineManager.activeMachineId;
|
||||
return base.activeMachineId
|
||||
}
|
||||
key: settingKey
|
||||
watchedProperties: [ "value", "description" ]
|
||||
|
@ -564,7 +566,7 @@ Cura.MachineAction
|
|||
}
|
||||
return "";
|
||||
}
|
||||
return Cura.MachineManager.activeMachineId;
|
||||
return base.activeMachineId
|
||||
}
|
||||
key: settingKey
|
||||
watchedProperties: [ "value", "description" ]
|
||||
|
@ -655,7 +657,7 @@ Cura.MachineAction
|
|||
}
|
||||
return "";
|
||||
}
|
||||
return Cura.MachineManager.activeMachineId;
|
||||
return base.activeMachineId
|
||||
}
|
||||
key: settingKey
|
||||
watchedProperties: [ "value", "options", "description" ]
|
||||
|
@ -754,7 +756,7 @@ Cura.MachineAction
|
|||
}
|
||||
return "";
|
||||
}
|
||||
return Cura.MachineManager.activeMachineId;
|
||||
return base.activeMachineId
|
||||
}
|
||||
key: settingKey
|
||||
watchedProperties: [ "value", "description" ]
|
||||
|
@ -879,7 +881,7 @@ Cura.MachineAction
|
|||
{
|
||||
id: machineExtruderCountProvider
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: base.activeMachineId
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value", "description" ]
|
||||
storeIndex: manager.containerIndex
|
||||
|
@ -889,7 +891,7 @@ Cura.MachineAction
|
|||
{
|
||||
id: machineHeadPolygonProvider
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: base.acthiveMachineId
|
||||
key: "machine_head_with_fans_polygon"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: manager.containerIndex
|
||||
|
|
|
@ -17,7 +17,6 @@ Item {
|
|||
|
||||
width: childrenRect.width;
|
||||
height: childrenRect.height;
|
||||
|
||||
property var all_categories_except_support: [ "machine_settings", "resolution", "shell", "infill", "material", "speed",
|
||||
"travel", "cooling", "platform_adhesion", "dual", "meshfix", "blackmagic", "experimental"]
|
||||
|
||||
|
@ -45,7 +44,7 @@ Item {
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: meshTypePropertyProvider
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
watchedProperties: [ "enabled" ]
|
||||
}
|
||||
|
||||
|
@ -518,7 +517,7 @@ Item {
|
|||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
@ -528,7 +527,7 @@ Item {
|
|||
{
|
||||
id: printSequencePropertyProvider
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "print_sequence"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
|
@ -384,7 +384,7 @@ UM.Dialog
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: inheritStackProvider
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: model.key ? model.key : "None"
|
||||
watchedProperties: [ "limit_to_extruder" ]
|
||||
}
|
||||
|
|
|
@ -76,7 +76,6 @@ class PackagesModel(ListModel):
|
|||
if "author_id" not in package["author"] or "display_name" not in package["author"]:
|
||||
package["author"]["author_id"] = ""
|
||||
package["author"]["display_name"] = ""
|
||||
# raise Exception("Detected a package with malformed author data.")
|
||||
|
||||
items.append({
|
||||
"id": package["package_id"],
|
||||
|
|
|
@ -24,7 +24,7 @@ class DiscoverUM3Action(MachineAction):
|
|||
|
||||
def __init__(self) -> None:
|
||||
super().__init__("DiscoverUM3Action", catalog.i18nc("@action","Connect via Network"))
|
||||
self._qml_url = "../resources/qml/DiscoverUM3Action.qml"
|
||||
self._qml_url = "resources/qml/DiscoverUM3Action.qml"
|
||||
|
||||
self._network_plugin = None #type: Optional[UM3OutputDevicePlugin]
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ UM.MainWindow
|
|||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
@ -1054,7 +1054,7 @@ UM.MainWindow
|
|||
{
|
||||
restart();
|
||||
}
|
||||
else if(Cura.MachineManager.activeMachineId == null || Cura.MachineManager.activeMachineId == "")
|
||||
else if(Cura.MachineManager.activeMachine == null)
|
||||
{
|
||||
addMachineDialog.open();
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ Menu
|
|||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ Rectangle
|
|||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
@ -191,7 +191,7 @@ Rectangle
|
|||
{
|
||||
id: machineHeatedBed
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_heated_bed"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
|
@ -595,7 +595,7 @@ Rectangle
|
|||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
@ -605,7 +605,7 @@ Rectangle
|
|||
{
|
||||
id: machineHeatedBed
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_heated_bed"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
|
@ -78,18 +78,18 @@ Column
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: bedTemperature
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "material_bed_temperature"
|
||||
watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
|
||||
storeIndex: 0
|
||||
|
||||
property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None"
|
||||
property var resolve: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine ? properties.resolve : "None"
|
||||
}
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: machineExtruderCount
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: ["value"]
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ Item
|
|||
watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
|
||||
storeIndex: 0
|
||||
|
||||
property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None"
|
||||
property var resolve: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine ? properties.resolve : "None"
|
||||
}
|
||||
|
||||
Rectangle
|
||||
|
|
|
@ -139,7 +139,7 @@ Item {
|
|||
{
|
||||
id: linkedSettingIcon;
|
||||
|
||||
visible: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId && (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon
|
||||
visible: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine && (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon
|
||||
|
||||
height: parent.height;
|
||||
width: height;
|
||||
|
|
|
@ -607,7 +607,7 @@ Column
|
|||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
|
@ -20,7 +20,6 @@ Item
|
|||
property variant minimumPrintTime: PrintInformation.minimumPrintTime;
|
||||
property variant maximumPrintTime: PrintInformation.maximumPrintTime;
|
||||
property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1
|
||||
|
||||
Component.onCompleted: PrintInformation.enabled = true
|
||||
Component.onDestruction: PrintInformation.enabled = false
|
||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||
|
@ -1116,7 +1115,7 @@ Item
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: platformAdhesionType
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "adhesion_type"
|
||||
watchedProperties: [ "value", "enabled" ]
|
||||
storeIndex: 0
|
||||
|
@ -1125,7 +1124,7 @@ Item
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: supportEnabled
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "support_enable"
|
||||
watchedProperties: [ "value", "enabled", "description" ]
|
||||
storeIndex: 0
|
||||
|
@ -1134,7 +1133,7 @@ Item
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: extrudersEnabledCount
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "extruders_enabled_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
@ -1143,7 +1142,7 @@ Item
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: supportExtruderNr
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "support_extruder_nr"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue