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

This commit is contained in:
Jaime van Kessel 2016-08-31 09:32:12 +02:00
commit 32b9d20647
6 changed files with 97 additions and 61 deletions

View File

@ -30,7 +30,9 @@ class ContainerManager(QObject):
def __init__(self, parent = None): def __init__(self, parent = None):
super().__init__(parent) super().__init__(parent)
self._registry = UM.Settings.ContainerRegistry.getInstance() self._container_registry = UM.Settings.ContainerRegistry.getInstance()
self._machine_manager = UM.Application.getInstance().getMachineManager()
self._container_name_filters = {} self._container_name_filters = {}
## Create a duplicate of the specified container ## Create a duplicate of the specified container
@ -43,7 +45,7 @@ class ContainerManager(QObject):
# \return The ID of the new container, or an empty string if duplication failed. # \return The ID of the new container, or an empty string if duplication failed.
@pyqtSlot(str, result = str) @pyqtSlot(str, result = str)
def duplicateContainer(self, container_id): def duplicateContainer(self, container_id):
containers = self._registry.findContainers(None, id = container_id) containers = self._container_registry.findContainers(None, id = container_id)
if not containers: if not containers:
UM.Logger.log("w", "Could duplicate container %s because it was not found.", container_id) UM.Logger.log("w", "Could duplicate container %s because it was not found.", container_id)
return "" return ""
@ -51,7 +53,7 @@ class ContainerManager(QObject):
container = containers[0] container = containers[0]
new_container = None new_container = None
new_name = self._registry.uniqueName(container.getName()) new_name = self._container_registry.uniqueName(container.getName())
# Only InstanceContainer has a duplicate method at the moment. # Only InstanceContainer has a duplicate method at the moment.
# So fall back to serialize/deserialize when no duplicate method exists. # So fall back to serialize/deserialize when no duplicate method exists.
if hasattr(container, "duplicate"): if hasattr(container, "duplicate"):
@ -62,7 +64,7 @@ class ContainerManager(QObject):
new_container.setName(new_name) new_container.setName(new_name)
if new_container: if new_container:
self._registry.addContainer(new_container) self._container_registry.addContainer(new_container)
return new_container.getId() return new_container.getId()
@ -75,24 +77,24 @@ class ContainerManager(QObject):
# \return True if successful, False if not. # \return True if successful, False if not.
@pyqtSlot(str, str, str, result = bool) @pyqtSlot(str, str, str, result = bool)
def renameContainer(self, container_id, new_id, new_name): def renameContainer(self, container_id, new_id, new_name):
containers = self._registry.findContainers(None, id = container_id) containers = self._container_registry.findContainers(None, id = container_id)
if not containers: if not containers:
UM.Logger.log("w", "Could rename container %s because it was not found.", container_id) UM.Logger.log("w", "Could rename container %s because it was not found.", container_id)
return False return False
container = containers[0] container = containers[0]
# First, remove the container from the registry. This will clean up any files related to the container. # First, remove the container from the registry. This will clean up any files related to the container.
self._registry.removeContainer(container) self._container_registry.removeContainer(container)
# Ensure we have a unique name for the container # Ensure we have a unique name for the container
new_name = self._registry.uniqueName(new_name) new_name = self._container_registry.uniqueName(new_name)
# Then, update the name and ID of the container # Then, update the name and ID of the container
container.setName(new_name) container.setName(new_name)
container._id = new_id # TODO: Find a nicer way to set a new, unique ID container._id = new_id # TODO: Find a nicer way to set a new, unique ID
# Finally, re-add the container so it will be properly serialized again. # Finally, re-add the container so it will be properly serialized again.
self._registry.addContainer(container) self._container_registry.addContainer(container)
return True return True
@ -103,12 +105,12 @@ class ContainerManager(QObject):
# \return True if the container was successfully removed, False if not. # \return True if the container was successfully removed, False if not.
@pyqtSlot(str, result = bool) @pyqtSlot(str, result = bool)
def removeContainer(self, container_id): def removeContainer(self, container_id):
containers = self._registry.findContainers(None, id = container_id) containers = self._container_registry.findContainers(None, id = container_id)
if not containers: if not containers:
UM.Logger.log("w", "Could remove container %s because it was not found.", container_id) UM.Logger.log("w", "Could remove container %s because it was not found.", container_id)
return False return False
self._registry.removeContainer(containers[0].getId()) self._container_registry.removeContainer(containers[0].getId())
return True return True
@ -123,14 +125,14 @@ class ContainerManager(QObject):
# \return True if successfully merged, False if not. # \return True if successfully merged, False if not.
@pyqtSlot(str, result = bool) @pyqtSlot(str, result = bool)
def mergeContainers(self, merge_into_id, merge_id): def mergeContainers(self, merge_into_id, merge_id):
containers = self._registry.findContainers(None, id = merge_into_id) containers = self._container_registry.findContainers(None, id = merge_into_id)
if not containers: if not containers:
UM.Logger.log("w", "Could merge into container %s because it was not found.", merge_into_id) UM.Logger.log("w", "Could merge into container %s because it was not found.", merge_into_id)
return False return False
merge_into = containers[0] merge_into = containers[0]
containers = self._registry.findContainers(None, id = merge_id) containers = self._container_registry.findContainers(None, id = merge_id)
if not containers: if not containers:
UM.Logger.log("w", "Could not merge container %s because it was not found", merge_id) UM.Logger.log("w", "Could not merge container %s because it was not found", merge_id)
return False return False
@ -152,7 +154,7 @@ class ContainerManager(QObject):
# \return True if successful, False if not. # \return True if successful, False if not.
@pyqtSlot(str, result = bool) @pyqtSlot(str, result = bool)
def clearContainer(self, container_id): def clearContainer(self, container_id):
containers = self._registry.findContainers(None, id = container_id) containers = self._container_registry.findContainers(None, id = container_id)
if not containers: if not containers:
UM.Logger.log("w", "Could clear container %s because it was not found.", container_id) UM.Logger.log("w", "Could clear container %s because it was not found.", container_id)
return False return False
@ -179,7 +181,7 @@ class ContainerManager(QObject):
# \return True if successful, False if not. # \return True if successful, False if not.
@pyqtSlot(str, str, str, result = bool) @pyqtSlot(str, str, str, result = bool)
def setContainerMetaDataEntry(self, container_id, entry_name, entry_value): def setContainerMetaDataEntry(self, container_id, entry_name, entry_value):
containers = UM.Settings.ContainerRegistry.getInstance().findContainers(None, id = container_id) containers = self._container_registry.findContainers(None, id = container_id)
if not containers: if not containers:
UM.Logger.log("w", "Could not set metadata of container %s because it was not found.", container_id) UM.Logger.log("w", "Could not set metadata of container %s because it was not found.", container_id)
return False return False
@ -213,7 +215,7 @@ class ContainerManager(QObject):
## Set the name of the specified container. ## Set the name of the specified container.
@pyqtSlot(str, str, result = bool) @pyqtSlot(str, str, result = bool)
def setContainerName(self, container_id, new_name): def setContainerName(self, container_id, new_name):
containers = UM.Settings.ContainerRegistry.getInstance().findContainers(None, id = container_id) containers = self._container_registry.findContainers(None, id = container_id)
if not containers: if not containers:
UM.Logger.log("w", "Could not set name of container %s because it was not found.", container_id) UM.Logger.log("w", "Could not set name of container %s because it was not found.", container_id)
return False return False
@ -238,7 +240,7 @@ class ContainerManager(QObject):
@pyqtSlot("QVariantMap", result = "QVariantList") @pyqtSlot("QVariantMap", result = "QVariantList")
def findInstanceContainers(self, criteria): def findInstanceContainers(self, criteria):
result = [] result = []
for entry in self._registry.findInstanceContainers(**criteria): for entry in self._container_registry.findInstanceContainers(**criteria):
result.append(entry.getId()) result.append(entry.getId())
return result return result
@ -304,7 +306,7 @@ class ContainerManager(QObject):
else: else:
mime_type = self._container_name_filters[file_type]["mime"] mime_type = self._container_name_filters[file_type]["mime"]
containers = UM.Settings.ContainerRegistry.getInstance().findContainers(None, id = container_id) containers = self._container_registry.findContainers(None, id = container_id)
if not containers: if not containers:
return { "status": "error", "message": "Container not found"} return { "status": "error", "message": "Container not found"}
container = containers[0] container = containers[0]
@ -362,7 +364,7 @@ class ContainerManager(QObject):
return { "status": "error", "message": "Could not find a container to handle the specified file."} return { "status": "error", "message": "Could not find a container to handle the specified file."}
container_id = urllib.parse.unquote_plus(mime_type.stripExtension(os.path.basename(file_url))) container_id = urllib.parse.unquote_plus(mime_type.stripExtension(os.path.basename(file_url)))
container_id = UM.Settings.ContainerRegistry.getInstance().uniqueName(container_id) container_id = self._container_registry.uniqueName(container_id)
container = container_type(container_id) container = container_type(container_id)
@ -374,7 +376,7 @@ class ContainerManager(QObject):
container.setName(container_id) container.setName(container_id)
UM.Settings.ContainerRegistry.getInstance().addContainer(container) self._container_registry.addContainer(container)
return { "status": "success", "message": "Successfully imported container {0}".format(container.getName()) } return { "status": "success", "message": "Successfully imported container {0}".format(container.getName()) }
@ -390,7 +392,7 @@ class ContainerManager(QObject):
if not global_stack: if not global_stack:
return False return False
UM.Application.getInstance().getMachineManager().blurSettings.emit() self._machine_manager.blurSettings.emit()
for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks():
# Find the quality_changes container for this stack and merge the contents of the top container into it. # Find the quality_changes container for this stack and merge the contents of the top container into it.
@ -401,14 +403,14 @@ class ContainerManager(QObject):
self._performMerge(quality_changes, stack.getTop()) self._performMerge(quality_changes, stack.getTop())
UM.Application.getInstance().getMachineManager().activeQualityChanged.emit() self._machine_manager.activeQualityChanged.emit()
return True return True
## Clear the top-most (user) containers of the active stacks. ## Clear the top-most (user) containers of the active stacks.
@pyqtSlot() @pyqtSlot()
def clearUserContainers(self): def clearUserContainers(self):
UM.Application.getInstance().getMachineManager().blurSettings.emit() self._machine_manager.blurSettings.emit()
# Go through global and extruder stacks and clear their topmost container (the user settings). # Go through global and extruder stacks and clear their topmost container (the user settings).
for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks():
@ -427,14 +429,14 @@ class ContainerManager(QObject):
if not global_stack: if not global_stack:
return False return False
active_quality_name = UM.Application.getInstance().getMachineManager().activeQualityName active_quality_name = self._machine_manager.activeQualityName
if active_quality_name == "": if active_quality_name == "":
UM.Logger.log("w", "No quality container found in stack %s, cannot create profile", global_stack.getId()) UM.Logger.log("w", "No quality container found in stack %s, cannot create profile", global_stack.getId())
return False return False
UM.Application.getInstance().getMachineManager().blurSettings.emit() self._machine_manager.blurSettings.emit()
unique_name = UM.Settings.ContainerRegistry.getInstance().uniqueName(active_quality_name) unique_name = self._container_registry.uniqueName(active_quality_name)
# Go through the active stacks and create quality_changes containers from the user containers. # Go through the active stacks and create quality_changes containers from the user containers.
for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks():
@ -448,10 +450,10 @@ class ContainerManager(QObject):
new_changes = self._createQualityChanges(quality_container, unique_name, stack.getId()) new_changes = self._createQualityChanges(quality_container, unique_name, stack.getId())
self._performMerge(new_changes, user_container) self._performMerge(new_changes, user_container)
UM.Settings.ContainerRegistry.getInstance().addContainer(new_changes) self._container_registry.addContainer(new_changes)
stack.replaceContainer(stack.getContainerIndex(quality_changes_container), new_changes) stack.replaceContainer(stack.getContainerIndex(quality_changes_container), new_changes)
UM.Application.getInstance().getMachineManager().activeQualityChanged.emit() self._machine_manager.activeQualityChanged.emit()
return True return True
## Remove all quality changes containers matching a specified name. ## Remove all quality changes containers matching a specified name.
@ -471,13 +473,26 @@ class ContainerManager(QObject):
if not quality_name: if not quality_name:
return containers_found # Without a name we will never find a container to remove. return containers_found # Without a name we will never find a container to remove.
# If the container that is being removed is the currently active quality, set another quality as the active quality
activate_quality = quality_name == self._machine_manager.activeQualityName
activate_quality_type = None
for container in self._getFilteredContainers(name = quality_name, type = "quality_changes"): for container in self._getFilteredContainers(name = quality_name, type = "quality_changes"):
containers_found = True containers_found = True
UM.Settings.ContainerRegistry.getInstance().removeContainer(container.getId()) if activate_quality and not activate_quality_type:
activate_quality_type = container.getMetaDataEntry("quality")
self._container_registry.removeContainer(container.getId())
if not containers_found: if not containers_found:
UM.Logger.log("d", "Unable to remove quality containers, as we did not find any by the name of %s", quality_name) UM.Logger.log("d", "Unable to remove quality containers, as we did not find any by the name of %s", quality_name)
elif activate_quality:
definition_id = "fdmprinter" if not self._machine_manager.filterQualityByMachine else self._machine_manager.activeDefinitionId
containers = self._container_registry.findInstanceContainers(type = "quality", definition = definition_id, quality_type = activate_quality_type)
if containers:
self._machine_manager.setActiveQuality(containers[0].getId())
self._machine_manager.activeQualityChanged.emit()
return containers_found return containers_found
## Rename a set of quality changes containers. ## Rename a set of quality changes containers.
@ -504,16 +519,16 @@ class ContainerManager(QObject):
if not global_stack: if not global_stack:
return False return False
UM.Application.getInstance().getMachineManager().blurSettings.emit() self._machine_manager.blurSettings.emit()
new_name = UM.Settings.ContainerRegistry.getInstance().uniqueName(new_name) new_name = self._container_registry.uniqueName(new_name)
container_registry = UM.Settings.ContainerRegistry.getInstance() container_registry = self._container_registry
for container in self._getFilteredContainers(name = quality_name, type = "quality_changes"): for container in self._getFilteredContainers(name = quality_name, type = "quality_changes"):
stack_id = container.getMetaDataEntry("extruder", global_stack.getId()) stack_id = container.getMetaDataEntry("extruder", global_stack.getId())
container_registry.renameContainer(container.getId(), new_name, self._createUniqueId(stack_id, new_name)) container_registry.renameContainer(container.getId(), new_name, self._createUniqueId(stack_id, new_name))
UM.Application.getInstance().getMachineManager().activeQualityChanged.emit() self._machine_manager.activeQualityChanged.emit()
return True return True
## Duplicate a specified set of quality or quality_changes containers. ## Duplicate a specified set of quality or quality_changes containers.
@ -531,24 +546,24 @@ class ContainerManager(QObject):
if not global_stack or not quality_name: if not global_stack or not quality_name:
return "" return ""
UM.Logger.log("d", "Attempting to duplicate the quality %s", quality_name) UM.Logger.log("d", "Attempting to duplicate the quality %s", quality_name)
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(name = quality_name) containers = self._container_registry.findInstanceContainers(name = quality_name)
if not containers: if not containers:
UM.Logger.log("d", "Unable to duplicate the quality %s, because it doesn't exist.", quality_name) UM.Logger.log("d", "Unable to duplicate the quality %s, because it doesn't exist.", quality_name)
return "" return ""
new_name = UM.Settings.ContainerRegistry.getInstance().uniqueName(quality_name) new_name = self._container_registry.uniqueName(quality_name)
container_type = containers[0].getMetaDataEntry("type") container_type = containers[0].getMetaDataEntry("type")
if container_type == "quality": if container_type == "quality":
for container in self._getFilteredContainers(name = quality_name, type = "quality"): for container in self._getFilteredContainers(name = quality_name, type = "quality"):
for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks():
new_changes = self._createQualityChanges(container, new_name, stack.getId()) new_changes = self._createQualityChanges(container, new_name, stack.getId())
UM.Settings.ContainerRegistry.getInstance().addContainer(new_changes) self._container_registry.addContainer(new_changes)
elif container_type == "quality_changes": elif container_type == "quality_changes":
for container in self._getFilteredContainers(name = quality_name, type = "quality_changes"): for container in self._getFilteredContainers(name = quality_name, type = "quality_changes"):
stack_id = container.getMetaDataEntry("extruder", global_stack.getId()) stack_id = container.getMetaDataEntry("extruder", global_stack.getId())
new_container = container.duplicate(self._createUniqueId(stack_id, new_name), new_name) new_container = container.duplicate(self._createUniqueId(stack_id, new_name), new_name)
UM.Settings.ContainerRegistry.getInstance().addContainer(new_container) self._container_registry.addContainer(new_container)
else: else:
return "" return ""
@ -638,7 +653,7 @@ class ContainerManager(QObject):
for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks():
material_ids.append(stack.findContainer(type = "material").getId()) material_ids.append(stack.findContainer(type = "material").getId())
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria) containers = self._container_registry.findInstanceContainers(**criteria)
for container in containers: for container in containers:
# If the machine specifies we should filter by material, exclude containers that do not match any active material. # If the machine specifies we should filter by material, exclude containers that do not match any active material.
if filter_by_material and container.getMetaDataEntry("material") not in material_ids: if filter_by_material and container.getMetaDataEntry("material") not in material_ids:
@ -685,7 +700,7 @@ class ContainerManager(QObject):
# If the machine specifies qualities should be filtered, ensure we match the current criteria. # If the machine specifies qualities should be filtered, ensure we match the current criteria.
if not global_stack.getMetaDataEntry("has_machine_quality"): if not global_stack.getMetaDataEntry("has_machine_quality"):
quality_changes.setDefinition(UM.Settings.ContainerRegistry.getInstance().findContainers(id = "fdmprinter")[0]) quality_changes.setDefinition(self._container_registry.findContainers(id = "fdmprinter")[0])
else: else:
quality_changes.setDefinition(global_stack.getBottom()) quality_changes.setDefinition(global_stack.getBottom())

View File

@ -148,6 +148,8 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
containers.extend(changes) containers.extend(changes)
global_container_stack = UM.Application.getInstance().getGlobalContainerStack() global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
is_multi_extrusion = global_container_stack.getProperty("machine_extruder_count", "value") > 1
current_category = "" current_category = ""
for definition in definition_container.findDefinitions(): for definition in definition_container.findDefinitions():
if definition.type == "category": if definition.type == "category":
@ -171,14 +173,15 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
if not profile_value and not user_value: if not profile_value and not user_value:
continue continue
settable_per_extruder = global_container_stack.getProperty(definition.key, "settable_per_extruder") if is_multi_extrusion:
# If a setting is not settable per extruder (global) and we're looking at an extruder tab, don't show this value. settable_per_extruder = global_container_stack.getProperty(definition.key, "settable_per_extruder")
if self._extruder_id != "" and not settable_per_extruder: # If a setting is not settable per extruder (global) and we're looking at an extruder tab, don't show this value.
continue if self._extruder_id != "" and not settable_per_extruder:
continue
# If a setting is settable per extruder (not global) and we're looking at global tab, don't show this value. # 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: if self._extruder_id == "" and settable_per_extruder:
continue continue
items.append({ items.append({
"key": definition.key, "key": definition.key,

View File

@ -12,7 +12,7 @@ from UM.Mesh.MeshBuilder import MeshBuilder
from UM.Job import Job from UM.Job import Job
from UM.Preferences import Preferences from UM.Preferences import Preferences
from UM.Logger import Logger from UM.Logger import Logger
from UM.Scene.SceneNode import SceneNode
from UM.View.RenderBatch import RenderBatch from UM.View.RenderBatch import RenderBatch
from UM.View.GL.OpenGL import OpenGL from UM.View.GL.OpenGL import OpenGL
@ -33,7 +33,7 @@ class LayerView(View):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self._shader = None self._shader = None
self._selection_shader = None self._ghost_shader = None
self._num_layers = 0 self._num_layers = 0
self._layer_percentage = 0 # what percentage of layers need to be shown (Slider gives value between 0 - 100) self._layer_percentage = 0 # what percentage of layers need to be shown (Slider gives value between 0 - 100)
self._proxy = LayerViewProxy.LayerViewProxy() self._proxy = LayerViewProxy.LayerViewProxy()
@ -84,9 +84,9 @@ class LayerView(View):
scene = self.getController().getScene() scene = self.getController().getScene()
renderer = self.getRenderer() renderer = self.getRenderer()
if not self._selection_shader: if not self._ghost_shader:
self._selection_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "color.shader")) self._ghost_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "color.shader"))
self._selection_shader.setUniformValue("u_color", Color(32, 32, 32, 128)) self._ghost_shader.setUniformValue("u_color", Color(0, 0, 0, 72))
for node in DepthFirstIterator(scene.getRoot()): for node in DepthFirstIterator(scene.getRoot()):
# We do not want to render ConvexHullNode as it conflicts with the bottom layers. # We do not want to render ConvexHullNode as it conflicts with the bottom layers.
@ -96,8 +96,13 @@ class LayerView(View):
if not node.render(renderer): if not node.render(renderer):
if node.getMeshData() and node.isVisible(): if node.getMeshData() and node.isVisible():
if Selection.isSelected(node): renderer.queueNode(node,
renderer.queueNode(node, transparent = True, shader = self._selection_shader) shader = self._ghost_shader,
state_setup_callback = lambda gl: gl.glDepthMask(gl.GL_FALSE),
state_teardown_callback = lambda gl: gl.glDepthMask(gl.GL_TRUE)
)
if node.getMeshData() and node.isVisible():
layer_data = node.callDecoration("getLayerData") layer_data = node.callDecoration("getLayerData")
if not layer_data: if not layer_data:
continue continue

View File

@ -137,7 +137,7 @@ Menu
var materialId = items[i].id; var materialId = items[i].id;
genericMaterialsModel.append({ genericMaterialsModel.append({
id:materialId, id:materialId,
name:materialName name:items[i].name
}); });
} }
else else
@ -152,8 +152,8 @@ Menu
materialsByBrand[brandName][materialName] = []; materialsByBrand[brandName][materialName] = [];
} }
materialsByBrand[brandName][materialName].push({ materialsByBrand[brandName][materialName].push({
name: items[i].name, id: items[i].id,
id: items[i].id name: items[i].name
}); });
} }
} }

View File

@ -68,7 +68,7 @@ UM.ManagementPage
} }
Label Label
{ {
text: (model.name != model.metadata.material) ? model.metadata.color_name : "" text: (model.name != model.metadata.material) ? model.name : ""
elide: Text.ElideRight elide: Text.ElideRight
font.italic: model.id == activeId font.italic: model.id == activeId
color: isCurrentItem ? palette.highlightedText : palette.text; color: isCurrentItem ? palette.highlightedText : palette.text;

View File

@ -101,7 +101,12 @@ UM.ManagementPage
text: catalog.i18nc("@action:button", "Rename"); text: catalog.i18nc("@action:button", "Rename");
iconName: "edit-rename"; iconName: "edit-rename";
enabled: base.currentItem != null ? !base.currentItem.readOnly : false; enabled: base.currentItem != null ? !base.currentItem.readOnly : false;
onClicked: { renameDialog.removeWhenRejected = false; renameDialog.open(); renameDialog.selectText(); } onClicked:
{
renameDialog.removeWhenRejected = false;
renameDialog.open();
renameDialog.selectText();
}
}, },
Button Button
{ {
@ -121,10 +126,16 @@ UM.ManagementPage
scrollviewCaption: catalog.i18nc("@label %1 is printer name","Printer: %1").arg(Cura.MachineManager.activeMachineName) scrollviewCaption: catalog.i18nc("@label %1 is printer name","Printer: %1").arg(Cura.MachineManager.activeMachineName)
signal showProfileNameDialog() signal showProfileNameDialog()
onShowProfileNameDialog: { renameDialog.removeWhenRejected = true; renameDialog.open(); renameDialog.selectText(); } onShowProfileNameDialog:
{
renameDialog.removeWhenRejected = true;
renameDialog.open();
renameDialog.selectText();
}
signal selectContainer(string name) signal selectContainer(string name)
onSelectContainer: { onSelectContainer:
{
objectList.currentIndex = objectList.model.find("name", name); objectList.currentIndex = objectList.model.find("name", name);
} }
@ -248,8 +259,10 @@ UM.ManagementPage
Cura.ContainerManager.renameQualityChanges(base.currentItem.name, newName) Cura.ContainerManager.renameQualityChanges(base.currentItem.name, newName)
objectList.currentIndex = -1 //Reset selection. objectList.currentIndex = -1 //Reset selection.
} }
onRejected: { onRejected:
if(removeWhenRejected) { {
if(removeWhenRejected)
{
Cura.ContainerManager.removeQualityChanges(base.currentItem.name) Cura.ContainerManager.removeQualityChanges(base.currentItem.name)
} }
} }