From 90fda4cb3d6ea9ef28d422dec0dd68bcce31e6dd Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 2 Mar 2016 21:18:16 +0100 Subject: [PATCH 1/6] Remove defaults section from current settings before adding it to a gcode file. Contributes to CURA-936 --- plugins/GCodeWriter/GCodeWriter.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/GCodeWriter/GCodeWriter.py b/plugins/GCodeWriter/GCodeWriter.py index 28677074cf..0a76a51742 100644 --- a/plugins/GCodeWriter/GCodeWriter.py +++ b/plugins/GCodeWriter/GCodeWriter.py @@ -6,6 +6,7 @@ from UM.Logger import Logger from UM.Application import Application import io import re #For escaping characters in the settings. +import copy class GCodeWriter(MeshWriter): @@ -56,17 +57,18 @@ class GCodeWriter(MeshWriter): def _serialiseProfile(self, profile): prefix = ";SETTING_" + str(GCodeWriter.version) + " " #The prefix to put before each line. prefix_length = len(prefix) - - serialised = profile.serialise() - + + #Serialise a deepcopy to remove the defaults from the profile + serialised = copy.deepcopy(profile).serialise() + #Escape characters that have a special meaning in g-code comments. pattern = re.compile("|".join(GCodeWriter.escape_characters.keys())) serialised = pattern.sub(lambda m: GCodeWriter.escape_characters[re.escape(m.group(0))], serialised) #Perform the replacement with a regular expression. - + #Introduce line breaks so that each comment is no longer than 80 characters. Prepend each line with the prefix. result = "" for pos in range(0, len(serialised), 80 - prefix_length): #Lines have 80 characters, so the payload of each line is 80 - prefix. result += prefix + serialised[pos : pos + 80 - prefix_length] + "\n" serialised = result - + return serialised \ No newline at end of file From bc24a3c95b509534b5b47471445b87b38a061a44 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 2 Mar 2016 22:39:15 +0100 Subject: [PATCH 2/6] Add sensible maximum length to machine name and job name entry --- resources/qml/JobSpecs.qml | 8 ++++---- resources/qml/WizardPages/AddMachine.qml | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index bf3968329c..041ad160e2 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -25,7 +25,6 @@ Rectangle { property variant printDuration: PrintInformation.currentPrintTime; property real printMaterialAmount: PrintInformation.materialAmount; - width: UM.Theme.getSize("jobspecs").width height: childrenRect.height color: "transparent" @@ -119,19 +118,20 @@ Rectangle { } } - TextField + TextField { id: printJobTextfield anchors.right: printJobPencilIcon.left anchors.rightMargin: UM.Theme.getSize("default_margin").width/2 height: UM.Theme.getSize("jobspecs_line").height - width: base.width + width: __contentWidth + UM.Theme.getSize("default_margin").width + maximumLength: 120 property int unremovableSpacing: 5 text: '' horizontalAlignment: TextInput.AlignRight onTextChanged: { if(text != ''){ - //this prevent that is sets an empty string as jobname + //Prevent that jobname is set to an empty string Printer.setJobName(text) } } diff --git a/resources/qml/WizardPages/AddMachine.qml b/resources/qml/WizardPages/AddMachine.qml index d42a5675db..5a6a27c0a3 100644 --- a/resources/qml/WizardPages/AddMachine.qml +++ b/resources/qml/WizardPages/AddMachine.qml @@ -212,6 +212,7 @@ Item id: machineName; text: getMachineName() implicitWidth: UM.Theme.getSize("standard_list_input").width + maximumLength: 120 } } From 5cb1e9e2a6301ff1f34e6b97699ebd6093189391 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 3 Mar 2016 09:00:52 +0100 Subject: [PATCH 3/6] Tweak layer slider appearance --- plugins/LayerView/LayerView.qml | 12 ++++++------ resources/themes/cura/styles.qml | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/LayerView/LayerView.qml b/plugins/LayerView/LayerView.qml index e8af832267..e1fc398da5 100644 --- a/plugins/LayerView/LayerView.qml +++ b/plugins/LayerView/LayerView.qml @@ -8,12 +8,12 @@ import QtQuick.Controls.Styles 1.1 import UM 1.0 as UM -Item +Item { width: UM.Theme.getSize("button").width height: UM.Theme.getSize("slider_layerview_size").height - Slider + Slider { id: slider width: UM.Theme.getSize("slider_layerview_size").width @@ -34,11 +34,11 @@ Item Rectangle { - x: parent.width + UM.Theme.getSize("default_margin").width; + x: parent.width + UM.Theme.getSize("slider_layerview_background").width / 2; 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 + width: valueLabel.width + UM.Theme.getSize("default_margin").width Behavior on height { NumberAnimation { duration: 50; } } border.width: UM.Theme.getSize("default_lining").width; @@ -78,8 +78,8 @@ Item BusyIndicator { id: busyIndicator; - anchors.right: parent.right; - anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2; + anchors.left: parent.right; + anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2; anchors.verticalCenter: parent.verticalCenter; width: UM.Theme.getSize("slider_handle").height; diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index 60677870bc..1d0b385fc2 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -368,6 +368,7 @@ QtObject { width: Theme.getSize("slider_handle").width; height: Theme.getSize("slider_handle").height; color: control.hovered ? Theme.getColor("slider_handle_hover") : Theme.getColor("slider_handle"); + radius: Theme.getSize("slider_handle").width/2; Behavior on color { ColorAnimation { duration: 50; } } } } From f6fc5fea06d080cd945aa00ae3ca3d5782e00eb4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 3 Mar 2016 11:31:26 +0100 Subject: [PATCH 4/6] Fix slicing not interrupting first layer processing job The layer processing job that was triggered by switching to layer view was not stored in the field. The field is where the start of slicing looks for jobs to abort. Contributes to issue CURA-864. --- plugins/CuraEngineBackend/CuraEngineBackend.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index b7f45cd6f3..7f7b992404 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -274,8 +274,8 @@ class CuraEngineBackend(Backend): # There is data and we're not slicing at the moment # if we are slicing, there is no need to re-calculate the data as it will be invalid in a moment. if self._stored_layer_data and not self._slicing: - job = ProcessSlicedObjectListJob.ProcessSlicedObjectListJob(self._stored_layer_data) - job.start() + self._process_layers_job = ProcessSlicedObjectListJob.ProcessSlicedObjectListJob(self._stored_layer_data) + self._process_layers_job.start() self._stored_layer_data = None else: self._layer_view_active = False From c4c5ba6c2288f25b6e9ca6a578ff1f48ae4f76a4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 3 Mar 2016 11:36:28 +0100 Subject: [PATCH 5/6] Top layers are now correctly updated when object is selected CURA-992 --- plugins/LayerView/LayerView.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/LayerView/LayerView.py b/plugins/LayerView/LayerView.py index 385936391c..9f65a8e783 100644 --- a/plugins/LayerView/LayerView.py +++ b/plugins/LayerView/LayerView.py @@ -225,8 +225,8 @@ class _CreateTopLayersJob(Job): layer_data = None for node in DepthFirstIterator(self._scene.getRoot()): layer_data = node.callDecoration("getLayerData") - if not layer_data: - continue + if layer_data: + break if self._cancel or not layer_data: return From 66a9c6304853fb59939901041ca1472505270bf5 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 3 Mar 2016 11:52:56 +0100 Subject: [PATCH 6/6] Add not using numpy.insert explanation to ProcessSlicedObjectJob Contributes to CURA-708 --- plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py b/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py index 25530c52c2..df2e5966e9 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py @@ -95,6 +95,8 @@ class ProcessSlicedObjectListJob(Job): points = points.reshape((-1,2)) # We get a linear list of pairs that make up the points, so make numpy interpret them correctly. # Create a new 3D-array, copy the 2D points over and insert the right height. + # This uses manual array creation + copy rather than numpy.insert since this is + # faster. new_points = numpy.empty((len(points), 3), numpy.float32) new_points[:,0] = points[:,0] new_points[:,1] = layer.height