Merge branch '2.3'

This commit is contained in:
Ghostkeeper 2016-10-31 10:55:54 +01:00
commit 6999a14821
No known key found for this signature in database
GPG Key ID: C5F96EE2BC0F7E75
7 changed files with 30 additions and 16 deletions

View File

@ -520,6 +520,15 @@ class BuildVolume(SceneNode):
def _getSettingFromAdhesionExtruder(self, setting_key, property = "value"): def _getSettingFromAdhesionExtruder(self, setting_key, property = "value"):
return self._getSettingFromExtruder(setting_key, "adhesion_extruder_nr", property) return self._getSettingFromExtruder(setting_key, "adhesion_extruder_nr", property)
## Private convenience function to get a setting from every extruder.
#
# For single extrusion machines, this gets the setting from the global
# stack.
#
# \return A sequence of setting values, one for each extruder.
def _getSettingFromAllExtruders(self, setting_key, property = "value"):
return ExtruderManager.getInstance().getAllExtruderSettings(setting_key, property)
## Private convenience function to get a setting from the support infill ## Private convenience function to get a setting from the support infill
# extruder. # extruder.
# #
@ -602,10 +611,12 @@ class BuildVolume(SceneNode):
farthest_shield_distance = max(farthest_shield_distance, container_stack.getProperty("ooze_shield_dist", "value")) farthest_shield_distance = max(farthest_shield_distance, container_stack.getProperty("ooze_shield_dist", "value"))
move_from_wall_radius = 0 # Moves that start from outer wall. move_from_wall_radius = 0 # Moves that start from outer wall.
if self._getSettingFromAdhesionExtruder("infill_wipe_dist"): move_from_wall_radius = max(move_from_wall_radius, max(self._getSettingFromAllExtruders("infill_wipe_dist")))
move_from_wall_radius = max(move_from_wall_radius, self._getSettingFromAdhesionExtruder("infill_wipe_dist")) avoid_enabled_per_extruder = self._getSettingFromAllExtruders(("travel_avoid_other_parts"))
if self._getSettingFromAdhesionExtruder("travel_avoid_distance") and self._getSettingFromAdhesionExtruder("travel_avoid_other_parts"): avoid_distance_per_extruder = self._getSettingFromAllExtruders("travel_avoid_distance")
move_from_wall_radius = max(move_from_wall_radius, self._getSettingFromAdhesionExtruder("travel_avoid_distance")) for index, avoid_other_parts_enabled in enumerate(avoid_enabled_per_extruder): #For each extruder (or just global).
if avoid_other_parts_enabled:
move_from_wall_radius = max(move_from_wall_radius, avoid_distance_per_extruder[index]) #Index of the same extruder.
#Now combine our different pieces of data to get the final border size. #Now combine our different pieces of data to get the final border size.
#Support expansion is added to the bed adhesion, since the bed adhesion goes around support. #Support expansion is added to the bed adhesion, since the bed adhesion goes around support.

View File

@ -268,18 +268,22 @@ class ExtruderManager(QObject):
container_registry.addContainer(container_stack) container_registry.addContainer(container_stack)
def getAllExtruderValues(self, setting_key): def getAllExtruderValues(self, setting_key):
return self.getAllExtruderSettings(setting_key, "value")
## Gets a
def getAllExtruderSettings(self, setting_key, property):
global_container_stack = UM.Application.getInstance().getGlobalContainerStack() global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
multi_extrusion = global_container_stack.getProperty("machine_extruder_count", "value") > 1 if global_container_stack.getProperty("machine_extruder_count", "value") <= 1:
if not multi_extrusion: return [global_container_stack.getProperty(setting_key, property)]
return [global_container_stack.getProperty(setting_key, "value")]
result = [] result = []
for index in self.extruderIds: for index in self.extruderIds:
extruder_stack_id = self.extruderIds[str(index)] extruder_stack_id = self.extruderIds[str(index)]
stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0] stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0]
result.append(stack.getProperty(setting_key, "value")) result.append(stack.getProperty(setting_key, property))
return result return result
## Removes the container stack and user profile for the extruders for a specific machine. ## Removes the container stack and user profile for the extruders for a specific machine.
# #
# \param machine_id The machine to remove the extruders for. # \param machine_id The machine to remove the extruders for.

View File

@ -248,7 +248,6 @@ class MachineManager(QObject):
def _onActiveExtruderStackChanged(self): def _onActiveExtruderStackChanged(self):
self.blurSettings.emit() # Ensure no-one has focus. self.blurSettings.emit() # Ensure no-one has focus.
old_active_container_stack = self._active_container_stack old_active_container_stack = self._active_container_stack
if self._active_container_stack and self._active_container_stack != self._global_container_stack: if self._active_container_stack and self._active_container_stack != self._global_container_stack:

View File

@ -28,7 +28,7 @@ class MachineNameValidator(QObject):
# special character, and that up to [machine_name_max_length / 12] times. # special character, and that up to [machine_name_max_length / 12] times.
maximum_special_characters = int(machine_name_max_length / 12) maximum_special_characters = int(machine_name_max_length / 12)
unescaped = r"[a-zA-Z0-9_\-\.\/]" unescaped = r"[a-zA-Z0-9_\-\.\/]"
self.machine_name_regex = r"((" + unescaped + "){0,12}|.){0," + str(maximum_special_characters) + r"}" self.machine_name_regex = r"^((" + unescaped + "){0,12}|.){0," + str(maximum_special_characters) + r"}$"
validationChanged = pyqtSignal() validationChanged = pyqtSignal()
@ -56,14 +56,11 @@ class MachineNameValidator(QObject):
def updateValidation(self, new_name): def updateValidation(self, new_name):
is_valid = self.validate(new_name, 0) is_valid = self.validate(new_name, 0)
if is_valid == QValidator.Acceptable: if is_valid == QValidator.Acceptable:
print("VALID")
self.validation_regex = "^.*$" #Matches anything. self.validation_regex = "^.*$" #Matches anything.
else: else:
print("BROKEN!")
self.validation_regex = "a^" #Never matches (unless you manage to get "a" before the start of the string... good luck). self.validation_regex = "a^" #Never matches (unless you manage to get "a" before the start of the string... good luck).
self.validationChanged.emit() self.validationChanged.emit()
@pyqtProperty("QRegExp", notify=validationChanged) @pyqtProperty("QRegExp", notify=validationChanged)
def machineNameRegex(self): def machineNameRegex(self):
print(self.machine_name_regex)
return QRegExp(self.machine_name_regex) return QRegExp(self.machine_name_regex)

View File

@ -154,6 +154,7 @@
"travel_avoid_distance": { "value": "3" }, "travel_avoid_distance": { "value": "3" },
"wall_0_inset": { "value": "0" }, "wall_0_inset": { "value": "0" },
"wall_line_width_x": { "value": "round(line_width * 0.3 / 0.35, 2)" }, "wall_line_width_x": { "value": "round(line_width * 0.3 / 0.35, 2)" },
"wall_thickness": { "value": "1" } "wall_thickness": { "value": "1" },
"xy_offset": { "value": "-0.14" }
} }
} }

View File

@ -539,7 +539,7 @@ UM.MainWindow
target: Cura.MachineManager target: Cura.MachineManager
onBlurSettings: onBlurSettings:
{ {
contentItem.focus = true forceActiveFocus()
} }
} }

View File

@ -251,6 +251,8 @@ UM.ManagementPage
{ {
id: renameDialog; id: renameDialog;
object: base.currentItem && base.currentItem.name ? base.currentItem.name : ""; object: base.currentItem && base.currentItem.name ? base.currentItem.name : "";
property var machine_name_validator: Cura.MachineNameValidator { }
validName: renameDialog.newName.match(renameDialog.machine_name_validator.machineNameRegex) != null;
onAccepted: onAccepted:
{ {
Cura.MachineManager.renameMachine(base.currentItem.id, newName.trim()); Cura.MachineManager.renameMachine(base.currentItem.id, newName.trim());