diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailList.qml b/plugins/Toolbox/resources/qml/ToolboxDetailList.qml index 8ac8cee4d0..c49e3cb416 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailList.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailList.qml @@ -23,9 +23,7 @@ Item bottomMargin: UM.Theme.getSize("wide_margin").height top: parent.top } - // TODO: Sometimes the height is not the childrenRect.height. Lord - // knows why. Probably because QT is garbage. - height: childrenRect.height + height: childrenRect.height + UM.Theme.getSize("wide_margin").height spacing: UM.Theme.getSize("default_margin").height Repeater { diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml b/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml index 5071f8ed81..768f382082 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml @@ -189,11 +189,12 @@ Item Item { + id: supportedConfigsChart anchors.top: normalData.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height - height: model.type == "material" ? childrenRect.height : 0 + height: visible ? childrenRect.height : 0 width: normalData.width - visible: model.type == "material" + visible: model.type == "material" && model.supported_configs.length > 0 Label { id: compatibilityHeading diff --git a/plugins/Toolbox/src/AuthorsModel.py b/plugins/Toolbox/src/AuthorsModel.py index 2dfba8fb23..880ecbe2a0 100644 --- a/plugins/Toolbox/src/AuthorsModel.py +++ b/plugins/Toolbox/src/AuthorsModel.py @@ -41,7 +41,7 @@ class AuthorsModel(ListModel): "email": author["email"] if "email" in author else None, "website": author["website"], "package_count": author["package_count"] if "package_count" in author else 0, - "package_types": author["package_types"], + "package_types": author["package_types"] if "package_types" in author else [], "icon_url": author["icon_url"] if "icon_url" in author else None, "description": "Material and quality profiles from {author_name}".format( author_name = author["display_name"]) }) diff --git a/plugins/Toolbox/src/PackagesModel.py b/plugins/Toolbox/src/PackagesModel.py index f7ee1dd324..2e8cc1a97f 100644 --- a/plugins/Toolbox/src/PackagesModel.py +++ b/plugins/Toolbox/src/PackagesModel.py @@ -30,6 +30,7 @@ class PackagesModel(ListModel): self.addRoleName(Qt.UserRole + 11, "download_url") self.addRoleName(Qt.UserRole + 12, "last_updated") self.addRoleName(Qt.UserRole + 13, "is_bundled") + self.addRoleName(Qt.UserRole + 14, "supported_configs") # List of filters for queries. The result is the union of the each list of results. self._filter = {} # type: Dict[str, str] @@ -43,19 +44,20 @@ class PackagesModel(ListModel): for package in self._metadata: items.append({ - "id": package["package_id"], - "type": package["package_type"], - "name": package["display_name"], - "version": package["package_version"], - "author_id": package["author"]["author_id"], - "author_name": package["author"]["display_name"], - "author_email": package["author"]["email"] if "email" in package["author"] else "None", - "description": package["description"], - "icon_url": package["icon_url"] if "icon_url" in package else None, - "image_urls": package["image_urls"] if "image_urls" in package else None, - "download_url": package["download_url"] if "download_url" in package else None, - "last_updated": package["last_updated"] if "last_updated" in package else None, - "is_bundled": package["is_bundled"] if "is_bundled" in package else False + "id": package["package_id"], + "type": package["package_type"], + "name": package["display_name"], + "version": package["package_version"], + "author_id": package["author"]["author_id"], + "author_name": package["author"]["display_name"], + "author_email": package["author"]["email"] if "email" in package["author"] else "None", + "description": package["description"], + "icon_url": package["icon_url"] if "icon_url" in package else None, + "image_urls": package["image_urls"] if "image_urls" in package else None, + "download_url": package["download_url"] if "download_url" in package else None, + "last_updated": package["last_updated"] if "last_updated" in package else None, + "is_bundled": package["is_bundled"] if "is_bundled" in package else False, + "supported_configs": package["supported_configs"] if "supported_configs" in package else [] }) # Filter on all the key-word arguments. diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 104d3d323a..234f864015 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -368,14 +368,17 @@ class Toolbox(QObject, Extension): # HACK: Eventually get rid of the code from here... if type is "plugins_showcase" or type is "materials_showcase": self._metadata["plugins_showcase"] = json_data["data"]["plugin"]["packages"] + self._models["plugins_showcase"].setMetadata(self._metadata["plugins_showcase"]) self._metadata["materials_showcase"] = json_data["data"]["material"]["authors"] + self._models["materials_showcase"].setMetadata(self._metadata["materials_showcase"]) + print("MATERIAL SHOWCASE", self._metadata["materials_showcase"]) else: # ...until here. # This hack arises for multiple reasons but the main # one is because there are not separate API calls # for different kinds of showcases. self._metadata[type] = json_data["data"] - self._models[type].setMetadata(self._metadata[type]) + self._models[type].setMetadata(self._metadata[type]) # Do some auto filtering # TODO: Make multiple API calls in the future to handle this