diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index 40e036eba5..c082c64da1 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -254,6 +254,10 @@ class ContainerManager(QObject): return True return False + @pyqtSlot(str, result = str) + def makeUniqueName(self, original_name): + return self._container_registry.uniqueName(original_name) + ## Get a list of string that can be used as name filters for a Qt File Dialog # # This will go through the list of available container types and generate a list of strings diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index 3b56ac1881..2d017f829f 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -13,6 +13,7 @@ from UM.Settings.Validator import ValidatorState from UM.View.GL.OpenGL import OpenGL import cura.Settings +from cura.Settings.ExtruderManager import ExtruderManager import math @@ -45,8 +46,16 @@ class SolidView(View): global_container_stack = Application.getInstance().getGlobalContainerStack() if global_container_stack: + multi_extrusion = global_container_stack.getProperty("machine_extruder_count", "value") > 1 + + if multi_extrusion: + support_extruder_nr = global_container_stack.getProperty("support_extruder_nr", "value") + support_angle_stack = ExtruderManager.getInstance().getExtruderStack(support_extruder_nr) + else: + support_angle_stack = global_container_stack + if Preferences.getInstance().getValue("view/show_overhang"): - angle = global_container_stack.getProperty("support_angle", "value") + angle = support_angle_stack.getProperty("support_angle", "value") # Make sure the overhang angle is valid before passing it to the shader # Note: if the overhang angle is set to its default value, it does not need to get validated (validationState = None) if angle is not None and global_container_stack.getProperty("support_angle", "validationState") in [None, ValidatorState.Valid]: @@ -56,7 +65,6 @@ class SolidView(View): else: self._enabled_shader.setUniformValue("u_overhangAngle", math.cos(math.radians(0))) - multi_extrusion = global_container_stack.getProperty("machine_extruder_count", "value") > 1 for node in DepthFirstIterator(scene.getRoot()): if not node.render(renderer): diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index 603696f1c6..4dec2e3a06 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -105,7 +105,8 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension): @pyqtSlot(str) def updateAllFirmware(self, file_name): - file_name = file_name.replace("file://", "") # File dialogs prepend the path with file://, which we don't need / want + if file_name.startswith("file://"): + file_name = QUrl(file_name).toLocalFile() # File dialogs prepend the path with file://, which we don't need / want if not self._usb_output_devices: Message(i18n_catalog.i18nc("@info", "Unable to update firmware because there are no printers connected.")).show() return diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 42c2ad9cf4..005a0892a3 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -464,12 +464,11 @@ UM.MainWindow target: Cura.Actions.addProfile onTriggered: { - Cura.ContainerManager.createQualityChanges(null); preferences.setPage(4); preferences.show(); - // Show the renameDialog after a very short delay so the preference page has time to initiate - showProfileNameDialogTimer.start(); + // Create a new profile after a very short delay so the preference page has time to initiate + createProfileTimer.start(); } } @@ -516,11 +515,11 @@ UM.MainWindow Timer { - id: showProfileNameDialogTimer + id: createProfileTimer repeat: false interval: 1 - onTriggered: preferences.getCurrentItem().showProfileNameDialog() + onTriggered: preferences.getCurrentItem().createProfile() } // BlurSettings is a way to force the focus away from any of the setting items. diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 56d8bd41a4..4e872bdc2b 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -84,7 +84,7 @@ UM.ManagementPage onClicked: { - newNameDialog.object = base.currentItem != null ? base.currentItem.name : ""; + newNameDialog.object = base.currentItem != null ? Cura.ContainerManager.makeUniqueName(base.currentItem.name) : ""; newNameDialog.open(); newNameDialog.selectText(); } @@ -100,7 +100,7 @@ UM.ManagementPage onClicked: { - newDuplicateNameDialog.object = base.currentItem.name; + newDuplicateNameDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name); newDuplicateNameDialog.open(); newDuplicateNameDialog.selectText(); } @@ -141,11 +141,12 @@ UM.ManagementPage scrollviewCaption: catalog.i18nc("@label %1 is printer name","Printer: %1").arg(Cura.MachineManager.activeMachineName) - signal showProfileNameDialog() - onShowProfileNameDialog: + signal createProfile() + onCreateProfile: { - renameDialog.open(); - renameDialog.selectText(); + newNameDialog.object = base.currentItem != null ? Cura.ContainerManager.makeUniqueName(base.currentItem.name) : ""; + newNameDialog.open(); + newNameDialog.selectText(); } signal selectContainer(string name) @@ -267,6 +268,7 @@ UM.ManagementPage UM.RenameDialog { + title: catalog.i18nc("@title:window", "Rename Profile") id: renameDialog; object: base.currentItem != null ? base.currentItem.name : "" onAccepted: @@ -279,6 +281,7 @@ UM.ManagementPage // Dialog to request a name when creating a new profile UM.RenameDialog { + title: catalog.i18nc("@title:window", "Create Profile") id: newNameDialog; object: ""; onAccepted: @@ -292,6 +295,7 @@ UM.ManagementPage // Dialog to request a name when duplicating a new profile UM.RenameDialog { + title: catalog.i18nc("@title:window", "Duplicate Profile") id: newDuplicateNameDialog; object: ""; onAccepted: