From 2a304ce90ae85af9b117d761b6130de671441166 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 17 May 2021 14:12:46 +0200 Subject: [PATCH 1/8] Filter images from DF open screen CURA-8233 --- .../DigitalLibrary/src/DigitalFactoryController.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/DigitalLibrary/src/DigitalFactoryController.py b/plugins/DigitalLibrary/src/DigitalFactoryController.py index 8f65faa2a3..e41f7a6d06 100644 --- a/plugins/DigitalLibrary/src/DigitalFactoryController.py +++ b/plugins/DigitalLibrary/src/DigitalFactoryController.py @@ -385,6 +385,20 @@ class DigitalFactoryController(QObject): def _applicationInitializationFinished(self) -> None: self._supported_file_types = self._application.getInstance().getMeshFileHandler().getSupportedFileTypesRead() + # Although cura supports these, it's super confusing in this context to show them. + if "jpg" in self._supported_file_types: + del self._supported_file_types["jpg"] + if "jpeg" in self._supported_file_types: + del self._supported_file_types["jpeg"] + if "png" in self._supported_file_types: + del self._supported_file_types["png"] + if "bmp" in self._supported_file_types: + del self._supported_file_types["bmp"] + if "gif" in self._supported_file_types: + del self._supported_file_types["gif"] + + print("***", self._supported_file_types) + @pyqtSlot() def openSelectedFiles(self) -> None: """ Downloads, then opens all files selected in the Qt frontend open dialog. From 3018485077ae7480c6acbe1091bd338dbac0fafd Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 17 May 2021 15:24:46 +0200 Subject: [PATCH 2/8] Remove stray debug code CURA-8233 Co-authored-by: Konstantinos Karmas --- plugins/DigitalLibrary/src/DigitalFactoryController.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/DigitalLibrary/src/DigitalFactoryController.py b/plugins/DigitalLibrary/src/DigitalFactoryController.py index e41f7a6d06..8582d4b5b9 100644 --- a/plugins/DigitalLibrary/src/DigitalFactoryController.py +++ b/plugins/DigitalLibrary/src/DigitalFactoryController.py @@ -397,7 +397,6 @@ class DigitalFactoryController(QObject): if "gif" in self._supported_file_types: del self._supported_file_types["gif"] - print("***", self._supported_file_types) @pyqtSlot() def openSelectedFiles(self) -> None: From 77b7a29fca67de1f75a33403264b1f1bd75b4a3d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 17 May 2021 17:54:13 +0200 Subject: [PATCH 3/8] Add source file type to anonymous usage statistics Contributes to issue CURA-8232. --- plugins/SliceInfoPlugin/SliceInfo.py | 5 +++++ plugins/SliceInfoPlugin/example_data.html | 1 + 2 files changed, 6 insertions(+) diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 6eed649cc7..977b9b809b 100755 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -229,6 +229,11 @@ class SliceInfo(QObject, Extension): model["model_settings"] = model_settings + if node.source_mime_type is None: + model["mime_type"] = "" + else: + model["mime_type"] = node.source_mime_type + data["models"].append(model) print_times = print_information.printTimes() diff --git a/plugins/SliceInfoPlugin/example_data.html b/plugins/SliceInfoPlugin/example_data.html index b349ec328d..5b97f1cba6 100644 --- a/plugins/SliceInfoPlugin/example_data.html +++ b/plugins/SliceInfoPlugin/example_data.html @@ -54,6 +54,7 @@
  • Bounding Box: [minimum x, y, z; maximum x, y, z]
  • Is Helper Mesh: no
  • Helper Mesh Type: support mesh
  • +
  • File type: STL
  • From d4fa1cee4587bae9268f0886f06d98d92fb3579f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 May 2021 11:07:02 +0200 Subject: [PATCH 4/8] Fix copying MIME type if scene nodes are copied We're not doing this in the nicest way possible... Contributes to issue CURA-8232. --- cura/CuraApplication.py | 1 + cura/Scene/CuraSceneNode.py | 1 + 2 files changed, 2 insertions(+) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 146da4a47c..1ff7932abb 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1867,6 +1867,7 @@ class CuraApplication(QtApplication): else: node = CuraSceneNode() node.setMeshData(original_node.getMeshData()) + node.source_mime_type = original_node.source_mime_type # Setting meshdata does not apply scaling. if original_node.getScale() != Vector(1.0, 1.0, 1.0): diff --git a/cura/Scene/CuraSceneNode.py b/cura/Scene/CuraSceneNode.py index 93a1511681..b299934278 100644 --- a/cura/Scene/CuraSceneNode.py +++ b/cura/Scene/CuraSceneNode.py @@ -142,6 +142,7 @@ class CuraSceneNode(SceneNode): copy.setTransformation(self.getLocalTransformation(copy= False)) copy.setMeshData(self._mesh_data) copy.setVisible(cast(bool, deepcopy(self._visible, memo))) + copy.source_mime_type = cast(str, deepcopy(self.source_mime_type, memo)) copy._selectable = cast(bool, deepcopy(self._selectable, memo)) copy._name = cast(str, deepcopy(self._name, memo)) for decorator in self._decorators: From 9e136eb499b4b1767d3d645b4242f7a1cf8494d4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 May 2021 11:08:06 +0200 Subject: [PATCH 5/8] Serialise MIME type name rather than entire MIME type So we don't get the bracket syntax from its repr, just the MIME type itself. Contributes to issue CURA-8232. --- plugins/SliceInfoPlugin/SliceInfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 977b9b809b..5ead422d0a 100755 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -232,7 +232,7 @@ class SliceInfo(QObject, Extension): if node.source_mime_type is None: model["mime_type"] = "" else: - model["mime_type"] = node.source_mime_type + model["mime_type"] = node.source_mime_type.name data["models"].append(model) From 45f8f3ba3c57be402cf53f6c6eda657423dc54ec Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 18 May 2021 15:52:06 +0200 Subject: [PATCH 6/8] Remove some code duplication in DF image filtering CURA-8233 --- .../src/DigitalFactoryController.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/plugins/DigitalLibrary/src/DigitalFactoryController.py b/plugins/DigitalLibrary/src/DigitalFactoryController.py index 8582d4b5b9..352a8c70f2 100644 --- a/plugins/DigitalLibrary/src/DigitalFactoryController.py +++ b/plugins/DigitalLibrary/src/DigitalFactoryController.py @@ -385,18 +385,10 @@ class DigitalFactoryController(QObject): def _applicationInitializationFinished(self) -> None: self._supported_file_types = self._application.getInstance().getMeshFileHandler().getSupportedFileTypesRead() - # Although cura supports these, it's super confusing in this context to show them. - if "jpg" in self._supported_file_types: - del self._supported_file_types["jpg"] - if "jpeg" in self._supported_file_types: - del self._supported_file_types["jpeg"] - if "png" in self._supported_file_types: - del self._supported_file_types["png"] - if "bmp" in self._supported_file_types: - del self._supported_file_types["bmp"] - if "gif" in self._supported_file_types: - del self._supported_file_types["gif"] - + # Although Cura supports these, it's super confusing in this context to show them. + for extension in ["jpg", "jpeg", "png", "bmp", "gif"]: + if extension in self._supported_file_types: + del self._supported_file_types[extension] @pyqtSlot() def openSelectedFiles(self) -> None: From 21baf90ec87cadf605b1433e6e024460a0161d6b Mon Sep 17 00:00:00 2001 From: Humsie Date: Fri, 21 May 2021 17:02:53 +0200 Subject: [PATCH 7/8] Add Z Position parameter to FilamentChange (#9658) * Add Z Position * PR Comment: Add minimum value for z_position Co-authored-by: Konstantinos Karmas --- .../scripts/FilamentChange.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/FilamentChange.py b/plugins/PostProcessingPlugin/scripts/FilamentChange.py index 5e984a2cd1..17ff045b8d 100644 --- a/plugins/PostProcessingPlugin/scripts/FilamentChange.py +++ b/plugins/PostProcessingPlugin/scripts/FilamentChange.py @@ -72,6 +72,15 @@ class FilamentChange(Script): "type": "float", "default_value": 0, "enabled": "not firmware_config" + }, + "z_position": + { + "label": "Z Position (relative)", + "description": "Extruder relative Z position. Move the print head up for filament change.", + "unit": "mm", + "type": "float", + "default_value": 0, + "minimum_value": 0 } } }""" @@ -87,6 +96,7 @@ class FilamentChange(Script): later_retract = self.getSettingValueByKey("later_retract") x_pos = self.getSettingValueByKey("x_position") y_pos = self.getSettingValueByKey("y_position") + z_pos = self.getSettingValueByKey("z_position") firmware_config = self.getSettingValueByKey("firmware_config") color_change = "M600" @@ -100,10 +110,13 @@ class FilamentChange(Script): if x_pos is not None: color_change = color_change + (" X%.2f" % x_pos) - + if y_pos is not None: color_change = color_change + (" Y%.2f" % y_pos) + if z_pos is not None and z_pos > 0.: + color_change = color_change + (" Z%.2f" % z_pos) + color_change = color_change + " ; Generated by FilamentChange plugin\n" layer_targets = layer_nums.split(",") @@ -116,4 +129,4 @@ class FilamentChange(Script): if 0 < layer_num < len(data): data[layer_num] = color_change + data[layer_num] - return data \ No newline at end of file + return data From be06108f36e3d08974e4b652ef64317e91cfb64f Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 24 May 2021 18:42:17 +0200 Subject: [PATCH 8/8] Fix an crash when starting Cura without a network connection --- cura/OAuth2/AuthorizationService.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cura/OAuth2/AuthorizationService.py b/cura/OAuth2/AuthorizationService.py index da654b52bb..96091f9c11 100644 --- a/cura/OAuth2/AuthorizationService.py +++ b/cura/OAuth2/AuthorizationService.py @@ -113,8 +113,10 @@ class AuthorizationService: # The token could not be refreshed using the refresh token. We should login again. return None # Ensure it gets stored as otherwise we only have it in memory. The stored refresh token has been deleted - # from the server already. - self._storeAuthData(self._auth_data) + # from the server already. Do not store the auth_data if we could not get new auth_data (eg due to a + # network error), since this would cause an infinite loop trying to get new auth-data + if self._auth_data.success: + self._storeAuthData(self._auth_data) return self._auth_helpers.parseJWT(self._auth_data.access_token) def getAccessToken(self) -> Optional[str]: