mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 05:37:50 -06:00
Merge branch '3.0' of github.com:Ultimaker/Cura
This commit is contained in:
commit
9f8691feef
18 changed files with 170 additions and 140 deletions
|
@ -693,54 +693,53 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
|
||||
# --
|
||||
# load extruder stack files
|
||||
if extruder_count_from_global_stack > 1:
|
||||
try:
|
||||
for extruder_stack_file in extruder_stack_files:
|
||||
container_id = self._stripFileToId(extruder_stack_file)
|
||||
extruder_file_content = archive.open(extruder_stack_file, "r").read().decode("utf-8")
|
||||
try:
|
||||
for extruder_stack_file in extruder_stack_files:
|
||||
container_id = self._stripFileToId(extruder_stack_file)
|
||||
extruder_file_content = archive.open(extruder_stack_file, "r").read().decode("utf-8")
|
||||
|
||||
if self._resolve_strategies["machine"] == "override":
|
||||
# deserialize new extruder stack over the current ones
|
||||
stack = self._overrideExtruderStack(global_stack, extruder_file_content)
|
||||
if self._resolve_strategies["machine"] == "override":
|
||||
# deserialize new extruder stack over the current ones
|
||||
stack = self._overrideExtruderStack(global_stack, extruder_file_content)
|
||||
|
||||
elif self._resolve_strategies["machine"] == "new":
|
||||
new_id = extruder_stack_id_map[container_id]
|
||||
stack = ExtruderStack(new_id)
|
||||
elif self._resolve_strategies["machine"] == "new":
|
||||
new_id = extruder_stack_id_map[container_id]
|
||||
stack = ExtruderStack(new_id)
|
||||
|
||||
# HACK: the global stack can have a new name, so we need to make sure that this extruder stack
|
||||
# references to the new name instead of the old one. Normally, this can be done after
|
||||
# deserialize() by setting the metadata, but in the case of ExtruderStack, deserialize()
|
||||
# also does addExtruder() to its machine stack, so we have to make sure that it's pointing
|
||||
# to the right machine BEFORE deserialization.
|
||||
extruder_config = configparser.ConfigParser()
|
||||
extruder_config.read_string(extruder_file_content)
|
||||
extruder_config.set("metadata", "machine", global_stack_id_new)
|
||||
tmp_string_io = io.StringIO()
|
||||
extruder_config.write(tmp_string_io)
|
||||
extruder_file_content = tmp_string_io.getvalue()
|
||||
# HACK: the global stack can have a new name, so we need to make sure that this extruder stack
|
||||
# references to the new name instead of the old one. Normally, this can be done after
|
||||
# deserialize() by setting the metadata, but in the case of ExtruderStack, deserialize()
|
||||
# also does addExtruder() to its machine stack, so we have to make sure that it's pointing
|
||||
# to the right machine BEFORE deserialization.
|
||||
extruder_config = configparser.ConfigParser()
|
||||
extruder_config.read_string(extruder_file_content)
|
||||
extruder_config.set("metadata", "machine", global_stack_id_new)
|
||||
tmp_string_io = io.StringIO()
|
||||
extruder_config.write(tmp_string_io)
|
||||
extruder_file_content = tmp_string_io.getvalue()
|
||||
|
||||
stack.deserialize(extruder_file_content)
|
||||
stack.deserialize(extruder_file_content)
|
||||
|
||||
# Ensure a unique ID and name
|
||||
stack._id = new_id
|
||||
# Ensure a unique ID and name
|
||||
stack._id = new_id
|
||||
|
||||
self._container_registry.addContainer(stack)
|
||||
extruder_stacks_added.append(stack)
|
||||
containers_added.append(stack)
|
||||
else:
|
||||
Logger.log("w", "Unknown resolve strategy: %s", self._resolve_strategies["machine"])
|
||||
self._container_registry.addContainer(stack)
|
||||
extruder_stacks_added.append(stack)
|
||||
containers_added.append(stack)
|
||||
else:
|
||||
Logger.log("w", "Unknown resolve strategy: %s", self._resolve_strategies["machine"])
|
||||
|
||||
# Create a new definition_changes container if it was empty
|
||||
if stack.definitionChanges == self._container_registry.getEmptyInstanceContainer():
|
||||
stack.setDefinitionChanges(CuraStackBuilder.createDefinitionChangesContainer(stack, stack._id + "_settings"))
|
||||
# Create a new definition_changes container if it was empty
|
||||
if stack.definitionChanges == self._container_registry.getEmptyInstanceContainer():
|
||||
stack.setDefinitionChanges(CuraStackBuilder.createDefinitionChangesContainer(stack, stack._id + "_settings"))
|
||||
|
||||
extruder_stacks.append(stack)
|
||||
except:
|
||||
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
||||
# Something went really wrong. Try to remove any data that we added.
|
||||
for container in containers_added:
|
||||
self._container_registry.removeContainer(container.getId())
|
||||
return
|
||||
extruder_stacks.append(stack)
|
||||
except:
|
||||
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
||||
# Something went really wrong. Try to remove any data that we added.
|
||||
for container in containers_added:
|
||||
self._container_registry.removeContainer(container.getId())
|
||||
return
|
||||
|
||||
#
|
||||
# Replacing the old containers if resolve is "new".
|
||||
|
|
|
@ -112,13 +112,7 @@ class MachineSettingsAction(MachineAction):
|
|||
if not self._global_container_stack:
|
||||
return 0
|
||||
|
||||
# If there is a printer that originally is multi-extruder, it's not allowed to change the number of extruders
|
||||
# It's just allowed in case of Custom FDM printers
|
||||
definition_container = self._global_container_stack.getBottom()
|
||||
if definition_container.getId() == "custom":
|
||||
return len(self._global_container_stack.getMetaDataEntry("machine_extruder_trains"))
|
||||
return 0
|
||||
|
||||
return len(self._global_container_stack.getMetaDataEntry("machine_extruder_trains"))
|
||||
|
||||
@pyqtSlot(int)
|
||||
def setMachineExtruderCount(self, extruder_count):
|
||||
|
@ -176,7 +170,6 @@ class MachineSettingsAction(MachineAction):
|
|||
node.callDecoration("setActiveExtruder", extruder_manager.getExtruderStack(extruder_count - 1).getId())
|
||||
|
||||
definition_changes_container.setProperty("machine_extruder_count", "value", extruder_count)
|
||||
self.forceUpdate()
|
||||
|
||||
if extruder_count > 1:
|
||||
# Multiextrusion
|
||||
|
@ -221,6 +214,8 @@ class MachineSettingsAction(MachineAction):
|
|||
|
||||
preferences.setValue("cura/choice_on_profile_override", choice_on_profile_override)
|
||||
|
||||
self.forceUpdate()
|
||||
|
||||
|
||||
@pyqtSlot()
|
||||
def forceUpdate(self):
|
||||
|
|
|
@ -97,8 +97,8 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
|||
self._cluster_status_update_timer.setSingleShot(False)
|
||||
self._cluster_status_update_timer.timeout.connect(self._requestClusterStatus)
|
||||
|
||||
self._can_pause = False
|
||||
self._can_abort = False
|
||||
self._can_pause = True
|
||||
self._can_abort = True
|
||||
self._can_pre_heat_bed = False
|
||||
self._cluster_size = int(properties.get(b"cluster_size", 0))
|
||||
|
||||
|
@ -155,6 +155,22 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
|||
super().close()
|
||||
self._cluster_status_update_timer.stop()
|
||||
|
||||
def _setJobState(self, job_state):
|
||||
if not self._selected_printer:
|
||||
return
|
||||
|
||||
selected_printer_uuid = self._printers_dict[self._selected_printer["unique_name"]]["uuid"]
|
||||
if selected_printer_uuid not in self._print_job_by_printer_uuid:
|
||||
return
|
||||
|
||||
print_job_uuid = self._print_job_by_printer_uuid[selected_printer_uuid]["uuid"]
|
||||
|
||||
url = QUrl(self._api_base_uri + "print_jobs/" + print_job_uuid + "/action")
|
||||
put_request = QNetworkRequest(url)
|
||||
put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json")
|
||||
data = '{"action": "' + job_state + '"}'
|
||||
self._manager.put(put_request, data.encode())
|
||||
|
||||
def _requestClusterStatus(self):
|
||||
# TODO: Handle timeout. We probably want to know if the cluster is still reachable or not.
|
||||
url = QUrl(self._api_base_uri + "print_jobs/")
|
||||
|
|
|
@ -234,33 +234,36 @@ Rectangle
|
|||
|
||||
if(printJob != null)
|
||||
{
|
||||
if(printJob.status == "printing" || printJob.status == "post_print")
|
||||
switch (printJob.status)
|
||||
{
|
||||
return catalog.i18nc("@label:status", "Printing")
|
||||
}
|
||||
else if(printJob.status == "wait_for_configuration")
|
||||
{
|
||||
return catalog.i18nc("@label:status", "Reserved")
|
||||
}
|
||||
else if(printJob.status == "wait_cleanup")
|
||||
{
|
||||
return catalog.i18nc("@label:status", "Finished")
|
||||
}
|
||||
else if (printJob.status == "pre_print" || printJob.status == "sent_to_printer")
|
||||
{
|
||||
return catalog.i18nc("@label", "Preparing to print")
|
||||
}
|
||||
else if (printJob.configuration_changes_required != undefined && printJob.status == "queued")
|
||||
{
|
||||
return catalog.i18nc("@label:status", "Action required")
|
||||
}
|
||||
else if (printJob.Status == "aborted")
|
||||
{
|
||||
return catalog.i18nc("@label:status", "Print aborted")
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
case "printing":
|
||||
case "post_print":
|
||||
return catalog.i18nc("@label:status", "Printing")
|
||||
case "wait_for_configuration":
|
||||
return catalog.i18nc("@label:status", "Reserved")
|
||||
case "wait_cleanup":
|
||||
return catalog.i18nc("@label:status", "Finished")
|
||||
case "pre_print":
|
||||
case "sent_to_printer":
|
||||
return catalog.i18nc("@label", "Preparing to print")
|
||||
case "queued":
|
||||
if (printJob.configuration_changes_required != null && printJob.configuration_changes_required.length !== 0)
|
||||
{
|
||||
return catalog.i18nc("@label:status", "Action required");
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
case "pausing":
|
||||
case "paused":
|
||||
return catalog.i18nc("@label:status", "Paused");
|
||||
case "resuming":
|
||||
return catalog.i18nc("@label:status", "Resuming");
|
||||
case "aborted":
|
||||
return catalog.i18nc("@label:status", "Print aborted");
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return catalog.i18nc("@label:status", "Available");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue