From e3681ddd9fdf748f6ba7ff951180542424f72513 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Sep 2018 13:27:13 +0200 Subject: [PATCH] Also hack the way to get the generic materials, since the tag-filtered calls to the api don't work yet. Contributes to CURA-5670. --- plugins/Toolbox/src/Toolbox.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index a4dcc47c2b..cc9f8ac354 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -231,10 +231,12 @@ class Toolbox(QObject, Extension): # Make remote requests: self._makeRequestByType("packages") self._makeRequestByType("authors") - self._makeRequestByType("plugins_showcase") - self._makeRequestByType("materials_showcase") - self._makeRequestByType("materials_available") - self._makeRequestByType("materials_generic") + # TODO: Uncomment in the future when the tag-filtered api calls work in the cloud server + # self._makeRequestByType("plugins_showcase") + # self._makeRequestByType("plugins_available") + # self._makeRequestByType("materials_showcase") + # self._makeRequestByType("materials_available") + # self._makeRequestByType("materials_generic") # Gather installed packages: self._updateInstalledModels() @@ -614,6 +616,7 @@ class Toolbox(QObject, Extension): do_not_handle = [ "materials_available", "materials_showcase", + "materials_generic", "plugins_available", "plugins_showcase", ] @@ -826,15 +829,20 @@ class Toolbox(QObject, Extension): if author["author_id"] in processed_authors: continue - if "showcase" in item["tags"]: - self._metadata["materials_showcase"].append(author) + # Generic materials to be in the same section + if "generic" in item["tags"]: + self._metadata["materials_generic"].append(item) else: - self._metadata["materials_available"].append(author) + if "showcase" in item["tags"]: + self._metadata["materials_showcase"].append(author) + else: + self._metadata["materials_available"].append(author) - processed_authors.append(author["author_id"]) + processed_authors.append(author["author_id"]) self._models["materials_showcase"].setMetadata(self._metadata["materials_showcase"]) self._models["materials_available"].setMetadata(self._metadata["materials_available"]) + self._models["materials_generic"].setMetadata(self._metadata["materials_generic"]) def buildPluginsModels(self) -> None: self._metadata["plugins_showcase"] = []