diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index cf085bfe61..1556ee8d22 100644 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -33,6 +33,7 @@ class BuildVolume(SceneNode): self.setCalculateBoundingBox(False) + def setWidth(self, width): self._width = width diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 80c9acba76..3beafb9284 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -74,6 +74,7 @@ class CuraApplication(QtApplication): self._print_information = None self._i18n_catalog = None self._previous_active_tool = None + self._platform_activity = False self.activeMachineChanged.connect(self._onActiveMachineChanged) @@ -216,6 +217,31 @@ class CuraApplication(QtApplication): self._previous_active_tool = None requestAddPrinter = pyqtSignal() + activityChanged = pyqtSignal() + + @pyqtProperty(bool, notify = activityChanged) + def getPlatformActivity(self): + return self._platform_activity + + @pyqtSlot(bool) + def setPlatformActivity(self, activity): + ##Sets the _platform_activity variable on true or false depending on whether there is a mesh on the platform + if activity == True: + self._platform_activity = activity + elif activity == False: + nodes = [] + for node in DepthFirstIterator(self.getController().getScene().getRoot()): + if type(node) is not SceneNode or not node.getMeshData(): + continue + nodes.append(node) + i = 0 + for node in nodes: + if not node.getMeshData(): + continue + i += 1 + if i <= 1: ## i == 0 when the meshes are removed using the deleteAll function; i == 1 when the last remaining mesh is removed using the deleteObject function + self._platform_activity = activity + self.activityChanged.emit() ## Remove an object from the scene @pyqtSlot("quint64") @@ -228,6 +254,7 @@ class CuraApplication(QtApplication): if object: op = RemoveSceneNodeOperation(object) op.push() + self.setPlatformActivity(False) ## Create a number of copies of existing object. @pyqtSlot("quint64", int) @@ -268,7 +295,6 @@ class CuraApplication(QtApplication): if type(node) is not SceneNode or not node.getMeshData(): continue nodes.append(node) - if nodes: op = GroupedOperation() @@ -276,6 +302,7 @@ class CuraApplication(QtApplication): op.addOperation(RemoveSceneNodeOperation(node)) op.push() + self.setPlatformActivity(False) ## Reset all translation on nodes with mesh data. @pyqtSlot() @@ -523,7 +550,7 @@ class CuraApplication(QtApplication): op.push() def _onJobFinished(self, job): - if type(job) is not ReadMeshJob: + if type(job) is not ReadMeshJob or not job.getResult(): return f = QUrl.fromLocalFile(job.getFileName()) diff --git a/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py b/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py index 6930d9da71..89c5fc5e23 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py @@ -22,15 +22,15 @@ class ProcessSlicedObjectListJob(Job): super().__init__() self._message = message self._scene = Application.getInstance().getController().getScene() - self._progress = None - Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged) def run(self): if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView": self._progress = Message(catalog.i18nc("Layers View mode", "Layers"), 0, False, 0) self._progress.show() + Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged) + objectIdMap = {} new_node = SceneNode() ## Put all nodes in a dict identified by ID diff --git a/plugins/USBPrinting/PrinterConnection.py b/plugins/USBPrinting/PrinterConnection.py index 5c0030959c..b26a7bf4f4 100644 --- a/plugins/USBPrinting/PrinterConnection.py +++ b/plugins/USBPrinting/PrinterConnection.py @@ -469,7 +469,7 @@ class PrinterConnection(SignalEmitter): # Turn of temperatures self._sendCommand("M140 S0") - self._sendCommand("M109 S0") + self._sendCommand("M104 S0") self._is_printing = False ## Check if the process did not encounter an error yet. diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 226f4f59a9..f8e80367eb 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -41,7 +41,10 @@ UM.MainWindow { var path = modelData.toString() return (index + 1) + ". " + path.slice(path.lastIndexOf("/") + 1); } - onTriggered: UM.MeshFileHandler.readLocalFile(modelData); + onTriggered: { + UM.MeshFileHandler.readLocalFile(modelData); + Printer.setPlatformActivity(true) + } } onObjectAdded: fileMenu.insertItem(index, object) onObjectRemoved: fileMenu.removeItem(object) @@ -318,7 +321,11 @@ UM.MainWindow { redo.onTriggered: UM.OperationStack.redo(); redo.enabled: UM.OperationStack.canRedo; - deleteSelection.onTriggered: UM.Controller.removeSelection(); + deleteSelection.onTriggered: { + if(objectContextMenu.objectId != 0) { + Printer.deleteObject(objectContextMenu.objectId); + } + } deleteObject.onTriggered: { if(objectContextMenu.objectId != 0) { @@ -408,6 +415,7 @@ UM.MainWindow { onAccepted: { UM.MeshFileHandler.readLocalFile(fileUrl) + Printer.setPlatformActivity(true) } } diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 4708995308..004b523336 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -14,6 +14,7 @@ Rectangle { property Action saveAction; property real progress: UM.Backend.progress; + property bool activity: Printer.getPlatformActivity; Behavior on progress { NumberAnimation { duration: 250; } } property string currentDevice: "local_file" @@ -76,7 +77,7 @@ Rectangle { color: UM.Theme.colors.save_button_estimated_text; font: UM.Theme.fonts.small; text: - if(base.progress < 0) { + if(base.activity == false) { //: Save button label return qsTr("Please load a 3D model"); } else if (base.progress < 0.99) { @@ -97,7 +98,7 @@ Rectangle { anchors.leftMargin: UM.Theme.sizes.save_button_text_margin.width; color: UM.Theme.colors.save_button_printtime_text; font: UM.Theme.fonts.small; - visible: base.progress < 0.99 ? false : true + visible: base.activity == false || base.progress < 0.99 ? false : true text: (!base.printDuration || !base.printDuration.valid) ? "" : base.printDuration.getDisplayString(UM.DurationFormat.Long); } Label { @@ -107,11 +108,10 @@ Rectangle { anchors.leftMargin: UM.Theme.sizes.save_button_text_margin.width; color: base.printDuration.days > 0 ? UM.Theme.colors.save_button_estimated_text : UM.Theme.colors.save_button_printtime_text; font: UM.Theme.fonts.small; - property bool mediumLengthDuration: base.printDuration.hours > 9 && base.printMaterialAmount > 9.99 && base.printDuration.days == 0 width: mediumLengthDuration ? 50 : undefined elide: mediumLengthDuration ? Text.ElideRight : Text.ElideNone - visible: base.progress < 0.99 ? false : true + visible: base.activity == false || base.progress < 0.99 ? false : true //: Print material amount save button label text: base.printMaterialAmount < 0 ? "" : qsTr("%1m material").arg(base.printMaterialAmount); } @@ -125,7 +125,7 @@ Rectangle { } width: Math.max(infoBox.width * base.progress); color: UM.Theme.colors.save_button_active - visible: base.progress > 0.99 ? false : true + visible: progress > 0.99 ? false : true } Button { @@ -135,7 +135,7 @@ Rectangle { anchors.left: parent.left anchors.leftMargin: UM.Theme.sizes.default_margin.width; tooltip: '' - enabled: progress >= 0.99; + enabled: progress > 0.99 && base.activity == true width: infoBox.width/6*4.5 height: UM.Theme.sizes.save_button_save_to_button.height diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index e40552cd32..e7794746f5 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -389,7 +389,7 @@ QtObject { } Label { id: maxValueLabel - visible: UM.LayerView.getLayerActivity ? true : false + visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false text: control.maximumValue + 1 font: control.maximumValue > 998 ? UM.Theme.fonts.small : UM.Theme.fonts.default transformOrigin: Item.BottomLeft @@ -399,7 +399,7 @@ QtObject { } Label { id: minValueLabel - visible: UM.LayerView.getLayerActivity ? true : false + visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false text: '1' font: control.maximumValue > 998 ? UM.Theme.fonts.small : UM.Theme.fonts.default transformOrigin: Item.BottomLeft @@ -416,7 +416,7 @@ QtObject { Behavior on color { ColorAnimation { duration: 50; } } Label { id: valueLabel - visible: UM.LayerView.getLayerActivity ? true : false + visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false text: control.value + 1 anchors.bottom: layerSliderControl.bottom anchors.right: layerSliderControl.left