mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-03 20:13:56 -06:00
Merge remote-tracking branch 'origin/4.0'
This commit is contained in:
commit
c73747ad44
5 changed files with 64 additions and 25 deletions
|
@ -107,17 +107,19 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|||
# that signal. Application.globalContainerStackChanged doesn't fill this
|
||||
# signal; it's assumed to be the current printer in that case.
|
||||
def _extrudersChanged(self, machine_id = None):
|
||||
machine_manager = Application.getInstance().getMachineManager()
|
||||
if machine_id is not None:
|
||||
if Application.getInstance().getGlobalContainerStack() is None:
|
||||
if machine_manager.activeMachine is None:
|
||||
# No machine, don't need to update the current machine's extruders
|
||||
return
|
||||
if machine_id != Application.getInstance().getGlobalContainerStack().getId():
|
||||
if machine_id != machine_manager.activeMachine.getId():
|
||||
# Not the current machine
|
||||
return
|
||||
|
||||
# Unlink from old extruders
|
||||
for extruder in self._active_machine_extruders:
|
||||
extruder.containersChanged.disconnect(self._onExtruderStackContainersChanged)
|
||||
extruder.enabledChanged.disconnect(self._updateExtruders)
|
||||
|
||||
# Link to new extruders
|
||||
self._active_machine_extruders = []
|
||||
|
@ -126,6 +128,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|||
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)
|
||||
extruder.enabledChanged.connect(self._updateExtruders)
|
||||
self._active_machine_extruders.append(extruder)
|
||||
|
||||
self._updateExtruders() # Since the new extruders may have different properties, update our own model.
|
||||
|
|
|
@ -115,10 +115,6 @@ class MachineManager(QObject):
|
|||
|
||||
self._application.callLater(self.setInitialActiveMachine)
|
||||
|
||||
self._material_incompatible_message = Message(catalog.i18nc("@info:status",
|
||||
"The selected material is incompatible with the selected machine or configuration."),
|
||||
title = catalog.i18nc("@info:title", "Incompatible Material")) # type: Message
|
||||
|
||||
containers = CuraContainerRegistry.getInstance().findInstanceContainers(id = self.activeMaterialId) # type: List[InstanceContainer]
|
||||
if containers:
|
||||
containers[0].nameChanged.connect(self._onMaterialNameChanged)
|
||||
|
@ -1362,25 +1358,56 @@ class MachineManager(QObject):
|
|||
self.blurSettings.emit()
|
||||
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
||||
self.switchPrinterType(configuration.printerType)
|
||||
|
||||
used_extruder_stack_list = ExtruderManager.getInstance().getUsedExtruderStacks()
|
||||
disabled_used_extruder_position_set = set()
|
||||
extruders_to_disable = set()
|
||||
|
||||
# If an extruder that's currently used to print a model gets disabled due to the syncing, we need to show
|
||||
# a message explaining why.
|
||||
need_to_show_message = False
|
||||
|
||||
for extruder_configuration in configuration.extruderConfigurations:
|
||||
extruder_has_hotend = extruder_configuration.hotendID != ""
|
||||
extruder_has_material = extruder_configuration.material.guid != ""
|
||||
|
||||
# If the machine doesn't have a hotend or material, disable this extruder
|
||||
if not extruder_has_hotend or not extruder_has_material:
|
||||
extruders_to_disable.add(extruder_configuration.position)
|
||||
|
||||
# If there's no material and/or nozzle on the printer, enable the first extruder and disable the rest.
|
||||
if len(extruders_to_disable) == len(self._global_container_stack.extruders):
|
||||
extruders_to_disable.remove(min(extruders_to_disable))
|
||||
|
||||
for extruder_configuration in configuration.extruderConfigurations:
|
||||
position = str(extruder_configuration.position)
|
||||
variant_container_node = self._variant_manager.getVariantNode(self._global_container_stack.definition.getId(), extruder_configuration.hotendID)
|
||||
material_container_node = self._material_manager.getMaterialNodeByType(self._global_container_stack,
|
||||
position,
|
||||
extruder_configuration.hotendID,
|
||||
configuration.buildplateConfiguration,
|
||||
extruder_configuration.material.guid)
|
||||
|
||||
if variant_container_node:
|
||||
self._setVariantNode(position, variant_container_node)
|
||||
else:
|
||||
self._global_container_stack.extruders[position].variant = empty_variant_container
|
||||
# If the machine doesn't have a hotend or material, disable this extruder
|
||||
if int(position) in extruders_to_disable:
|
||||
self._global_container_stack.extruders[position].setEnabled(False)
|
||||
|
||||
need_to_show_message = True
|
||||
disabled_used_extruder_position_set.add(int(position))
|
||||
|
||||
if material_container_node:
|
||||
self._setMaterial(position, material_container_node)
|
||||
else:
|
||||
self._global_container_stack.extruders[position].material = empty_material_container
|
||||
self.updateMaterialWithVariant(position)
|
||||
variant_container_node = self._variant_manager.getVariantNode(self._global_container_stack.definition.getId(),
|
||||
extruder_configuration.hotendID)
|
||||
material_container_node = self._material_manager.getMaterialNodeByType(self._global_container_stack,
|
||||
position,
|
||||
extruder_configuration.hotendID,
|
||||
configuration.buildplateConfiguration,
|
||||
extruder_configuration.material.guid)
|
||||
if variant_container_node:
|
||||
self._setVariantNode(position, variant_container_node)
|
||||
else:
|
||||
self._global_container_stack.extruders[position].variant = empty_variant_container
|
||||
|
||||
if material_container_node:
|
||||
self._setMaterial(position, material_container_node)
|
||||
else:
|
||||
self._global_container_stack.extruders[position].material = empty_material_container
|
||||
self._global_container_stack.extruders[position].setEnabled(True)
|
||||
self.updateMaterialWithVariant(position)
|
||||
|
||||
if configuration.buildplateConfiguration is not None:
|
||||
global_variant_container_node = self._variant_manager.getBuildplateVariantNode(self._global_container_stack.definition.getId(), configuration.buildplateConfiguration)
|
||||
|
@ -1392,6 +1419,14 @@ class MachineManager(QObject):
|
|||
self._global_container_stack.variant = empty_variant_container
|
||||
self._updateQualityWithMaterial()
|
||||
|
||||
if need_to_show_message:
|
||||
msg_str = "Extruder {extruders} is disabled because there is no material loaded. Please load a material or use custom configurations."
|
||||
extruders_str = ", ".join(str(x) for x in sorted(disabled_used_extruder_position_set))
|
||||
msg_str = msg_str.format(extruders = extruders_str)
|
||||
message = Message(catalog.i18nc("@info:status", msg_str),
|
||||
title = catalog.i18nc("@info:title", "Extruder(s) Disabled"))
|
||||
message.show()
|
||||
|
||||
# See if we need to show the Discard or Keep changes screen
|
||||
if self.hasUserSettings and self._application.getPreferences().getValue("cura/active_mode") == 1:
|
||||
self._application.discardOrKeepProfileChanges()
|
||||
|
|
|
@ -57,7 +57,7 @@ class FirmwareUpdaterMachineAction(MachineAction):
|
|||
outputDeviceCanUpdateFirmwareChanged = pyqtSignal()
|
||||
@pyqtProperty(QObject, notify = outputDeviceCanUpdateFirmwareChanged)
|
||||
def firmwareUpdater(self) -> Optional["FirmwareUpdater"]:
|
||||
if self._active_output_device and self._active_output_device.activePrinter and self._active_output_device.activePrinter.getController().can_update_firmware:
|
||||
if self._active_output_device and self._active_output_device.activePrinter and self._active_output_device.activePrinter.getController() is not None and self._active_output_device.activePrinter.getController().can_update_firmware:
|
||||
self._active_firmware_updater = self._active_output_device.getFirmwareUpdater()
|
||||
return self._active_firmware_updater
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ class CloudOutputDeviceManager:
|
|||
stored_cluster_id = active_machine.getMetaDataEntry(self.META_CLUSTER_ID)
|
||||
if stored_cluster_id in self._remote_clusters:
|
||||
device = self._remote_clusters[stored_cluster_id]
|
||||
self._connectToOutputDevice(device)
|
||||
self._connectToOutputDevice(device, active_machine)
|
||||
Logger.log("d", "Device connected by metadata cluster ID %s", stored_cluster_id)
|
||||
else:
|
||||
self._connectByNetworkKey(active_machine)
|
||||
|
@ -129,12 +129,13 @@ class CloudOutputDeviceManager:
|
|||
|
||||
Logger.log("i", "Found cluster %s with network key %s", device, local_network_key)
|
||||
active_machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key)
|
||||
self._connectToOutputDevice(device)
|
||||
self._connectToOutputDevice(device, active_machine)
|
||||
|
||||
## Connects to an output device and makes sure it is registered in the output device manager.
|
||||
def _connectToOutputDevice(self, device: CloudOutputDevice) -> None:
|
||||
def _connectToOutputDevice(self, device: CloudOutputDevice, active_machine: GlobalStack) -> None:
|
||||
device.connect()
|
||||
self._output_device_manager.addOutputDevice(device)
|
||||
active_machine.addConfiguredConnectionType(device.connectionType.value)
|
||||
|
||||
## Handles an API error received from the cloud.
|
||||
# \param errors: The errors received
|
||||
|
|
|
@ -39,7 +39,7 @@ Column
|
|||
height: UM.Theme.getSize("account_button").height
|
||||
text: catalog.i18nc("@button", "Ultimaker account")
|
||||
onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl)
|
||||
fixedWidthMode: true
|
||||
fixedWidthMode: false
|
||||
}
|
||||
|
||||
Label
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue