diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 8e93b1b7ad..cf6284bf86 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -598,6 +598,9 @@ class CuraApplication(QtApplication): continue if node.callDecoration("shouldBlockSlicing"): should_pause = True + gcode_list = node.callDecoration("gCodeList") + if gcode_list is not None: + self.getController().getScene().gcode_list = gcode_list count += 1 if not scene_bounding_box: diff --git a/cura/GCodeListDecorator.py b/cura/GCodeListDecorator.py new file mode 100644 index 0000000000..9c103db84f --- /dev/null +++ b/cura/GCodeListDecorator.py @@ -0,0 +1,13 @@ +from UM.Scene.SceneNodeDecorator import SceneNodeDecorator + + +class GCodeListDecorator(SceneNodeDecorator): + def __init__(self): + super().__init__() + self._gcode_list = [] + + def gCodeList(self): + return self._gcode_list + + def setGCodeList(self, list): + self._gcode_list = list diff --git a/plugins/GCodeReader/GCodeReader.py b/plugins/GCodeReader/GCodeReader.py index 22a2463724..4ca0be0000 100644 --- a/plugins/GCodeReader/GCodeReader.py +++ b/plugins/GCodeReader/GCodeReader.py @@ -16,7 +16,7 @@ catalog = i18nCatalog("cura") from cura import LayerDataBuilder from cura import LayerDataDecorator from cura.LayerPolygon import LayerPolygon -from cura.SliceableObjectDecorator import SliceableObjectDecorator +from cura.GCodeListDecorator import GCodeListDecorator import numpy import math @@ -203,6 +203,7 @@ class GCodeReader(MeshReader): current_line = 0 for line in file: file_lines += 1 + glist.append(line) file.seek(0) file_step = max(math.floor(file_lines / 100), 1) @@ -260,7 +261,10 @@ class GCodeReader(MeshReader): decorator = LayerDataDecorator.LayerDataDecorator() decorator.setLayerData(layer_mesh) scene_node.addDecorator(decorator) - Application.getInstance().getController().getScene().gcode_list = glist + + gcode_list_decorator = GCodeListDecorator() + gcode_list_decorator.setGCodeList(glist) + scene_node.addDecorator(gcode_list_decorator) Logger.log("d", "Finished parsing %s" % file_name) self._message.hide() diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 843ac19837..323123e9a7 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -106,7 +106,7 @@ Rectangle { id: saveToButton tooltip: UM.OutputDeviceManager.activeDeviceDescription; - enabled: base.backendState == 3 && base.activity == true + enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true height: UM.Theme.getSize("save_button_save_to_button").height anchors.top: parent.top @@ -181,7 +181,7 @@ Rectangle { anchors.rightMargin: UM.Theme.getSize("default_margin").width width: UM.Theme.getSize("save_button_save_to_button").height height: UM.Theme.getSize("save_button_save_to_button").height - enabled: base.backendState == 3 && base.activity == true + enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true visible: devicesModel.deviceCount > 1