Merge branch '3.0' of github.com:Ultimaker/Cura

This commit is contained in:
Jaime van Kessel 2017-09-29 15:22:23 +02:00
commit 9f8691feef
18 changed files with 170 additions and 140 deletions

View file

@ -21,7 +21,7 @@ class CuraStackBuilder:
# #
# \return The new global stack or None if an error occurred. # \return The new global stack or None if an error occurred.
@classmethod @classmethod
def createMachine(cls, name: str, definition_id: str, default_name: str) -> Optional[GlobalStack]: def createMachine(cls, name: str, definition_id: str) -> Optional[GlobalStack]:
registry = ContainerRegistry.getInstance() registry = ContainerRegistry.getInstance()
definitions = registry.findDefinitionContainers(id = definition_id) definitions = registry.findDefinitionContainers(id = definition_id)
if not definitions: if not definitions:
@ -29,7 +29,7 @@ class CuraStackBuilder:
return None return None
machine_definition = definitions[0] machine_definition = definitions[0]
generated_name = registry.createUniqueName("machine", "", default_name, machine_definition.name) generated_name = registry.createUniqueName("machine", "", machine_definition.name, machine_definition.name)
# Make sure the new name does not collide with any definition or (quality) profile # Make sure the new name does not collide with any definition or (quality) profile
# createUniqueName() only looks at other stacks, but not at definitions or quality profiles # createUniqueName() only looks at other stacks, but not at definitions or quality profiles
# Note that we don't go for uniqueName() immediately because that function matches with ignore_case set to true # Note that we don't go for uniqueName() immediately because that function matches with ignore_case set to true
@ -45,7 +45,7 @@ class CuraStackBuilder:
) )
# after creating a global stack can be set custom defined name # after creating a global stack can be set custom defined name
if(name != generated_name): if name != generated_name:
name = registry.createUniqueName("machine", "", name, machine_definition.name) name = registry.createUniqueName("machine", "", name, machine_definition.name)
if registry.findContainers(id = name): if registry.findContainers(id = name):
name = registry.uniqueName(name) name = registry.uniqueName(name)

View file

@ -41,7 +41,7 @@ class ExtruderManager(QObject):
def __init__(self, parent = None): def __init__(self, parent = None):
super().__init__(parent) super().__init__(parent)
self._extruder_trains = { } #Per machine, a dictionary of extruder container stack IDs. Only for separately defined extruders. self._extruder_trains = { } #Per machine, a dictionary of extruder container stack IDs. Only for separately defined extruders.
self._active_extruder_index = 0 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 = []
Application.getInstance().globalContainerStackChanged.connect(self.__globalContainerStackChanged) Application.getInstance().globalContainerStackChanged.connect(self.__globalContainerStackChanged)
self._global_container_stack_definition_id = None self._global_container_stack_definition_id = None
@ -74,14 +74,18 @@ class ExtruderManager(QObject):
except KeyError: except KeyError:
return 0 return 0
## Gets a dict with the extruder stack ids with the extruder number as the key.
# The key "-1" indicates the global stack id.
#
@pyqtProperty("QVariantMap", notify = extrudersChanged) @pyqtProperty("QVariantMap", notify = extrudersChanged)
def extruderIds(self): def extruderIds(self):
map = {} extruder_stack_ids = {}
global_stack_id = Application.getInstance().getGlobalContainerStack().getId() global_stack_id = Application.getInstance().getGlobalContainerStack().getId()
extruder_stack_ids["-1"] = global_stack_id
if global_stack_id in self._extruder_trains: if global_stack_id in self._extruder_trains:
for position in self._extruder_trains[global_stack_id]: for position in self._extruder_trains[global_stack_id]:
map[position] = self._extruder_trains[global_stack_id][position].getId() extruder_stack_ids[position] = self._extruder_trains[global_stack_id][position].getId()
return map return extruder_stack_ids
@pyqtSlot(str, result = str) @pyqtSlot(str, result = str)
def getQualityChangesIdByExtruderStackId(self, id: str) -> str: def getQualityChangesIdByExtruderStackId(self, id: str) -> str:
@ -513,17 +517,33 @@ class ExtruderManager(QObject):
global_stack = Application.getInstance().getGlobalContainerStack() global_stack = Application.getInstance().getGlobalContainerStack()
result = [] result = []
machine_extruder_count = global_stack.getProperty("machine_extruder_count", "value")
# In case the printer is using one extruder, shouldn't exist active extruder stacks
if machine_extruder_count == 1:
return result
if global_stack and global_stack.getId() in self._extruder_trains: if global_stack and global_stack.getId() in self._extruder_trains:
for extruder in sorted(self._extruder_trains[global_stack.getId()]): for extruder in sorted(self._extruder_trains[global_stack.getId()]):
result.append(self._extruder_trains[global_stack.getId()][extruder]) result.append(self._extruder_trains[global_stack.getId()][extruder])
return result[:global_stack.getProperty("machine_extruder_count", "value")] return result[:machine_extruder_count]
def __globalContainerStackChanged(self) -> None: def __globalContainerStackChanged(self) -> None:
global_container_stack = Application.getInstance().getGlobalContainerStack() global_container_stack = Application.getInstance().getGlobalContainerStack()
if global_container_stack and global_container_stack.getBottom() and global_container_stack.getBottom().getId() != self._global_container_stack_definition_id: if global_container_stack and global_container_stack.getBottom() and global_container_stack.getBottom().getId() != self._global_container_stack_definition_id:
self._global_container_stack_definition_id = global_container_stack.getBottom().getId() self._global_container_stack_definition_id = global_container_stack.getBottom().getId()
self.globalContainerStackDefinitionChanged.emit() self.globalContainerStackDefinitionChanged.emit()
# If the global container changed, the number of extruders could be changed and so the active_extruder_index is updated
extruder_count = global_container_stack.getProperty("machine_extruder_count", "value")
if extruder_count > 1:
if self._active_extruder_index == -1:
self.setActiveExtruderIndex(0)
else:
if self._active_extruder_index != -1:
self.setActiveExtruderIndex(-1)
self.activeExtruderChanged.emit() self.activeExtruderChanged.emit()
self.resetSelectedObjectExtruders() self.resetSelectedObjectExtruders()

View file

@ -271,7 +271,6 @@ class MachineManager(QObject):
extruder_stack.containersChanged.disconnect(self._onInstanceContainersChanged) extruder_stack.containersChanged.disconnect(self._onInstanceContainersChanged)
self._global_container_stack = Application.getInstance().getGlobalContainerStack() self._global_container_stack = Application.getInstance().getGlobalContainerStack()
self._active_container_stack = self._global_container_stack
self.globalContainerChanged.emit() self.globalContainerChanged.emit()
@ -303,6 +302,9 @@ class MachineManager(QObject):
quality = self._global_container_stack.quality quality = self._global_container_stack.quality
quality.nameChanged.connect(self._onQualityNameChanged) quality.nameChanged.connect(self._onQualityNameChanged)
self._active_container_stack = self._global_container_stack
self._error_check_timer.start() self._error_check_timer.start()
## Update self._stacks_valid according to _checkStacksForErrors and emit if change. ## Update self._stacks_valid according to _checkStacksForErrors and emit if change.
@ -352,9 +354,9 @@ class MachineManager(QObject):
if containers: if containers:
Application.getInstance().setGlobalContainerStack(containers[0]) Application.getInstance().setGlobalContainerStack(containers[0])
@pyqtSlot(str, str, str) @pyqtSlot(str, str)
def addMachine(self, name: str, definition_id: str, default_name: str) -> None: def addMachine(self, name: str, definition_id: str) -> None:
new_stack = CuraStackBuilder.createMachine(name, definition_id, default_name) new_stack = CuraStackBuilder.createMachine(name, definition_id)
if new_stack: if new_stack:
Application.getInstance().setGlobalContainerStack(new_stack) Application.getInstance().setGlobalContainerStack(new_stack)
else: else:
@ -543,16 +545,22 @@ class MachineManager(QObject):
return result return result
## Gets a dict with the active materials ids set in all extruder stacks and the global stack
# (when there is one extruder, the material is set in the global stack)
#
# \return The material ids in all stacks
@pyqtProperty("QVariantMap", notify = activeMaterialChanged) @pyqtProperty("QVariantMap", notify = activeMaterialChanged)
def allActiveMaterialIds(self) -> Dict[str, str]: def allActiveMaterialIds(self) -> Dict[str, str]:
result = {} result = {}
active_stacks = ExtruderManager.getInstance().getActiveExtruderStacks() active_stacks = ExtruderManager.getInstance().getActiveExtruderStacks()
if active_stacks is not None: #If we have a global stack.
result[self._global_container_stack.getId()] = self._global_container_stack.material.getId()
if active_stacks is not None: # If we have extruder stacks
for stack in active_stacks: for stack in active_stacks:
material_container = stack.material material_container = stack.material
if not material_container: if not material_container:
continue continue
result[stack.getId()] = material_container.getId() result[stack.getId()] = material_container.getId()
return result return result

View file

@ -98,16 +98,10 @@ class ProfilesModel(InstanceContainersModel):
extruder_manager = ExtruderManager.getInstance() extruder_manager = ExtruderManager.getInstance()
active_extruder = extruder_manager.getActiveExtruderStack() active_extruder = extruder_manager.getActiveExtruderStack()
extruder_stacks = extruder_manager.getActiveExtruderStacks() extruder_stacks = extruder_manager.getActiveExtruderStacks()
if extruder_stacks: if multiple_extrusion:
if multiple_extrusion: # Place the active extruder at the front of the list.
# Place the active extruder at the front of the list. extruder_stacks.remove(active_extruder)
if active_extruder in extruder_stacks: extruder_stacks = [active_extruder] + extruder_stacks
extruder_stacks.remove(active_extruder)
extruder_stacks = [active_extruder] + extruder_stacks
else:
# The active extruder is the first in the list and only the active extruder is use to compute the usable qualities
active_extruder = None
extruder_stacks = []
# Get a list of usable/available qualities for this machine and material # Get a list of usable/available qualities for this machine and material
qualities = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack, qualities = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack,

View file

@ -31,16 +31,10 @@ class QualityAndUserProfilesModel(ProfilesModel):
extruder_manager = ExtruderManager.getInstance() extruder_manager = ExtruderManager.getInstance()
active_extruder = extruder_manager.getActiveExtruderStack() active_extruder = extruder_manager.getActiveExtruderStack()
extruder_stacks = extruder_manager.getActiveExtruderStacks() extruder_stacks = extruder_manager.getActiveExtruderStacks()
if extruder_stacks: if multiple_extrusion:
if multiple_extrusion: # Place the active extruder at the front of the list.
# Place the active extruder at the front of the list. extruder_stacks.remove(active_extruder)
if active_extruder in extruder_stacks: extruder_stacks = [active_extruder] + extruder_stacks
extruder_stacks.remove(active_extruder)
extruder_stacks = [active_extruder] + extruder_stacks
else:
# The active extruder is the first in the list and only the active extruder is use to compute the usable qualities
active_extruder = None
extruder_stacks = []
# Fetch the list of useable qualities across all extruders. # Fetch the list of useable qualities across all extruders.
# The actual list of quality profiles come from the first extruder in the extruder list. # The actual list of quality profiles come from the first extruder in the extruder list.
@ -52,9 +46,13 @@ class QualityAndUserProfilesModel(ProfilesModel):
if multiple_extrusion: if multiple_extrusion:
# If the printer has multiple extruders then quality changes related to the current extruder are kept # If the printer has multiple extruders then quality changes related to the current extruder are kept
filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and qc.getMetaDataEntry("extruder") == active_extruder.definition.getId()] filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and
qc.getMetaDataEntry("extruder") is not None and
qc.getMetaDataEntry("extruder") == active_extruder.definition.getMetaDataEntry("quality_definition") or
qc.getMetaDataEntry("extruder") == active_extruder.definition.getId()]
else: else:
# If not, the quality changes of the global stack are selected # If not, the quality changes of the global stack are selected
filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and qc.getMetaDataEntry("extruder") is None] filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and
qc.getMetaDataEntry("extruder") is None]
return quality_list + filtered_quality_changes return quality_list + filtered_quality_changes

View file

@ -31,16 +31,10 @@ class UserProfilesModel(ProfilesModel):
extruder_manager = ExtruderManager.getInstance() extruder_manager = ExtruderManager.getInstance()
active_extruder = extruder_manager.getActiveExtruderStack() active_extruder = extruder_manager.getActiveExtruderStack()
extruder_stacks = extruder_manager.getActiveExtruderStacks() extruder_stacks = extruder_manager.getActiveExtruderStacks()
if extruder_stacks: if multiple_extrusion:
if multiple_extrusion: # Place the active extruder at the front of the list.
# Place the active extruder at the front of the list. extruder_stacks.remove(active_extruder)
if active_extruder in extruder_stacks: extruder_stacks = [active_extruder] + extruder_stacks
extruder_stacks.remove(active_extruder)
extruder_stacks = [active_extruder] + extruder_stacks
else:
# The active extruder is the first in the list and only the active extruder is use to compute the usable qualities
active_extruder = None
extruder_stacks = []
# Fetch the list of useable qualities across all extruders. # Fetch the list of useable qualities across all extruders.
# The actual list of quality profiles come from the first extruder in the extruder list. # The actual list of quality profiles come from the first extruder in the extruder list.
@ -52,9 +46,13 @@ class UserProfilesModel(ProfilesModel):
if multiple_extrusion: if multiple_extrusion:
# If the printer has multiple extruders then quality changes related to the current extruder are kept # If the printer has multiple extruders then quality changes related to the current extruder are kept
filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and qc.getMetaDataEntry("extruder") == active_extruder.definition.getId()] filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and
qc.getMetaDataEntry("extruder") is not None and
qc.getMetaDataEntry("extruder") == active_extruder.definition.getMetaDataEntry("quality_definition") or
qc.getMetaDataEntry("extruder") == active_extruder.definition.getId()]
else: else:
# If not, the quality changes of the global stack are selected # If not, the quality changes of the global stack are selected
filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and qc.getMetaDataEntry("extruder") is None] filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and
qc.getMetaDataEntry("extruder") is None]
return filtered_quality_changes return filtered_quality_changes

View file

@ -693,54 +693,53 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
# -- # --
# load extruder stack files # load extruder stack files
if extruder_count_from_global_stack > 1: try:
try: for extruder_stack_file in extruder_stack_files:
for extruder_stack_file in extruder_stack_files: container_id = self._stripFileToId(extruder_stack_file)
container_id = self._stripFileToId(extruder_stack_file) extruder_file_content = archive.open(extruder_stack_file, "r").read().decode("utf-8")
extruder_file_content = archive.open(extruder_stack_file, "r").read().decode("utf-8")
if self._resolve_strategies["machine"] == "override": if self._resolve_strategies["machine"] == "override":
# deserialize new extruder stack over the current ones # deserialize new extruder stack over the current ones
stack = self._overrideExtruderStack(global_stack, extruder_file_content) stack = self._overrideExtruderStack(global_stack, extruder_file_content)
elif self._resolve_strategies["machine"] == "new": elif self._resolve_strategies["machine"] == "new":
new_id = extruder_stack_id_map[container_id] new_id = extruder_stack_id_map[container_id]
stack = ExtruderStack(new_id) stack = ExtruderStack(new_id)
# HACK: the global stack can have a new name, so we need to make sure that this extruder stack # 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 # 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() # 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 # also does addExtruder() to its machine stack, so we have to make sure that it's pointing
# to the right machine BEFORE deserialization. # to the right machine BEFORE deserialization.
extruder_config = configparser.ConfigParser() extruder_config = configparser.ConfigParser()
extruder_config.read_string(extruder_file_content) extruder_config.read_string(extruder_file_content)
extruder_config.set("metadata", "machine", global_stack_id_new) extruder_config.set("metadata", "machine", global_stack_id_new)
tmp_string_io = io.StringIO() tmp_string_io = io.StringIO()
extruder_config.write(tmp_string_io) extruder_config.write(tmp_string_io)
extruder_file_content = tmp_string_io.getvalue() extruder_file_content = tmp_string_io.getvalue()
stack.deserialize(extruder_file_content) stack.deserialize(extruder_file_content)
# Ensure a unique ID and name # Ensure a unique ID and name
stack._id = new_id stack._id = new_id
self._container_registry.addContainer(stack) self._container_registry.addContainer(stack)
extruder_stacks_added.append(stack) extruder_stacks_added.append(stack)
containers_added.append(stack) containers_added.append(stack)
else: else:
Logger.log("w", "Unknown resolve strategy: %s", self._resolve_strategies["machine"]) Logger.log("w", "Unknown resolve strategy: %s", self._resolve_strategies["machine"])
# Create a new definition_changes container if it was empty # Create a new definition_changes container if it was empty
if stack.definitionChanges == self._container_registry.getEmptyInstanceContainer(): if stack.definitionChanges == self._container_registry.getEmptyInstanceContainer():
stack.setDefinitionChanges(CuraStackBuilder.createDefinitionChangesContainer(stack, stack._id + "_settings")) stack.setDefinitionChanges(CuraStackBuilder.createDefinitionChangesContainer(stack, stack._id + "_settings"))
extruder_stacks.append(stack) extruder_stacks.append(stack)
except: except:
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.") 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. # Something went really wrong. Try to remove any data that we added.
for container in containers_added: for container in containers_added:
self._container_registry.removeContainer(container.getId()) self._container_registry.removeContainer(container.getId())
return return
# #
# Replacing the old containers if resolve is "new". # Replacing the old containers if resolve is "new".

View file

@ -112,13 +112,7 @@ class MachineSettingsAction(MachineAction):
if not self._global_container_stack: if not self._global_container_stack:
return 0 return 0
# If there is a printer that originally is multi-extruder, it's not allowed to change the number of extruders return len(self._global_container_stack.getMetaDataEntry("machine_extruder_trains"))
# 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
@pyqtSlot(int) @pyqtSlot(int)
def setMachineExtruderCount(self, extruder_count): def setMachineExtruderCount(self, extruder_count):
@ -176,7 +170,6 @@ class MachineSettingsAction(MachineAction):
node.callDecoration("setActiveExtruder", extruder_manager.getExtruderStack(extruder_count - 1).getId()) node.callDecoration("setActiveExtruder", extruder_manager.getExtruderStack(extruder_count - 1).getId())
definition_changes_container.setProperty("machine_extruder_count", "value", extruder_count) definition_changes_container.setProperty("machine_extruder_count", "value", extruder_count)
self.forceUpdate()
if extruder_count > 1: if extruder_count > 1:
# Multiextrusion # Multiextrusion
@ -221,6 +214,8 @@ class MachineSettingsAction(MachineAction):
preferences.setValue("cura/choice_on_profile_override", choice_on_profile_override) preferences.setValue("cura/choice_on_profile_override", choice_on_profile_override)
self.forceUpdate()
@pyqtSlot() @pyqtSlot()
def forceUpdate(self): def forceUpdate(self):

View file

@ -97,8 +97,8 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
self._cluster_status_update_timer.setSingleShot(False) self._cluster_status_update_timer.setSingleShot(False)
self._cluster_status_update_timer.timeout.connect(self._requestClusterStatus) self._cluster_status_update_timer.timeout.connect(self._requestClusterStatus)
self._can_pause = False self._can_pause = True
self._can_abort = False self._can_abort = True
self._can_pre_heat_bed = False self._can_pre_heat_bed = False
self._cluster_size = int(properties.get(b"cluster_size", 0)) self._cluster_size = int(properties.get(b"cluster_size", 0))
@ -155,6 +155,22 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
super().close() super().close()
self._cluster_status_update_timer.stop() 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): def _requestClusterStatus(self):
# TODO: Handle timeout. We probably want to know if the cluster is still reachable or not. # TODO: Handle timeout. We probably want to know if the cluster is still reachable or not.
url = QUrl(self._api_base_uri + "print_jobs/") url = QUrl(self._api_base_uri + "print_jobs/")

View file

@ -234,33 +234,36 @@ Rectangle
if(printJob != null) if(printJob != null)
{ {
if(printJob.status == "printing" || printJob.status == "post_print") switch (printJob.status)
{ {
return catalog.i18nc("@label:status", "Printing") case "printing":
} case "post_print":
else if(printJob.status == "wait_for_configuration") return catalog.i18nc("@label:status", "Printing")
{ case "wait_for_configuration":
return catalog.i18nc("@label:status", "Reserved") return catalog.i18nc("@label:status", "Reserved")
} case "wait_cleanup":
else if(printJob.status == "wait_cleanup") return catalog.i18nc("@label:status", "Finished")
{ case "pre_print":
return catalog.i18nc("@label:status", "Finished") case "sent_to_printer":
} return catalog.i18nc("@label", "Preparing to print")
else if (printJob.status == "pre_print" || printJob.status == "sent_to_printer") case "queued":
{ if (printJob.configuration_changes_required != null && printJob.configuration_changes_required.length !== 0)
return catalog.i18nc("@label", "Preparing to print") {
} return catalog.i18nc("@label:status", "Action required");
else if (printJob.configuration_changes_required != undefined && printJob.status == "queued") }
{ else
return catalog.i18nc("@label:status", "Action required") {
} return "";
else if (printJob.Status == "aborted") }
{ case "pausing":
return catalog.i18nc("@label:status", "Print aborted") case "paused":
} return catalog.i18nc("@label:status", "Paused");
else case "resuming":
{ return catalog.i18nc("@label:status", "Resuming");
return ""; case "aborted":
return catalog.i18nc("@label:status", "Print aborted");
default:
return "";
} }
} }
return catalog.i18nc("@label:status", "Available"); return catalog.i18nc("@label:status", "Available");

View file

@ -5,7 +5,8 @@
"inherits": "fdmextruder", "inherits": "fdmextruder",
"metadata": { "metadata": {
"machine": "ultimaker3_extended", "machine": "ultimaker3_extended",
"position": "0" "position": "0",
"quality_definition": "ultimaker3_extruder_left"
}, },
"overrides": { "overrides": {

View file

@ -5,7 +5,8 @@
"inherits": "fdmextruder", "inherits": "fdmextruder",
"metadata": { "metadata": {
"machine": "ultimaker3_extended", "machine": "ultimaker3_extended",
"position": "1" "position": "1",
"quality_definition": "ultimaker3_extruder_right"
}, },
"overrides": { "overrides": {

View file

@ -5,7 +5,8 @@
"inherits": "fdmextruder", "inherits": "fdmextruder",
"metadata": { "metadata": {
"machine": "ultimaker3", "machine": "ultimaker3",
"position": "0" "position": "0",
"quality_definition": "ultimaker3_extruder_left"
}, },
"overrides": { "overrides": {

View file

@ -5,7 +5,8 @@
"inherits": "fdmextruder", "inherits": "fdmextruder",
"metadata": { "metadata": {
"machine": "ultimaker3", "machine": "ultimaker3",
"position": "1" "position": "1",
"quality_definition": "ultimaker3_extruder_right"
}, },
"overrides": { "overrides": {

View file

@ -217,8 +217,7 @@ UM.Dialog
{ {
base.visible = false base.visible = false
var item = machineList.model.getItem(machineList.currentIndex); var item = machineList.model.getItem(machineList.currentIndex);
var defaultName = (item != undefined) ? item.name : "" Cura.MachineManager.addMachine(machineName.text, item.id)
Cura.MachineManager.addMachine(machineName.text, item.id, defaultName)
base.machineAdded(item.id) // Emit signal that the user added a machine. base.machineAdded(item.id) // Emit signal that the user added a machine.
} }

View file

@ -39,11 +39,8 @@ Menu
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].materialNames.length > extruderIndex visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].materialNames.length > extruderIndex
onTriggered: onTriggered:
{ {
var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
ExtruderManager.setActiveExtruderIndex(extruderIndex);
var materialId = Cura.MachineManager.printerOutputDevices[0].materialIds[extruderIndex]; var materialId = Cura.MachineManager.printerOutputDevices[0].materialIds[extruderIndex];
var items = materialsModel.items; var items = materialsModel.items;
// materialsModel.find cannot be used because we need to look inside the metadata property of items
for(var i in items) for(var i in items)
{ {
if (items[i]["metadata"]["GUID"] == materialId) if (items[i]["metadata"]["GUID"] == materialId)
@ -52,7 +49,6 @@ Menu
break; break;
} }
} }
ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
} }
} }
@ -72,6 +68,8 @@ Menu
exclusiveGroup: group exclusiveGroup: group
onTriggered: onTriggered:
{ {
// 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.
var activeExtruderIndex = ExtruderManager.activeExtruderIndex; var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
ExtruderManager.setActiveExtruderIndex(extruderIndex); ExtruderManager.setActiveExtruderIndex(extruderIndex);
Cura.MachineManager.setActiveMaterial(model.id); Cura.MachineManager.setActiveMaterial(model.id);
@ -113,6 +111,8 @@ Menu
exclusiveGroup: group exclusiveGroup: group
onTriggered: onTriggered:
{ {
// 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.
var activeExtruderIndex = ExtruderManager.activeExtruderIndex; var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
ExtruderManager.setActiveExtruderIndex(extruderIndex); ExtruderManager.setActiveExtruderIndex(extruderIndex);
Cura.MachineManager.setActiveMaterial(model.id); Cura.MachineManager.setActiveMaterial(model.id);

View file

@ -91,12 +91,7 @@ Column
Connections Connections
{ {
target: Cura.MachineManager target: Cura.MachineManager
onGlobalContainerChanged: onGlobalContainerChanged: 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.
var extruder_index = (machineExtruderCount.properties.value == 1) ? -1 : 0
ExtruderManager.setActiveExtruderIndex(extruder_index);
}
} }
delegate: Button delegate: Button

View file

@ -66,6 +66,7 @@ Item
{ {
target: Cura.MachineManager target: Cura.MachineManager
onActiveQualityChanged: qualityModel.update() onActiveQualityChanged: qualityModel.update()
onActiveMaterialChanged: qualityModel.update()
} }
ListModel ListModel