mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 14:46:02 +08:00
Merge branch '3.0'
This commit is contained in:
commit
278d5eba2e
1
.gitignore
vendored
1
.gitignore
vendored
@ -33,6 +33,7 @@ cura.desktop
|
|||||||
.settings
|
.settings
|
||||||
|
|
||||||
#Externally located plug-ins.
|
#Externally located plug-ins.
|
||||||
|
plugins/CuraSolidWorksPlugin
|
||||||
plugins/Doodle3D-cura-plugin
|
plugins/Doodle3D-cura-plugin
|
||||||
plugins/GodMode
|
plugins/GodMode
|
||||||
plugins/PostProcessingPlugin
|
plugins/PostProcessingPlugin
|
||||||
|
@ -60,26 +60,29 @@ 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()
|
||||||
|
materials = [global_container_stack.material]
|
||||||
if active_extruder in extruder_stacks:
|
if active_extruder in extruder_stacks:
|
||||||
extruder_stacks.remove(active_extruder)
|
extruder_stacks.remove(active_extruder)
|
||||||
extruder_stacks = [active_extruder] + extruder_stacks
|
extruder_stacks = [active_extruder] + extruder_stacks
|
||||||
|
|
||||||
if ExtruderManager.getInstance().getActiveExtruderStacks():
|
|
||||||
# Multi-extruder machine detected.
|
|
||||||
materials = [extruder.material for extruder in extruder_stacks]
|
materials = [extruder.material for extruder in extruder_stacks]
|
||||||
else:
|
|
||||||
# Machine with one extruder.
|
|
||||||
materials = [global_container_stack.material]
|
|
||||||
|
|
||||||
# Fetch the list of usable qualities across all extruders.
|
# Fetch the list of usable 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.
|
||||||
result = QualityManager.getInstance().findAllQualitiesForMachineAndMaterials(global_stack_definition,
|
result = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack, extruder_stacks)
|
||||||
materials)
|
|
||||||
|
|
||||||
for quality in QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(
|
# The usable quality types are set
|
||||||
global_container_stack, extruder_stacks):
|
quality_type_set = set([x.getMetaDataEntry("quality_type") for x in result])
|
||||||
if quality not in result:
|
|
||||||
|
# Fetch all qualities available for this machine and the materials selected in extruders
|
||||||
|
all_qualities = QualityManager.getInstance().findAllQualitiesForMachineAndMaterials(global_stack_definition, materials)
|
||||||
|
|
||||||
|
# If in the all qualities there is some of them that are not available due to incompatibility with materials
|
||||||
|
# we also add it so that they will appear in the slide quality bar. However in recomputeItems will be marked as
|
||||||
|
# not available so they will be shown in gray
|
||||||
|
for quality in all_qualities:
|
||||||
|
if quality.getMetaDataEntry("quality_type") not in quality_type_set:
|
||||||
result.append(quality)
|
result.append(quality)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
## Re-computes the items in this model, and adds the layer height role.
|
## Re-computes the items in this model, and adds the layer height role.
|
||||||
@ -96,9 +99,11 @@ class ProfilesModel(InstanceContainersModel):
|
|||||||
if active_extruder in extruder_stacks:
|
if active_extruder in extruder_stacks:
|
||||||
extruder_stacks.remove(active_extruder)
|
extruder_stacks.remove(active_extruder)
|
||||||
extruder_stacks = [active_extruder] + extruder_stacks
|
extruder_stacks = [active_extruder] + extruder_stacks
|
||||||
# Get a list of 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,
|
||||||
extruder_stacks)
|
extruder_stacks)
|
||||||
|
|
||||||
container_registry = ContainerRegistry.getInstance()
|
container_registry = ContainerRegistry.getInstance()
|
||||||
machine_manager = Application.getInstance().getMachineManager()
|
machine_manager = Application.getInstance().getMachineManager()
|
||||||
|
|
||||||
@ -117,7 +122,7 @@ class ProfilesModel(InstanceContainersModel):
|
|||||||
tmp_all_quality_items[quality_type] = {"suitable_container": None, "all_containers": []}
|
tmp_all_quality_items[quality_type] = {"suitable_container": None, "all_containers": []}
|
||||||
|
|
||||||
tmp_all_quality_items[quality_type]["all_containers"].append(item)
|
tmp_all_quality_items[quality_type]["all_containers"].append(item)
|
||||||
if tmp_all_quality_items[quality_type]["suitable_container"] is None and profile[0] in qualities:
|
if tmp_all_quality_items[quality_type]["suitable_container"] is None:
|
||||||
tmp_all_quality_items[quality_type]["suitable_container"] = item
|
tmp_all_quality_items[quality_type]["suitable_container"] = item
|
||||||
|
|
||||||
# reverse the ordering (finest first, coarsest last)
|
# reverse the ordering (finest first, coarsest last)
|
||||||
@ -125,14 +130,24 @@ class ProfilesModel(InstanceContainersModel):
|
|||||||
for key in reversed(tmp_all_quality_items.keys()):
|
for key in reversed(tmp_all_quality_items.keys()):
|
||||||
all_quality_items[key] = tmp_all_quality_items[key]
|
all_quality_items[key] = tmp_all_quality_items[key]
|
||||||
|
|
||||||
|
# First the suitable containers are set in the model
|
||||||
|
containers = []
|
||||||
for data_item in all_quality_items.values():
|
for data_item in all_quality_items.values():
|
||||||
item = data_item["suitable_container"]
|
suitable_item = data_item["suitable_container"]
|
||||||
if item is None:
|
if suitable_item is not None:
|
||||||
item = data_item["all_containers"][0]
|
containers.append(suitable_item)
|
||||||
|
|
||||||
|
# Once the suitable containers are collected, the rest of the containers are appended
|
||||||
|
for data_item in all_quality_items.values():
|
||||||
|
for item in data_item["all_containers"]:
|
||||||
|
if item not in containers:
|
||||||
|
containers.append(item)
|
||||||
|
|
||||||
|
# Now all the containers are set
|
||||||
|
for item in containers:
|
||||||
profile = container_registry.findContainers(id=item["id"])
|
profile = container_registry.findContainers(id=item["id"])
|
||||||
if not profile:
|
if not profile:
|
||||||
item["layer_height"] = "" # Can't update a profile that is unknown.
|
self._setItemLayerHeight(item, "", unit)
|
||||||
item["available"] = False
|
item["available"] = False
|
||||||
yield item
|
yield item
|
||||||
continue
|
continue
|
||||||
|
@ -25,17 +25,30 @@ class UserProfilesModel(ProfilesModel):
|
|||||||
machine_definition = quality_manager.getParentMachineDefinition(global_container_stack.getBottom())
|
machine_definition = quality_manager.getParentMachineDefinition(global_container_stack.getBottom())
|
||||||
quality_changes_list = quality_manager.findAllQualityChangesForMachine(machine_definition)
|
quality_changes_list = quality_manager.findAllQualityChangesForMachine(machine_definition)
|
||||||
|
|
||||||
# Fetch the list of qualities
|
# Detecting if the machine has multiple extrusion
|
||||||
quality_list = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack,
|
multiple_extrusion = False
|
||||||
ExtruderManager.getInstance().getActiveExtruderStacks())
|
# Get the list of extruders and place the selected extruder at the front of the list.
|
||||||
|
extruder_manager = ExtruderManager.getInstance()
|
||||||
|
active_extruder = extruder_manager.getActiveExtruderStack()
|
||||||
|
extruder_stacks = extruder_manager.getActiveExtruderStacks()
|
||||||
|
if active_extruder in extruder_stacks:
|
||||||
|
multiple_extrusion = True
|
||||||
|
extruder_stacks.remove(active_extruder)
|
||||||
|
extruder_stacks = [active_extruder] + extruder_stacks
|
||||||
|
|
||||||
|
# Fetch the list of useable qualities across all extruders.
|
||||||
|
# The actual list of quality profiles come from the first extruder in the extruder list.
|
||||||
|
quality_list = quality_manager.findAllUsableQualitiesForMachineAndExtruders(global_container_stack,
|
||||||
|
extruder_stacks)
|
||||||
|
|
||||||
# Filter the quality_change by the list of available quality_types
|
# Filter the quality_change by the list of available quality_types
|
||||||
quality_type_set = set([x.getMetaDataEntry("quality_type") for x in quality_list])
|
quality_type_set = set([x.getMetaDataEntry("quality_type") for x in quality_list])
|
||||||
|
|
||||||
|
if multiple_extrusion:
|
||||||
|
# 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()]
|
||||||
|
else:
|
||||||
|
# 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]
|
filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set]
|
||||||
|
|
||||||
#Only display the global quality changes.
|
|
||||||
#Otherwise you get multiple copies of every quality changes profile.
|
|
||||||
#The actual profile switching goes by profile name (not ID), and as long as the names are consistent, switching to any of the profiles will cause all stacks to switch.
|
|
||||||
filtered_quality_changes = list(filter(lambda quality_changes: quality_changes.getMetaDataEntry("extruder") is None, filtered_quality_changes))
|
|
||||||
|
|
||||||
return filtered_quality_changes
|
return filtered_quality_changes
|
||||||
|
@ -235,7 +235,7 @@ class WorkspaceDialog(QObject):
|
|||||||
self._result["definition_changes"] = None
|
self._result["definition_changes"] = None
|
||||||
|
|
||||||
# If the machine needs to be re-created, the definition_changes should also be re-created.
|
# If the machine needs to be re-created, the definition_changes should also be re-created.
|
||||||
if self._result["machine"] == "new" and self._result["definition_changes"] is None:
|
if "machine" in self._result and self._result["machine"] == "new" and self._result["definition_changes"] is None:
|
||||||
self._result["definition_changes"] = "new"
|
self._result["definition_changes"] = "new"
|
||||||
|
|
||||||
if "material" in self._result and not self._has_material_conflict:
|
if "material" in self._result and not self._has_material_conflict:
|
||||||
@ -267,7 +267,7 @@ class WorkspaceDialog(QObject):
|
|||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
## Used to notify the dialog so the lock can be released.
|
## Used to notify the dialog so the lock can be released.
|
||||||
def notifyClosed(self):
|
def notifyClosed(self):
|
||||||
self._result = {}
|
self._result = {} # The result should be cleared before hide, because after it is released the main thread lock
|
||||||
self._visible = False
|
self._visible = False
|
||||||
self._lock.release()
|
self._lock.release()
|
||||||
|
|
||||||
@ -283,9 +283,10 @@ class WorkspaceDialog(QObject):
|
|||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def onCancelButtonClicked(self):
|
def onCancelButtonClicked(self):
|
||||||
|
self._result = {}
|
||||||
self._view.hide()
|
self._view.hide()
|
||||||
self.hide()
|
self.hide()
|
||||||
self._result = {}
|
|
||||||
|
|
||||||
## Block thread until the dialog is closed.
|
## Block thread until the dialog is closed.
|
||||||
def waitForClose(self):
|
def waitForClose(self):
|
||||||
|
@ -43,7 +43,7 @@ Menu
|
|||||||
{
|
{
|
||||||
text: model.name + " - " + model.layer_height
|
text: model.name + " - " + model.layer_height
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: Cura.MachineManager.globalQualityId == model.id
|
checked: Cura.MachineManager.activeQualityChangesId == model.id
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
onTriggered: Cura.MachineManager.setActiveQuality(model.id)
|
onTriggered: Cura.MachineManager.setActiveQuality(model.id)
|
||||||
}
|
}
|
||||||
|
@ -138,8 +138,13 @@ Item
|
|||||||
|
|
||||||
function reset () {
|
function reset () {
|
||||||
qualityModel.clear()
|
qualityModel.clear()
|
||||||
qualityModel.totalTicks = Cura.ProfilesModel.rowCount() - 1 // minus one, because slider starts from 0
|
|
||||||
qualityModel.availableTotalTicks = -1
|
qualityModel.availableTotalTicks = -1
|
||||||
|
|
||||||
|
// check, the ticks count cannot be less than zero
|
||||||
|
if(Cura.ProfilesModel.rowCount() != 0)
|
||||||
|
qualityModel.totalTicks = Cura.ProfilesModel.rowCount() - 1 // minus one, because slider starts from 0
|
||||||
|
else
|
||||||
|
qualityModel.totalTicks = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,8 +245,8 @@ Item
|
|||||||
enabled: qualityModel.availableTotalTicks > 0
|
enabled: qualityModel.availableTotalTicks > 0
|
||||||
updateValueWhileDragging : false
|
updateValueWhileDragging : false
|
||||||
|
|
||||||
minimumValue: qualityModel.qualitySliderAvailableMin
|
minimumValue: qualityModel.qualitySliderAvailableMin >= 0 ? qualityModel.qualitySliderAvailableMin : 0
|
||||||
maximumValue: qualityModel.qualitySliderAvailableMax
|
maximumValue: qualityModel.qualitySliderAvailableMax >= 0 ? qualityModel.qualitySliderAvailableMax : 0
|
||||||
stepSize: 1
|
stepSize: 1
|
||||||
|
|
||||||
value: qualityModel.activeQualityId
|
value: qualityModel.activeQualityId
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
[general]
|
||||||
|
version = 2
|
||||||
|
name = Not Supported
|
||||||
|
definition = ultimaker2_plus
|
||||||
|
|
||||||
|
[metadata]
|
||||||
|
weight = 0
|
||||||
|
type = quality
|
||||||
|
quality_type = normal
|
||||||
|
material = generic_tpu_ultimaker2_plus_0.8_mm
|
||||||
|
supported = False
|
||||||
|
setting_version = 3
|
||||||
|
|
||||||
|
[values]
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user