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/3] 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/3] 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 45f8f3ba3c57be402cf53f6c6eda657423dc54ec Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 18 May 2021 15:52:06 +0200 Subject: [PATCH 3/3] 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: