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

This commit is contained in:
Ghostkeeper 2016-03-01 11:23:39 +01:00
commit 5a3e67238e
11 changed files with 202 additions and 125 deletions

View File

@ -130,6 +130,10 @@ class CuraApplication(QtApplication):
self._recent_files.append(QUrl.fromLocalFile(f))
@pyqtSlot(result = QUrl)
def getDefaultPath(self):
return QUrl.fromLocalFile(os.path.expanduser("~/"))
## Handle loading of all plugin types (and the backend explicitly)
# \sa PluginRegistery
def _loadPlugins(self):

View File

@ -60,12 +60,16 @@ class PlatformPhysics:
build_volume_bounding_box = copy.deepcopy(self._build_volume.getBoundingBox())
build_volume_bounding_box.setBottom(-9001) # Ignore intersections with the bottom
node._outside_buildarea = False
# Mark the node as outside the build volume if the bounding box test fails.
if build_volume_bounding_box.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection:
node._outside_buildarea = True
else:
node._outside_buildarea = False
# When printing one at a time too high objects are not printable.
if Application.getInstance().getMachineManager().getWorkingProfile().getSettingValue("print_sequence") == "one_at_a_time":
if node.getBoundingBox().height > Application.getInstance().getMachineManager().getWorkingProfile().getSettingValue("gantry_height"):
node._outside_buildarea = True
# Move it downwards if bottom is above platform
move_vector = Vector()

View File

@ -61,6 +61,8 @@ class StartSliceJob(Job):
if temp_list:
object_groups.append(temp_list)
Job.yieldThread()
if len(object_groups) == 0:
Logger.log("w", "No objects suitable for one at a time found, or no correct order found")
else:
temp_list = []
for node in DepthFirstIterator(self._scene.getRoot()):

View File

@ -36,7 +36,7 @@ class LayerView(View):
self._num_layers = 0
self._layer_percentage = 0 # what percentage of layers need to be shown (SLider gives value between 0 - 100)
self._proxy = LayerViewProxy.LayerViewProxy()
self._controller.getScene().sceneChanged.connect(self._onSceneChanged)
self._controller.getScene().getRoot().childrenChanged.connect(self._onSceneChanged)
self._max_layers = 10
self._current_layer_num = 10
self._current_layer_mesh = None
@ -51,6 +51,8 @@ class LayerView(View):
self._top_layer_timer.setSingleShot(True)
self._top_layer_timer.timeout.connect(self._startUpdateTopLayers)
self._busy = False
def getActivity(self):
return self._activity
@ -63,6 +65,16 @@ class LayerView(View):
def getMaxLayers(self):
return self._max_layers
busyChanged = Signal()
def isBusy(self):
return self._busy
def setBusy(self, busy):
if busy != self._busy:
self._busy = busy
self.busyChanged.emit()
def resetLayerData(self):
self._current_layer_mesh = None
self._current_layer_jumps = None
@ -121,11 +133,6 @@ class LayerView(View):
self._top_layer_timer.start()
if self._top_layers_job:
self._top_layers_job.finished.disconnect(self._updateCurrentLayerMesh)
self._top_layers_job.cancel()
self._top_layers_job = None
self.currentLayerNumChanged.emit()
currentLayerNumChanged = Signal()
@ -158,7 +165,6 @@ class LayerView(View):
else:
self.setLayer(int(self._max_layers))
self.maxLayersChanged.emit()
self._top_layer_timer.start()
maxLayersChanged = Signal()
@ -184,11 +190,19 @@ class LayerView(View):
return True
def _startUpdateTopLayers(self):
if self._top_layers_job:
self._top_layers_job.finished.disconnect(self._updateCurrentLayerMesh)
self._top_layers_job.cancel()
self.setBusy(True)
self._top_layers_job = _CreateTopLayersJob(self._controller.getScene(), self._current_layer_num, self._solid_layers)
self._top_layers_job.finished.connect(self._updateCurrentLayerMesh)
self._top_layers_job.start()
def _updateCurrentLayerMesh(self, job):
self.setBusy(False)
if not job.getResult():
return
@ -217,10 +231,6 @@ class _CreateTopLayersJob(Job):
if self._cancel or not layer_data:
return
message = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, -1)
start_time = time.clock()
layer_mesh = MeshData()
for i in range(self._solid_layers):
layer_number = self._layer_number - i
@ -231,7 +241,6 @@ class _CreateTopLayersJob(Job):
layer = layer_data.getLayer(layer_number).createMesh()
except Exception as e:
print(e)
message.hide()
return
if not layer or layer.getVertices() is None:
@ -245,24 +254,19 @@ class _CreateTopLayersJob(Job):
layer_mesh.addColors(layer.getColors() * brightness)
if self._cancel:
message.hide()
return
now = time.clock()
if now - start_time > 0.5:
# If the entire process takes longer than 500ms, display a message indicating that we're busy.
message.show()
Job.yieldThread()
if self._cancel:
message.hide()
return
Job.yieldThread()
jump_mesh = layer_data.getLayer(self._layer_number).createJumps()
if not jump_mesh or jump_mesh.getVertices() is None:
jump_mesh = None
self.setResult({ "layers": layer_mesh, "jumps": jump_mesh })
message.hide()
def cancel(self):
self._cancel = True

View File

@ -25,11 +25,72 @@ Item
maximumValue: UM.LayerView.numLayers;
stepSize: 1
property real pixelsPerStep: ((height - UM.Theme.getSize("slider_handle").height) / (maximumValue - minimumValue)) * stepSize;
value: UM.LayerView.currentLayer
onValueChanged: UM.LayerView.setCurrentLayer(value)
style: UM.Theme.styles.layerViewSlider
style: UM.Theme.styles.slider;
Rectangle
{
x: parent.width + UM.Theme.getSize("default_margin").width;
y: parent.height - (parent.value * parent.pixelsPerStep) - UM.Theme.getSize("slider_handle").height * 1.25;
height: UM.Theme.getSize("slider_handle").height + UM.Theme.getSize("default_margin").height
width: valueLabel.width + (busyIndicator.visible ? busyIndicator.width : 0) + UM.Theme.getSize("default_margin").width
Behavior on height { NumberAnimation { duration: 50; } }
border.width: UM.Theme.getSize("default_lining").width;
border.color: UM.Theme.getColor("slider_groove_border");
visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false
TextField
{
id: valueLabel
property string maxValue: slider.maximumValue + 1
text: slider.value + 1
horizontalAlignment: TextInput.AlignRight;
onEditingFinished:
{
if(valueLabel.text != '')
{
slider.value = valueLabel.text - 1
}
}
validator: IntValidator { bottom: 1; top: slider.maximumValue + 1; }
anchors.left: parent.left;
anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2;
anchors.verticalCenter: parent.verticalCenter;
width: UM.Theme.getSize("line").width * maxValue.length;
style: TextFieldStyle
{
textColor: UM.Theme.getColor("setting_control_text");
font: UM.Theme.getFont("default");
background: Item { }
}
}
BusyIndicator
{
id: busyIndicator;
anchors.right: parent.right;
anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2;
anchors.verticalCenter: parent.verticalCenter;
width: UM.Theme.getSize("slider_handle").height;
height: width;
running: UM.LayerView.busy;
visible: UM.LayerView.busy;
}
}
}
Rectangle {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter

View File

@ -34,6 +34,15 @@ class LayerViewProxy(QObject):
if type(active_view) == LayerView.LayerView.LayerView:
return active_view.getCurrentLayer()
busyChanged = pyqtSignal()
@pyqtProperty(bool, notify = busyChanged)
def busy(self):
active_view = self._controller.getActiveView()
if type(active_view) == LayerView.LayerView.LayerView:
return active_view.isBusy()
return False
@pyqtSlot(int)
def setCurrentLayer(self, layer_num):
active_view = self._controller.getActiveView()
@ -50,8 +59,12 @@ class LayerViewProxy(QObject):
def _onMaxLayersChanged(self):
self.maxLayersChanged.emit()
def _onBusyChanged(self):
self.busyChanged.emit()
def _onActiveViewChanged(self):
active_view = self._controller.getActiveView()
if type(active_view) == LayerView.LayerView.LayerView:
active_view.currentLayerNumChanged.connect(self._onLayerChanged)
active_view.maxLayersChanged.connect(self._onMaxLayersChanged)
active_view.busyChanged.connect(self._onBusyChanged)

View File

@ -17,6 +17,7 @@ class PerObjectSettingsTool(Tool):
self.setExposedProperties("Model", "SelectedIndex")
Preferences.getInstance().preferenceChanged.connect(self._onPreferenceChanged)
self._onPreferenceChanged("cura/active_mode")
def event(self, event):
return False

View File

@ -33,7 +33,8 @@
"max_value_warning": "150",
"default": 60,
"visible": false,
"enabled": "prime_tower_enable"
"enabled": "prime_tower_enable",
"global_only": true
}
}
},
@ -49,7 +50,8 @@
"default": 0.4,
"type": "float",
"visible": false,
"enabled": "prime_tower_enable"
"enabled": "prime_tower_enable",
"global_only": true
}
}
}
@ -76,7 +78,8 @@
"type": "int",
"default": 0,
"min_value": "0",
"max_value": "16"
"max_value": "16",
"global_only": true
},
"support_extruder_nr": {
"label": "Support Extruder",
@ -84,7 +87,8 @@
"type": "int",
"default": 0,
"min_value": "0",
"max_value": "16"
"max_value": "16",
"global_only": true
},
"support_extruder_nr_layer_0": {
"label": "First Layer Support Extruder",
@ -93,7 +97,8 @@
"default": 0,
"min_value": "0",
"max_value": "16",
"inherit_function": "support_extruder_nr"
"inherit_function": "support_extruder_nr",
"global_only": true
},
"support_roof_extruder_nr": {
"label": "Support Roof Extruder",
@ -103,7 +108,8 @@
"min_value": "0",
"max_value": "16",
"inherit_function": "support_extruder_nr",
"enabled": "support_roof_enable"
"enabled": "support_roof_enable",
"global_only": true
}
}
},
@ -112,7 +118,8 @@
"description": "Print a tower next to the print which serves to prime the material after each nozzle switch.",
"type": "boolean",
"visible": true,
"default": false
"default": false,
"global_only": true
},
"prime_tower_size": {
"label": "Prime Tower Size",
@ -124,7 +131,8 @@
"min_value": "0",
"max_value_warning": "20",
"inherit_function": "15 if prime_tower_enable else 0",
"enabled": "prime_tower_enable"
"enabled": "prime_tower_enable",
"global_only": true
},
"prime_tower_position_x": {
"label": "Prime Tower X Position",
@ -135,7 +143,8 @@
"default": 200,
"min_value_warning": "-1000",
"max_value_warning": "1000",
"enabled": "prime_tower_enable"
"enabled": "prime_tower_enable",
"global_only": true
},
"prime_tower_position_y": {
"label": "Prime Tower Y Position",
@ -146,7 +155,8 @@
"default": 200,
"min_value_warning": "-1000",
"max_value_warning": "1000",
"enabled": "prime_tower_enable"
"enabled": "prime_tower_enable",
"global_only": true
},
"prime_tower_flow": {
"label": "Prime Tower Flow",
@ -158,20 +168,23 @@
"min_value": "5",
"min_value_warning": "50",
"max_value_warning": "150",
"enabled": "prime_tower_enable"
"enabled": "prime_tower_enable",
"global_only": true
},
"prime_tower_wipe_enabled": {
"label": "Wipe Nozzle on Prime tower",
"description": "After printing the prime tower with the one nozzle, wipe the oozed material from the other nozzle off on the prime tower.",
"type": "boolean",
"default": false,
"enabled": "prime_tower_enable"
"enabled": "prime_tower_enable",
"global_only": true
},
"ooze_shield_enabled": {
"label": "Enable Ooze Shield",
"description": "Enable exterior ooze shield. This will create a shell around the object which is likely to wipe a second nozzle if it's at the same height as the first nozzle.",
"type": "boolean",
"default": false
"default": false,
"global_only": true
},
"ooze_shield_angle": {
"label": "Ooze Shield Angle",
@ -182,7 +195,8 @@
"max_value": "90",
"default": 60,
"visible": false,
"enabled": "ooze_shield_enabled"
"enabled": "ooze_shield_enabled",
"global_only": true
},
"ooze_shield_dist": {
"label": "Ooze Shields Distance",
@ -193,7 +207,8 @@
"max_value_warning": "30",
"default": 2,
"visible": false,
"enabled": "ooze_shield_enabled"
"enabled": "ooze_shield_enabled",
"global_only": true
}
}
},
@ -220,7 +235,8 @@
"max_value_warning": "100",
"visible": false,
"inherit_function": "machine_heat_zone_length",
"enabled": "retraction_enable"
"enabled": "retraction_enable",
"global_only": true
},
"switch_extruder_retraction_speeds": {
"label": "Nozzle Switch Retraction Speed",
@ -233,6 +249,7 @@
"visible": false,
"inherit": false,
"enabled": "retraction_enable",
"global_only": true,
"children": {
"switch_extruder_retraction_speed": {
"label": "Nozzle Switch Retract Speed",
@ -243,7 +260,8 @@
"min_value": "0.1",
"max_value_warning": "300",
"visible": false,
"enabled": "retraction_enable"
"enabled": "retraction_enable",
"global_only": true
},
"switch_extruder_prime_speed": {
"label": "Nozzle Switch Prime Speed",
@ -254,7 +272,8 @@
"min_value": "0.1",
"max_value_warning": "300",
"visible": false,
"enabled": "retraction_enable"
"enabled": "retraction_enable",
"global_only": true
}
}
}

View File

@ -281,7 +281,8 @@
"max_value_warning": "5",
"default": 0.4,
"type": "float",
"visible": false
"visible": false,
"global_only": true
},
"skin_line_width": {
"label": "Top/bottom line width",
@ -315,7 +316,8 @@
"default": 0.4,
"type": "float",
"visible": false,
"enabled": "support_enable"
"enabled": "support_enable",
"global_only": true
},
"support_roof_line_width": {
"label": "Support Roof line width",
@ -326,7 +328,8 @@
"max_value_warning": "machine_nozzle_size * 2",
"type": "float",
"visible": false,
"enabled": "support_roof_enable"
"enabled": "support_roof_enable",
"global_only": true
}
}
}
@ -366,7 +369,7 @@
"min_value": "0",
"type": "int",
"visible": false,
"inherit_function": "max(1, round((wall_thickness - wall_line_width_0) / wall_line_width_x) + 1)"
"inherit_function": "1 if magic_spiralize else max(1, round((wall_thickness - wall_line_width_0) / wall_line_width_x) + 1)"
}
}
},
@ -631,7 +634,8 @@
"type": "boolean",
"default": false,
"visible": false,
"enabled": "False"
"enabled": "False",
"global_only": true
},
"material_print_temperature": {
"label": "Printing Temperature",
@ -649,7 +653,8 @@
"unit": "",
"type": "string",
"default": "[[3.5,200],[7.0,240]]",
"enabled": "material_flow_dependent_temperature"
"enabled": "material_flow_dependent_temperature",
"global_only": true
},
"material_extrusion_cool_down_speed": {
"label": "Extrusion Cool Down Speed Modifier",
@ -902,7 +907,8 @@
"max_value_warning": "150",
"visible": false,
"inherit": true,
"enabled": "support_roof_enable"
"enabled": "support_roof_enable",
"global_only": true
},
"speed_support_roof": {
"label": "Support Roof Speed",
@ -915,7 +921,8 @@
"visible": false,
"inherit": false,
"enabled": "support_roof_enable",
"inherit_function": "parent_value / 60 * 40"
"inherit_function": "parent_value / 60 * 40",
"global_only": true
}
}
}
@ -929,7 +936,8 @@
"default": 120,
"min_value": "0.1",
"max_value_warning": "300",
"inherit_function": "speed_print if magic_spiralize else 120"
"inherit_function": "speed_print if magic_spiralize else 120",
"global_only": true
},
"speed_layer_0": {
"label": "Bottom Layer Speed",
@ -950,7 +958,8 @@
"min_value": "0.1",
"max_value_warning": "300",
"visible": false,
"inherit_function": "speed_layer_0"
"inherit_function": "speed_layer_0",
"global_only": true
},
"speed_slowdown_layers": {
"label": "Number of Slower Layers",
@ -959,7 +968,8 @@
"default": 4,
"min_value": "0",
"max_value_warning": "300",
"visible": false
"visible": false,
"global_only": true
}
}
},
@ -973,7 +983,8 @@
"description": "Combing keeps the head within the interior of the print whenever possible when traveling from one part of the print to another and does not use retraction. If combing is disabled, the print head moves straight from the start point to the end point and it will always retract.",
"type": "boolean",
"default": true,
"visible": false
"visible": false,
"global_only": true
},
"travel_avoid_other_parts": {
"label": "Avoid Printed Parts",
@ -1004,7 +1015,8 @@
"description": "Coasting replaces the last part of an extrusion path with a travel path. The oozed material is used to lay down the last piece of the extrusion path in order to reduce stringing.",
"type": "boolean",
"default": false,
"visible": false
"visible": false,
"global_only": true
},
"coasting_volume": {
"label": "Coasting Volume",
@ -1016,7 +1028,8 @@
"max_value_warning": "2.0",
"visible": false,
"inherit": false,
"enabled": "coasting_enable"
"enabled": "coasting_enable",
"global_only": true
},
"coasting_min_volume": {
"label": "Minimal Volume Before Coasting",
@ -1027,7 +1040,8 @@
"min_value": "0",
"max_value_warning": "10.0",
"visible": false,
"enabled": "coasting_enable"
"enabled": "coasting_enable",
"global_only": true
},
"coasting_speed": {
"label": "Coasting Speed",
@ -1039,7 +1053,8 @@
"max_value_warning": "100",
"visible": false,
"inherit": false,
"enabled": "coasting_enable"
"enabled": "coasting_enable",
"global_only": true
}
}
},
@ -1162,7 +1177,8 @@
"label": "Enable Draft Shield",
"description": "Enable exterior draft shield. This will create a wall around the object which traps (hot) air and shields against gusts of wind. Especially useful for materials which warp easily.",
"type": "boolean",
"default": false
"default": false,
"global_only": true
},
"draft_shield_dist": {
"label": "Draft Shield X/Y Distance",
@ -1173,7 +1189,8 @@
"max_value_warning": "100",
"default": 10,
"visible": false,
"enabled": "draft_shield_enabled"
"enabled": "draft_shield_enabled",
"global_only": true
},
"draft_shield_height_limitation": {
"label": "Draft Shield Limitation",
@ -1185,7 +1202,8 @@
},
"default": "full",
"visible": false,
"enabled": "draft_shield_enabled"
"enabled": "draft_shield_enabled",
"global_only": true
},
"draft_shield_height": {
"label": "Draft Shield Height",
@ -1197,7 +1215,8 @@
"default": 0,
"inherit_function": "9999 if draft_shield_height_limitation == 'full' and draft_shield_enabled else 0.0",
"visible": false,
"enabled": "draft_shield_height_limitation == \"limited\""
"enabled": "draft_shield_height_limitation == \"limited\"",
"global_only": true
}
}
},
@ -1386,6 +1405,7 @@
"min_value": "0",
"max_value_warning": "100",
"enabled":"support_roof_enable",
"global_only": true,
"children": {
"support_roof_line_distance": {
"label": "Support Roof Line Distance",
@ -1396,7 +1416,8 @@
"min_value": "0",
"visible": false,
"inherit_function": "0 if parent_value == 0 else (support_roof_line_width * 100) / parent_value",
"enabled": "support_roof_enable"
"enabled": "support_roof_enable",
"global_only": true
}
}
},
@ -1413,7 +1434,8 @@
"zigzag": "Zig Zag"
},
"default": "concentric",
"enabled": "support_roof_enable"
"enabled": "support_roof_enable",
"global_only": true
},
"support_use_towers": {
"label": "Use towers",
@ -1473,7 +1495,8 @@
},
"default": "zigzag",
"visible": false,
"enabled": "support_enable"
"enabled": "support_enable",
"global_only": true
},
"support_connect_zigzags": {
"label": "Connect ZigZags",
@ -1481,7 +1504,8 @@
"type": "boolean",
"default": true,
"visible": false,
"enabled": "support_enable"
"enabled": "support_enable",
"global_only": true
},
"support_infill_rate": {
"label": "Fill Amount",
@ -1493,7 +1517,7 @@
"default": 15,
"visible": false,
"enabled": "support_enable",
"global_only": true,
"children": {
"support_line_distance": {
"label": "Line distance",
@ -1504,7 +1528,8 @@
"default": 2.66,
"visible": false,
"enabled": "support_enable",
"inherit_function": "(support_line_width * 100) / parent_value"
"inherit_function": "(support_line_width * 100) / parent_value",
"global_only": true
}
}
}

View File

@ -667,7 +667,7 @@ UM.MainWindow
//TODO: Support multiple file selection, workaround bug in KDE file dialog
//selectMultiple: true
nameFilters: UM.MeshFileHandler.supportedReadFileTypes;
folder: Printer.getDefaultPath()
onAccepted:
{
//Because several implementations of the file dialog only update the folder

View File

@ -351,6 +351,8 @@ QtObject {
border.width: Theme.getSize("default_lining").width;
border.color: Theme.getColor("slider_groove_border");
radius: width / 2;
Rectangle {
anchors {
left: parent.left;
@ -359,6 +361,7 @@ QtObject {
}
color: Theme.getColor("slider_groove_fill");
width: (control.value / (control.maximumValue - control.minimumValue)) * parent.width;
radius: width / 2;
}
}
handle: Rectangle {
@ -370,65 +373,6 @@ QtObject {
}
}
property Component layerViewSlider: Component {
SliderStyle {
groove: Rectangle {
id: layerSliderGroove
implicitWidth: control.width;
implicitHeight: Theme.getSize("slider_groove").height;
radius: width/2;
color: Theme.getColor("slider_groove");
border.width: Theme.getSize("default_lining").width;
border.color: Theme.getColor("slider_groove_border");
Rectangle {
anchors {
left: parent.left;
top: parent.top;
bottom: parent.bottom;
}
color: Theme.getColor("slider_groove_fill");
width: (control.value / (control.maximumValue - control.minimumValue)) * parent.width;
radius: width/2
}
}
handle: Rectangle {
id: layerSliderControl
width: Theme.getSize("slider_handle").width;
height: Theme.getSize("slider_handle").height;
color: control.hovered ? Theme.getColor("slider_handle_hover") : Theme.getColor("slider_handle");
Behavior on color { ColorAnimation { duration: 50; } }
TextField {
id: valueLabel
property string maxValue: control.maximumValue + 1
text: control.value + 1
horizontalAlignment: TextInput.AlignHCenter
onEditingFinished: {
if (valueLabel.text != ''){
control.value = valueLabel.text - 1
}
}
validator: IntValidator {bottom: 1; top: control.maximumValue + 1;}
visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false
anchors.top: layerSliderControl.bottom
anchors.topMargin: width/2 - Theme.getSize("default_margin").width/2
anchors.horizontalCenter: layerSliderControl.horizontalCenter
rotation: 90
style: TextFieldStyle{
textColor: Theme.getColor("setting_control_text");
font: Theme.getFont("default");
background: Rectangle {
implicitWidth: control.maxValue.length * valueLabel.font.pixelSize + Theme.getSize("default_margin").width
implicitHeight: Theme.getSize("slider_handle").height + Theme.getSize("default_margin").width
border.width: Theme.getSize("default_lining").width;
border.color: Theme.getColor("slider_groove_border");
}
}
}
}
}
}
property Component text_field: Component {
TextFieldStyle {
textColor: Theme.getColor("setting_control_text");