From c2888529cbd1036ca28b0c6fc22b42d3892702ab Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 22 Mar 2018 14:35:21 +0100 Subject: [PATCH] CURA-5128 cleanup .gz and only leave .gcode.gz as Cura and Uranium now accept extensions with multiple periods --- cura/CuraApplication.py | 9 +++++++-- plugins/GCodeGzReader/GCodeGzReader.py | 2 +- plugins/GCodeGzReader/__init__.py | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 56f1528b9b..292d0bce94 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1625,8 +1625,13 @@ class CuraApplication(QtApplication): node.setName(os.path.basename(filename)) self.getBuildVolume().checkBoundsAndUpdate(node) - extension = os.path.splitext(filename)[1] - if extension.lower() in self._non_sliceable_extensions: + is_non_sliceable = False + filename_lower = filename.lower() + for extension in self._non_sliceable_extensions: + if filename_lower.endswith(extension): + is_non_sliceable = True + break + if is_non_sliceable: self.callLater(lambda: self.getController().setActiveView("SimulationView")) block_slicing_decorator = BlockSlicingDecorator() diff --git a/plugins/GCodeGzReader/GCodeGzReader.py b/plugins/GCodeGzReader/GCodeGzReader.py index df1b8439cd..52df7f074f 100644 --- a/plugins/GCodeGzReader/GCodeGzReader.py +++ b/plugins/GCodeGzReader/GCodeGzReader.py @@ -19,7 +19,7 @@ class GCodeGzReader(MeshReader): def __init__(self): super(GCodeGzReader, self).__init__() - self._supported_extensions = [".gcode.gz", ".gz"] + self._supported_extensions = [".gcode.gz"] def read(self, file_name): with open(file_name, "rb") as file: diff --git a/plugins/GCodeGzReader/__init__.py b/plugins/GCodeGzReader/__init__.py index d1f3cf34b1..67424a7d45 100644 --- a/plugins/GCodeGzReader/__init__.py +++ b/plugins/GCodeGzReader/__init__.py @@ -18,5 +18,4 @@ def getMetaData(): def register(app): app.addNonSliceableExtension(".gcode.gz") - app.addNonSliceableExtension(".gz") # in some parts only the last extension is taken. Let's make it a non sliceable extension for now return { "mesh_reader": GCodeGzReader.GCodeGzReader() }