mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 05:53:59 -06:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
b3eb1ca877
7 changed files with 31 additions and 15 deletions
|
@ -173,12 +173,13 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
plugin_registry = PluginRegistry.getInstance()
|
||||
extension = file_name.split(".")[-1]
|
||||
|
||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||
if not global_container_stack:
|
||||
global_stack = Application.getInstance().getGlobalContainerStack()
|
||||
if not global_stack:
|
||||
return
|
||||
|
||||
machine_extruders = list(ExtruderManager.getInstance().getMachineExtruders(global_container_stack.getId()))
|
||||
machine_extruders.sort(key = lambda k: k.getMetaDataEntry("position"))
|
||||
machine_extruders = []
|
||||
for position in sorted(global_stack.extruders):
|
||||
machine_extruders.append(global_stack.extruders[position])
|
||||
|
||||
for plugin_id, meta_data in self._getIOPlugins("profile_reader"):
|
||||
if meta_data["profile_reader"][0]["extension"] != extension:
|
||||
|
@ -200,13 +201,18 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
|
||||
# First check if this profile is suitable for this machine
|
||||
global_profile = None
|
||||
extruder_profiles = []
|
||||
if len(profile_or_list) == 1:
|
||||
global_profile = profile_or_list[0]
|
||||
else:
|
||||
for profile in profile_or_list:
|
||||
if not profile.getMetaDataEntry("position"):
|
||||
global_profile = profile
|
||||
break
|
||||
else:
|
||||
extruder_profiles.append(profile)
|
||||
extruder_profiles = sorted(extruder_profiles, key = lambda x: int(x.getMetaDataEntry("position")))
|
||||
profile_or_list = [global_profile] + extruder_profiles
|
||||
|
||||
if not global_profile:
|
||||
Logger.log("e", "Incorrect profile [%s]. Could not find global profile", file_name)
|
||||
return { "status": "error",
|
||||
|
@ -227,7 +233,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
# Get the expected machine definition.
|
||||
# i.e.: We expect gcode for a UM2 Extended to be defined as normal UM2 gcode...
|
||||
profile_definition = getMachineDefinitionIDForQualitySearch(machine_definition)
|
||||
expected_machine_definition = getMachineDefinitionIDForQualitySearch(global_container_stack.definition)
|
||||
expected_machine_definition = getMachineDefinitionIDForQualitySearch(global_stack.definition)
|
||||
|
||||
# And check if the profile_definition matches either one (showing error if not):
|
||||
if profile_definition != expected_machine_definition:
|
||||
|
@ -251,8 +257,8 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
if len(profile_or_list) == 1:
|
||||
global_profile = profile_or_list[0]
|
||||
extruder_profiles = []
|
||||
for idx, extruder in enumerate(global_container_stack.extruders.values()):
|
||||
profile_id = ContainerRegistry.getInstance().uniqueName(global_container_stack.getId() + "_extruder_" + str(idx + 1))
|
||||
for idx, extruder in enumerate(global_stack.extruders.values()):
|
||||
profile_id = ContainerRegistry.getInstance().uniqueName(global_stack.getId() + "_extruder_" + str(idx + 1))
|
||||
profile = InstanceContainer(profile_id)
|
||||
profile.setName(quality_name)
|
||||
profile.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
|
||||
|
@ -264,12 +270,12 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
if idx == 0:
|
||||
# move all per-extruder settings to the first extruder's quality_changes
|
||||
for qc_setting_key in global_profile.getAllKeys():
|
||||
settable_per_extruder = global_container_stack.getProperty(qc_setting_key,
|
||||
settable_per_extruder = global_stack.getProperty(qc_setting_key,
|
||||
"settable_per_extruder")
|
||||
if settable_per_extruder:
|
||||
setting_value = global_profile.getProperty(qc_setting_key, "value")
|
||||
|
||||
setting_definition = global_container_stack.getSettingDefinition(qc_setting_key)
|
||||
setting_definition = global_stack.getSettingDefinition(qc_setting_key)
|
||||
new_instance = SettingInstance(setting_definition, profile)
|
||||
new_instance.setProperty("value", setting_value)
|
||||
new_instance.resetState() # Ensure that the state is not seen as a user state.
|
||||
|
@ -286,7 +292,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
for profile_index, profile in enumerate(profile_or_list):
|
||||
if profile_index == 0:
|
||||
# This is assumed to be the global profile
|
||||
profile_id = (global_container_stack.getBottom().getId() + "_" + name_seed).lower().replace(" ", "_")
|
||||
profile_id = (global_stack.getBottom().getId() + "_" + name_seed).lower().replace(" ", "_")
|
||||
|
||||
elif profile_index < len(machine_extruders) + 1:
|
||||
# This is assumed to be an extruder profile
|
||||
|
|
|
@ -145,6 +145,7 @@ class MachineManager(QObject):
|
|||
activeStackValueChanged = pyqtSignal() # Emitted whenever a value inside the active stack is changed.
|
||||
activeStackValidationChanged = pyqtSignal() # Emitted whenever a validation inside active container is changed
|
||||
stacksValidationChanged = pyqtSignal() # Emitted whenever a validation is changed
|
||||
numberExtrudersEnabledChanged = pyqtSignal() # Emitted when the number of extruders that are enabled changed
|
||||
|
||||
blurSettings = pyqtSignal() # Emitted to force fields in the advanced sidebar to un-focus, so they update properly
|
||||
|
||||
|
@ -880,7 +881,13 @@ class MachineManager(QObject):
|
|||
for position, extruder in self._global_container_stack.extruders.items():
|
||||
if extruder.isEnabled:
|
||||
extruder_count += 1
|
||||
definition_changes_container.setProperty("extruders_enabled_count", "value", extruder_count)
|
||||
if self.numberExtrudersEnabled != extruder_count:
|
||||
definition_changes_container.setProperty("extruders_enabled_count", "value", extruder_count)
|
||||
self.numberExtrudersEnabledChanged.emit()
|
||||
|
||||
@pyqtProperty(int, notify = numberExtrudersEnabledChanged)
|
||||
def numberExtrudersEnabled(self):
|
||||
return self._global_container_stack.definitionChanges.getProperty("extruders_enabled_count", "value")
|
||||
|
||||
@pyqtProperty(str, notify = extruderChanged)
|
||||
def defaultExtruderPosition(self):
|
||||
|
|
|
@ -110,9 +110,9 @@
|
|||
"material_bed_temperature": { "maximum_value": "115" },
|
||||
"material_bed_temperature_layer_0": { "maximum_value": "115" },
|
||||
"material_standby_temperature": { "value": "100" },
|
||||
"meshfix_maximum_resolution": { "value": "0.04" },
|
||||
"meshfix_maximum_resolution": { "value": "0.04" },
|
||||
"multiple_mesh_overlap": { "value": "0" },
|
||||
"optimize_wall_printing_order": { "value": "True" },
|
||||
"optimize_wall_printing_order": { "value": "True" },
|
||||
"prime_tower_enable": { "default_value": true },
|
||||
"raft_airgap": { "value": "0" },
|
||||
"raft_base_thickness": { "value": "0.3" },
|
||||
|
|
|
@ -217,6 +217,7 @@ UM.MainWindow
|
|||
text: catalog.i18nc("@action:inmenu", "Disable Extruder")
|
||||
onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false)
|
||||
visible: Cura.MachineManager.getExtruder(model.index).isEnabled
|
||||
enabled: Cura.MachineManager.numberExtrudersEnabled > 1
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ Menu
|
|||
MenuItem {
|
||||
text: "%1: %2 - %3".arg(model.name).arg(model.material).arg(model.variant)
|
||||
visible: base.shouldShowExtruders
|
||||
enabled: UM.Selection.hasSelection
|
||||
enabled: UM.Selection.hasSelection && model.enabled
|
||||
checkable: true
|
||||
checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(model.id) != -1
|
||||
onTriggered: CuraActions.setExtruderForSelection(model.id)
|
||||
|
|
|
@ -440,6 +440,7 @@ Item
|
|||
key: model.key ? model.key : ""
|
||||
watchedProperties: [ "value", "enabled", "state", "validationState", "settable_per_extruder", "resolve" ]
|
||||
storeIndex: 0
|
||||
removeUnusedValue: model.resolve == undefined
|
||||
}
|
||||
|
||||
Connections
|
||||
|
|
|
@ -178,6 +178,7 @@ Column
|
|||
text: catalog.i18nc("@action:inmenu", "Disable Extruder")
|
||||
onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false)
|
||||
visible: extruder_enabled
|
||||
enabled: Cura.MachineManager.numberExtrudersEnabled > 1
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue