mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-07-04 10:35:10 +08:00
Merge branch '2.3'
This commit is contained in:
commit
85fc680994
@ -303,7 +303,7 @@ class BuildVolume(SceneNode):
|
||||
machine_depth = self._global_container_stack.getProperty("machine_depth", "value")
|
||||
|
||||
# Add prime tower location as disallowed area.
|
||||
if self._global_container_stack.getProperty("prime_tower_enable", "value"):
|
||||
if self._global_container_stack.getProperty("prime_tower_enable", "value") == True:
|
||||
prime_tower_size = self._global_container_stack.getProperty("prime_tower_size", "value")
|
||||
prime_tower_x = self._global_container_stack.getProperty("prime_tower_position_x", "value") - machine_width / 2
|
||||
prime_tower_y = - self._global_container_stack.getProperty("prime_tower_position_y", "value") + machine_depth / 2
|
||||
|
@ -423,8 +423,8 @@ class ContainerManager(QObject):
|
||||
# stack and clear the user settings.
|
||||
#
|
||||
# \return \type{bool} True if the operation was successfully, False if not.
|
||||
@pyqtSlot(result = bool)
|
||||
def createQualityChanges(self):
|
||||
@pyqtSlot(str, result = bool)
|
||||
def createQualityChanges(self, base_name):
|
||||
global_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||
if not global_stack:
|
||||
return False
|
||||
@ -436,7 +436,9 @@ class ContainerManager(QObject):
|
||||
|
||||
self._machine_manager.blurSettings.emit()
|
||||
|
||||
unique_name = self._container_registry.uniqueName(active_quality_name)
|
||||
if base_name is None:
|
||||
base_name = active_quality_name
|
||||
unique_name = self._container_registry.uniqueName(base_name)
|
||||
|
||||
# Go through the active stacks and create quality_changes containers from the user containers.
|
||||
for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks():
|
||||
@ -540,8 +542,8 @@ class ContainerManager(QObject):
|
||||
# \param quality_name The name of the quality to duplicate.
|
||||
#
|
||||
# \return A string containing the name of the duplicated containers, or an empty string if it failed.
|
||||
@pyqtSlot(str, result = str)
|
||||
def duplicateQualityOrQualityChanges(self, quality_name):
|
||||
@pyqtSlot(str, str, result = str)
|
||||
def duplicateQualityOrQualityChanges(self, quality_name, base_name):
|
||||
global_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||
if not global_stack or not quality_name:
|
||||
return ""
|
||||
@ -551,7 +553,10 @@ class ContainerManager(QObject):
|
||||
UM.Logger.log("d", "Unable to duplicate the quality %s, because it doesn't exist.", quality_name)
|
||||
return ""
|
||||
|
||||
new_name = self._container_registry.uniqueName(quality_name)
|
||||
if base_name is None:
|
||||
base_name = quality_name
|
||||
|
||||
new_name = self._container_registry.uniqueName(base_name)
|
||||
|
||||
container_type = containers[0].getMetaDataEntry("type")
|
||||
if container_type == "quality":
|
||||
|
@ -838,6 +838,9 @@ class MachineManager(QObject):
|
||||
# that are assigned to the parents of this material profile.
|
||||
try:
|
||||
inherited_files = material_container.getInheritedFiles()
|
||||
except AttributeError: # Material_container does not support inheritance.
|
||||
inherited_files = []
|
||||
|
||||
if inherited_files:
|
||||
for inherited_file in inherited_files:
|
||||
# Extract the ID from the path we used to load the file.
|
||||
@ -845,8 +848,6 @@ class MachineManager(QObject):
|
||||
containers = container_registry.findInstanceContainers(**search_criteria)
|
||||
if containers:
|
||||
return containers[0]
|
||||
except AttributeError: # Material_container does not support inheritance.
|
||||
pass
|
||||
|
||||
# We still weren't able to find a quality for this specific material.
|
||||
# Try to find qualities for a generic version of the material.
|
||||
|
@ -182,7 +182,6 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
||||
# If a setting is settable per extruder (not global) and we're looking at global tab, don't show this value.
|
||||
if self._extruder_id == "" and settable_per_extruder:
|
||||
continue
|
||||
|
||||
items.append({
|
||||
"key": definition.key,
|
||||
"label": definition.label,
|
||||
|
@ -86,7 +86,7 @@ class LayerView(View):
|
||||
|
||||
if not self._ghost_shader:
|
||||
self._ghost_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "color.shader"))
|
||||
self._ghost_shader.setUniformValue("u_color", Color(0, 0, 0, 72))
|
||||
self._ghost_shader.setUniformValue("u_color", Color(0, 0, 0, 64))
|
||||
|
||||
for node in DepthFirstIterator(scene.getRoot()):
|
||||
# We do not want to render ConvexHullNode as it conflicts with the bottom layers.
|
||||
@ -98,10 +98,10 @@ class LayerView(View):
|
||||
if node.getMeshData() and node.isVisible():
|
||||
renderer.queueNode(node,
|
||||
shader = self._ghost_shader,
|
||||
state_setup_callback = lambda gl: gl.glDepthMask(gl.GL_FALSE),
|
||||
state_teardown_callback = lambda gl: gl.glDepthMask(gl.GL_TRUE)
|
||||
)
|
||||
type = RenderBatch.RenderType.Transparent )
|
||||
|
||||
for node in DepthFirstIterator(scene.getRoot()):
|
||||
if type(node) is SceneNode:
|
||||
if node.getMeshData() and node.isVisible():
|
||||
layer_data = node.callDecoration("getLayerData")
|
||||
if not layer_data:
|
||||
|
@ -463,7 +463,7 @@ UM.MainWindow
|
||||
target: Cura.Actions.addProfile
|
||||
onTriggered:
|
||||
{
|
||||
Cura.ContainerManager.createQualityChanges();
|
||||
Cura.ContainerManager.createQualityChanges(null);
|
||||
preferences.setPage(4);
|
||||
preferences.show();
|
||||
|
||||
|
@ -129,6 +129,7 @@ UM.ManagementPage
|
||||
enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId
|
||||
onClicked: Cura.MachineManager.setActiveMaterial(base.currentItem.id)
|
||||
},
|
||||
/* // apparently visible does not work on OS X
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Duplicate");
|
||||
@ -151,7 +152,9 @@ UM.ManagementPage
|
||||
|
||||
Cura.MachineManager.setActiveMaterial(material_id)
|
||||
}
|
||||
visible: false;
|
||||
},
|
||||
*/
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Remove");
|
||||
@ -159,12 +162,15 @@ UM.ManagementPage
|
||||
enabled: base.currentItem != null && !base.currentItem.readOnly && !Cura.ContainerManager.isContainerUsed(base.currentItem.id)
|
||||
onClicked: confirmDialog.open()
|
||||
},
|
||||
/* // apparently visible does not work on OS X
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Import");
|
||||
iconName: "document-import";
|
||||
onClicked: importDialog.open();
|
||||
visible: false;
|
||||
},
|
||||
*/
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Export")
|
||||
|
@ -61,6 +61,10 @@ UM.ManagementPage
|
||||
return -1;
|
||||
}
|
||||
|
||||
function canCreateProfile() {
|
||||
return base.currentItem && (base.currentItem.id == Cura.MachineManager.activeQualityId) && Cura.MachineManager.hasUserSettings;
|
||||
}
|
||||
|
||||
buttons: [
|
||||
Button
|
||||
{
|
||||
@ -69,26 +73,39 @@ UM.ManagementPage
|
||||
enabled: base.currentItem != null ? base.currentItem.id != Cura.MachineManager.activeQualityId : false;
|
||||
onClicked: Cura.MachineManager.setActiveQuality(base.currentItem.id)
|
||||
},
|
||||
|
||||
// Create button
|
||||
Button
|
||||
{
|
||||
text: base.currentItem && (base.currentItem.id == Cura.MachineManager.activeQualityId) && Cura.MachineManager.hasUserSettings ? catalog.i18nc("@label", "Create") : catalog.i18nc("@label", "Duplicate")
|
||||
text: catalog.i18nc("@label", "Create")
|
||||
enabled: base.canCreateProfile()
|
||||
visible: base.canCreateProfile()
|
||||
iconName: "list-add";
|
||||
|
||||
onClicked:
|
||||
{
|
||||
var selectedContainer;
|
||||
if (base.currentItem.id == Cura.MachineManager.activeQualityId && Cura.MachineManager.hasUserSettings) {
|
||||
selectedContainer = Cura.ContainerManager.createQualityChanges();
|
||||
} else {
|
||||
selectedContainer = Cura.ContainerManager.duplicateQualityOrQualityChanges(base.currentItem.name);
|
||||
}
|
||||
base.selectContainer(selectedContainer);
|
||||
|
||||
renameDialog.removeWhenRejected = true;
|
||||
renameDialog.open();
|
||||
renameDialog.selectText();
|
||||
newNameDialog.object = base.currentItem != null ? base.currentItem.name : "";
|
||||
newNameDialog.open();
|
||||
newNameDialog.selectText();
|
||||
}
|
||||
},
|
||||
|
||||
// Duplicate button
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@label", "Duplicate")
|
||||
enabled: ! base.canCreateProfile()
|
||||
visible: ! base.canCreateProfile()
|
||||
iconName: "list-add";
|
||||
|
||||
onClicked:
|
||||
{
|
||||
newDuplicateNameDialog.object = base.currentItem.name;
|
||||
newDuplicateNameDialog.open();
|
||||
newDuplicateNameDialog.selectText();
|
||||
}
|
||||
},
|
||||
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Remove");
|
||||
@ -103,7 +120,6 @@ UM.ManagementPage
|
||||
enabled: base.currentItem != null ? !base.currentItem.readOnly : false;
|
||||
onClicked:
|
||||
{
|
||||
renameDialog.removeWhenRejected = false;
|
||||
renameDialog.open();
|
||||
renameDialog.selectText();
|
||||
}
|
||||
@ -212,7 +228,7 @@ UM.ManagementPage
|
||||
{
|
||||
title: catalog.i18nc("@title:tab", "Global Settings");
|
||||
quality: base.currentItem != null ? base.currentItem.id : "";
|
||||
material: Cura.MachineManager.allActiveMaterialIds.global ? Cura.MachineManager.allActiveMaterialIds.global : ""
|
||||
material: Cura.MachineManager.allActiveMaterialIds[Cura.MachineManager.activeMachineId]
|
||||
}
|
||||
|
||||
Repeater
|
||||
@ -249,24 +265,44 @@ UM.ManagementPage
|
||||
objectList.currentIndex = -1 //Reset selection.
|
||||
}
|
||||
}
|
||||
|
||||
UM.RenameDialog
|
||||
{
|
||||
id: renameDialog;
|
||||
object: base.currentItem != null ? base.currentItem.name : ""
|
||||
property bool removeWhenRejected: false
|
||||
onAccepted:
|
||||
{
|
||||
Cura.ContainerManager.renameQualityChanges(base.currentItem.name, newName)
|
||||
objectList.currentIndex = -1 //Reset selection.
|
||||
}
|
||||
onRejected:
|
||||
}
|
||||
|
||||
// Dialog to request a name when creating a new profile
|
||||
UM.RenameDialog
|
||||
{
|
||||
if(removeWhenRejected)
|
||||
id: newNameDialog;
|
||||
object: "<new name>";
|
||||
onAccepted:
|
||||
{
|
||||
Cura.ContainerManager.removeQualityChanges(base.currentItem.name)
|
||||
var selectedContainer = Cura.ContainerManager.createQualityChanges(newName);
|
||||
base.selectContainer(selectedContainer);
|
||||
objectList.currentIndex = -1 //Reset selection.
|
||||
}
|
||||
}
|
||||
|
||||
// Dialog to request a name when duplicating a new profile
|
||||
UM.RenameDialog
|
||||
{
|
||||
id: newDuplicateNameDialog;
|
||||
object: "<new name>";
|
||||
onAccepted:
|
||||
{
|
||||
var selectedContainer = Cura.ContainerManager.duplicateQualityOrQualityChanges(base.currentItem.name, newName);
|
||||
base.selectContainer(selectedContainer);
|
||||
objectList.currentIndex = -1 //Reset selection.
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: messageDialog
|
||||
|
@ -246,8 +246,8 @@ Item {
|
||||
// This ensures that the value in any of the deeper containers need not be removed, which is
|
||||
// needed for the reset button (which deletes the top value) to correctly go back to profile
|
||||
// defaults.
|
||||
propertyProvider.setPropertyValue("state", "InstanceState.Calculated")
|
||||
propertyProvider.setPropertyValue("value", propertyProvider.getPropertyValue("value", last_entry))
|
||||
propertyProvider.setPropertyValue("state", "InstanceState.Calculated")
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user