From 22db3cb32bbfd42972cc484b4d419175e1756a30 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 19 Oct 2018 13:18:42 +0200 Subject: [PATCH 1/6] Show retraction for G92 command CURA-5769 --- plugins/GCodeReader/FlavorParser.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index 9ba1deb410..6fe2cb5260 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -195,10 +195,6 @@ class FlavorParser: self._previous_z = z elif self._previous_extrusion_value > e[self._extruder_number]: path.append([x, y, z, f, e[self._extruder_number] + self._extrusion_length_offset[self._extruder_number], LayerPolygon.MoveRetractionType]) - - # This case only for initial start, for the first coordinate in GCode - elif e[self._extruder_number] == 0 and self._previous_extrusion_value == 0: - path.append([x, y, z, f, e[self._extruder_number] + self._extrusion_length_offset[self._extruder_number], LayerPolygon.MoveRetractionType]) else: path.append([x, y, z, f, e[self._extruder_number] + self._extrusion_length_offset[self._extruder_number], LayerPolygon.MoveCombingType]) return self._position(x, y, z, f, e) @@ -235,6 +231,9 @@ class FlavorParser: # Sometimes a G92 E0 is introduced in the middle of the GCode so we need to keep those offsets for calculate the line_width self._extrusion_length_offset[self._extruder_number] += position.e[self._extruder_number] - params.e position.e[self._extruder_number] = params.e + self._previous_extrusion_value = params.e + else: + self._previous_extrusion_value = 0.0 return self._position( params.x if params.x is not None else position.x, params.y if params.y is not None else position.y, @@ -243,7 +242,6 @@ class FlavorParser: position.e) def processGCode(self, G: int, line: str, position: Position, path: List[List[Union[float, int]]]) -> Position: - self._previous_extrusion_value = 0.0 func = getattr(self, "_gCode%s" % G, None) line = line.split(";", 1)[0] # Remove comments (if any) if func is not None: @@ -295,7 +293,7 @@ class FlavorParser: self._cancelled = False # We obtain the filament diameter from the selected extruder to calculate line widths global_stack = CuraApplication.getInstance().getGlobalContainerStack() - + if not global_stack: return None @@ -338,6 +336,7 @@ class FlavorParser: min_layer_number = 0 negative_layers = 0 previous_layer = 0 + self._previous_extrusion_value = 0.0 for line in stream.split("\n"): if self._cancelled: From eea340d57a3856682a9132b53005856af54c0971 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 24 Oct 2018 15:54:14 +0200 Subject: [PATCH 2/6] Add typing --- cura/Scene/BlockSlicingDecorator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cura/Scene/BlockSlicingDecorator.py b/cura/Scene/BlockSlicingDecorator.py index 3fc0015836..0536e1635f 100644 --- a/cura/Scene/BlockSlicingDecorator.py +++ b/cura/Scene/BlockSlicingDecorator.py @@ -1,9 +1,12 @@ +# Copyright (c) 2018 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + from UM.Scene.SceneNodeDecorator import SceneNodeDecorator class BlockSlicingDecorator(SceneNodeDecorator): - def __init__(self): + def __init__(self) -> None: super().__init__() - def isBlockSlicing(self): + def isBlockSlicing(self) -> bool: return True From 9b74dfd5ec65c32823393f13798344ab37d785ae Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 24 Oct 2018 15:54:45 +0200 Subject: [PATCH 3/6] Correct typo intented -> intended --- plugins/GCodeReader/RepRapFlavorParser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/GCodeReader/RepRapFlavorParser.py b/plugins/GCodeReader/RepRapFlavorParser.py index ba1e13f23d..2a24d16add 100644 --- a/plugins/GCodeReader/RepRapFlavorParser.py +++ b/plugins/GCodeReader/RepRapFlavorParser.py @@ -1,9 +1,9 @@ -# Copyright (c) 2017 Ultimaker B.V. +# Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from . import FlavorParser -# This parser is intented for interpret the RepRap Firmware flavor +## This parser is intended to interpret the RepRap Firmware g-code flavor. class RepRapFlavorParser(FlavorParser.FlavorParser): def __init__(self): From 47f820fe6993cde697b1d9c345aa3721db565bf9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 25 Oct 2018 10:47:21 +0200 Subject: [PATCH 4/6] Don't disable entire view menu when viewing g-code Just disable the part about switching views. Yes, you can still select the view from the actual view selection drop-down in the main window. Well, it's an improvement, not a complete fix. The complete fix is deferred. --- resources/qml/Menus/ViewMenu.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ViewMenu.qml b/resources/qml/Menus/ViewMenu.qml index 9a2e603673..21e9557718 100644 --- a/resources/qml/Menus/ViewMenu.qml +++ b/resources/qml/Menus/ViewMenu.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2016 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 @@ -11,7 +11,6 @@ Menu { title: catalog.i18nc("@title:menu menubar:toplevel", "&View"); id: base - enabled: !PrintInformation.preSliced property var multiBuildPlateModel: CuraApplication.getMultiBuildPlateModel() @@ -26,6 +25,7 @@ Menu checked: model.active exclusiveGroup: group onTriggered: UM.Controller.setActiveView(model.id) + enabled: !PrintInformation.preSliced } onObjectAdded: base.insertItem(index, object) onObjectRemoved: base.removeItem(object) From 1a6766019685b3dd0aa647143941e207f68ab2ac Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 25 Oct 2018 10:54:59 +0200 Subject: [PATCH 5/6] Hotfix: Show printer selection --- plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml index a28167d260..c2590e99a8 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml @@ -8,9 +8,6 @@ import UM 1.1 as UM UM.Dialog { id: base; - property var printersModel: { - return ListModel{}; - } height: minimumHeight; leftButtons: [ Button { @@ -87,7 +84,9 @@ UM.Dialog { id: printerSelectionCombobox; Behavior on height { NumberAnimation { duration: 100 } } height: 40 * screenScaleFactor; - model: base.printersModel; + model: ListModel { + id: printersModel; + } textRole: "name"; width: parent.width; } From ebbb7ad88f582d2c7423d235943310d5184a1ab9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 25 Oct 2018 10:55:10 +0200 Subject: [PATCH 6/6] Code style --- resources/qml/Menus/ViewMenu.qml | 42 +++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/resources/qml/Menus/ViewMenu.qml b/resources/qml/Menus/ViewMenu.qml index 21e9557718..12d4ffd7dd 100644 --- a/resources/qml/Menus/ViewMenu.qml +++ b/resources/qml/Menus/ViewMenu.qml @@ -9,7 +9,7 @@ import Cura 1.0 as Cura Menu { - title: catalog.i18nc("@title:menu menubar:toplevel", "&View"); + title: catalog.i18nc("@title:menu menubar:toplevel", "&View") id: base property var multiBuildPlateModel: CuraApplication.getMultiBuildPlateModel() @@ -30,7 +30,10 @@ Menu onObjectAdded: base.insertItem(index, object) onObjectRemoved: base.removeItem(object) } - ExclusiveGroup { id: group } + ExclusiveGroup + { + id: group + } MenuSeparator {} @@ -44,36 +47,47 @@ Menu MenuItem { action: Cura.Actions.viewRightSideCamera; } } - MenuSeparator { + MenuSeparator + { visible: UM.Preferences.getValue("cura/use_multi_build_plate") } Menu { id: buildPlateMenu; - title: catalog.i18nc("@action:inmenu menubar:view","&Build plate"); + title: catalog.i18nc("@action:inmenu menubar:view","&Build plate") visible: UM.Preferences.getValue("cura/use_multi_build_plate") Instantiator { model: base.multiBuildPlateModel - MenuItem { + MenuItem + { text: base.multiBuildPlateModel.getItem(index).name; - onTriggered: Cura.SceneController.setActiveBuildPlate(base.multiBuildPlateModel.getItem(index).buildPlateNumber); - checkable: true; - checked: base.multiBuildPlateModel.getItem(index).buildPlateNumber == base.multiBuildPlateModel.activeBuildPlate; - exclusiveGroup: buildPlateGroup; + onTriggered: Cura.SceneController.setActiveBuildPlate(base.multiBuildPlateModel.getItem(index).buildPlateNumber) + checkable: true + checked: base.multiBuildPlateModel.getItem(index).buildPlateNumber == base.multiBuildPlateModel.activeBuildPlate + exclusiveGroup: buildPlateGroup visible: UM.Preferences.getValue("cura/use_multi_build_plate") } - onObjectAdded: buildPlateMenu.insertItem(index, object); + onObjectAdded: buildPlateMenu.insertItem(index, object) onObjectRemoved: buildPlateMenu.removeItem(object) } - ExclusiveGroup { id: buildPlateGroup; } + ExclusiveGroup + { + id: buildPlateGroup + } } MenuSeparator {} - MenuItem { action: Cura.Actions.expandSidebar; } - + MenuItem + { + action: Cura.Actions.expandSidebar + } + MenuSeparator {} - MenuItem { action: Cura.Actions.toggleFullScreen; } + MenuItem + { + action: Cura.Actions.toggleFullScreen + } }