From 77b7a29fca67de1f75a33403264b1f1bd75b4a3d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 17 May 2021 17:54:13 +0200 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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)