Merge branch '2.3' of github.com:Ultimaker/Cura into 2.3

This commit is contained in:
Jaime van Kessel 2016-09-07 09:21:53 +02:00
commit 17d8c1e9c1
5 changed files with 30 additions and 14 deletions

View File

@ -254,6 +254,10 @@ class ContainerManager(QObject):
return True return True
return False 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 ## 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 # This will go through the list of available container types and generate a list of strings

View File

@ -13,6 +13,7 @@ from UM.Settings.Validator import ValidatorState
from UM.View.GL.OpenGL import OpenGL from UM.View.GL.OpenGL import OpenGL
import cura.Settings import cura.Settings
from cura.Settings.ExtruderManager import ExtruderManager
import math import math
@ -45,8 +46,16 @@ class SolidView(View):
global_container_stack = Application.getInstance().getGlobalContainerStack() global_container_stack = Application.getInstance().getGlobalContainerStack()
if global_container_stack: 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"): 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 # 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) # 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]: 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: else:
self._enabled_shader.setUniformValue("u_overhangAngle", math.cos(math.radians(0))) 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()): for node in DepthFirstIterator(scene.getRoot()):
if not node.render(renderer): if not node.render(renderer):

View File

@ -105,7 +105,8 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension):
@pyqtSlot(str) @pyqtSlot(str)
def updateAllFirmware(self, file_name): 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: if not self._usb_output_devices:
Message(i18n_catalog.i18nc("@info", "Unable to update firmware because there are no printers connected.")).show() Message(i18n_catalog.i18nc("@info", "Unable to update firmware because there are no printers connected.")).show()
return return

View File

@ -464,12 +464,11 @@ UM.MainWindow
target: Cura.Actions.addProfile target: Cura.Actions.addProfile
onTriggered: onTriggered:
{ {
Cura.ContainerManager.createQualityChanges(null);
preferences.setPage(4); preferences.setPage(4);
preferences.show(); preferences.show();
// Show the renameDialog after a very short delay so the preference page has time to initiate // Create a new profile after a very short delay so the preference page has time to initiate
showProfileNameDialogTimer.start(); createProfileTimer.start();
} }
} }
@ -516,11 +515,11 @@ UM.MainWindow
Timer Timer
{ {
id: showProfileNameDialogTimer id: createProfileTimer
repeat: false repeat: false
interval: 1 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. // BlurSettings is a way to force the focus away from any of the setting items.

View File

@ -84,7 +84,7 @@ UM.ManagementPage
onClicked: onClicked:
{ {
newNameDialog.object = base.currentItem != null ? base.currentItem.name : ""; newNameDialog.object = base.currentItem != null ? Cura.ContainerManager.makeUniqueName(base.currentItem.name) : "";
newNameDialog.open(); newNameDialog.open();
newNameDialog.selectText(); newNameDialog.selectText();
} }
@ -100,7 +100,7 @@ UM.ManagementPage
onClicked: onClicked:
{ {
newDuplicateNameDialog.object = base.currentItem.name; newDuplicateNameDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name);
newDuplicateNameDialog.open(); newDuplicateNameDialog.open();
newDuplicateNameDialog.selectText(); newDuplicateNameDialog.selectText();
} }
@ -141,11 +141,12 @@ 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 createProfile()
onShowProfileNameDialog: onCreateProfile:
{ {
renameDialog.open(); newNameDialog.object = base.currentItem != null ? Cura.ContainerManager.makeUniqueName(base.currentItem.name) : "";
renameDialog.selectText(); newNameDialog.open();
newNameDialog.selectText();
} }
signal selectContainer(string name) signal selectContainer(string name)
@ -267,6 +268,7 @@ UM.ManagementPage
UM.RenameDialog UM.RenameDialog
{ {
title: catalog.i18nc("@title:window", "Rename Profile")
id: renameDialog; id: renameDialog;
object: base.currentItem != null ? base.currentItem.name : "" object: base.currentItem != null ? base.currentItem.name : ""
onAccepted: onAccepted:
@ -279,6 +281,7 @@ UM.ManagementPage
// Dialog to request a name when creating a new profile // Dialog to request a name when creating a new profile
UM.RenameDialog UM.RenameDialog
{ {
title: catalog.i18nc("@title:window", "Create Profile")
id: newNameDialog; id: newNameDialog;
object: "<new name>"; object: "<new name>";
onAccepted: onAccepted:
@ -292,6 +295,7 @@ UM.ManagementPage
// Dialog to request a name when duplicating a new profile // Dialog to request a name when duplicating a new profile
UM.RenameDialog UM.RenameDialog
{ {
title: catalog.i18nc("@title:window", "Duplicate Profile")
id: newDuplicateNameDialog; id: newDuplicateNameDialog;
object: "<new name>"; object: "<new name>";
onAccepted: onAccepted: