CURA-5035 Aproaching the asymptote of done

This commit is contained in:
Ian Paschal 2018-04-30 17:05:46 +02:00
parent 01007946b4
commit 2d54251be0
5 changed files with 24 additions and 20 deletions

View file

@ -23,9 +23,7 @@ Item
bottomMargin: UM.Theme.getSize("wide_margin").height bottomMargin: UM.Theme.getSize("wide_margin").height
top: parent.top top: parent.top
} }
// TODO: Sometimes the height is not the childrenRect.height. Lord height: childrenRect.height + UM.Theme.getSize("wide_margin").height
// knows why. Probably because QT is garbage.
height: childrenRect.height
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
Repeater Repeater
{ {

View file

@ -189,11 +189,12 @@ Item
Item Item
{ {
id: supportedConfigsChart
anchors.top: normalData.bottom anchors.top: normalData.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.topMargin: UM.Theme.getSize("default_margin").height
height: model.type == "material" ? childrenRect.height : 0 height: visible ? childrenRect.height : 0
width: normalData.width width: normalData.width
visible: model.type == "material" visible: model.type == "material" && model.supported_configs.length > 0
Label Label
{ {
id: compatibilityHeading id: compatibilityHeading

View file

@ -41,7 +41,7 @@ class AuthorsModel(ListModel):
"email": author["email"] if "email" in author else None, "email": author["email"] if "email" in author else None,
"website": author["website"], "website": author["website"],
"package_count": author["package_count"] if "package_count" in author else 0, "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, "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"]) "description": "Material and quality profiles from {author_name}".format( author_name = author["display_name"])
}) })

View file

@ -30,6 +30,7 @@ class PackagesModel(ListModel):
self.addRoleName(Qt.UserRole + 11, "download_url") self.addRoleName(Qt.UserRole + 11, "download_url")
self.addRoleName(Qt.UserRole + 12, "last_updated") self.addRoleName(Qt.UserRole + 12, "last_updated")
self.addRoleName(Qt.UserRole + 13, "is_bundled") 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. # List of filters for queries. The result is the union of the each list of results.
self._filter = {} # type: Dict[str, str] self._filter = {} # type: Dict[str, str]
@ -43,19 +44,20 @@ class PackagesModel(ListModel):
for package in self._metadata: for package in self._metadata:
items.append({ items.append({
"id": package["package_id"], "id": package["package_id"],
"type": package["package_type"], "type": package["package_type"],
"name": package["display_name"], "name": package["display_name"],
"version": package["package_version"], "version": package["package_version"],
"author_id": package["author"]["author_id"], "author_id": package["author"]["author_id"],
"author_name": package["author"]["display_name"], "author_name": package["author"]["display_name"],
"author_email": package["author"]["email"] if "email" in package["author"] else "None", "author_email": package["author"]["email"] if "email" in package["author"] else "None",
"description": package["description"], "description": package["description"],
"icon_url": package["icon_url"] if "icon_url" in package else None, "icon_url": package["icon_url"] if "icon_url" in package else None,
"image_urls": package["image_urls"] if "image_urls" 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, "download_url": package["download_url"] if "download_url" in package else None,
"last_updated": package["last_updated"] if "last_updated" 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 "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. # Filter on all the key-word arguments.

View file

@ -368,14 +368,17 @@ class Toolbox(QObject, Extension):
# HACK: Eventually get rid of the code from here... # HACK: Eventually get rid of the code from here...
if type is "plugins_showcase" or type is "materials_showcase": if type is "plugins_showcase" or type is "materials_showcase":
self._metadata["plugins_showcase"] = json_data["data"]["plugin"]["packages"] 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._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: else:
# ...until here. # ...until here.
# This hack arises for multiple reasons but the main # This hack arises for multiple reasons but the main
# one is because there are not separate API calls # one is because there are not separate API calls
# for different kinds of showcases. # for different kinds of showcases.
self._metadata[type] = json_data["data"] self._metadata[type] = json_data["data"]
self._models[type].setMetadata(self._metadata[type]) self._models[type].setMetadata(self._metadata[type])
# Do some auto filtering # Do some auto filtering
# TODO: Make multiple API calls in the future to handle this # TODO: Make multiple API calls in the future to handle this