CURA-5536 The api call does not return the package_count for the showcase, so we can't trust in that value. The total number of material packages by author is now calculated.

This commit is contained in:
Diego Prado Gesto 2018-07-13 15:13:38 +02:00
parent a8727d7b39
commit af697c6999
3 changed files with 12 additions and 4 deletions

View file

@ -228,6 +228,7 @@ class Toolbox(QObject, Extension):
self._makeRequestByType("authors")
self._makeRequestByType("plugins_showcase")
self._makeRequestByType("materials_showcase")
self._makeRequestByType("materials_available")
# Gather installed packages:
self._updateInstalledModels()
@ -506,8 +507,15 @@ class Toolbox(QObject, Extension):
count = 0
for package in self._metadata["materials_installed"]:
if package["author"]["author_id"] == author_id:
if self.isInstalled(package["package_id"]):
count += 1
count += 1
return count
@pyqtSlot(str, result = int)
def getTotalNumberOfPackagesByAuthor(self, author_id: str) -> int:
count = 0
for package in self._metadata["materials_available"]:
if package["author"]["author_id"] == author_id:
count += 1
return count
@pyqtSlot(str, result = bool)