mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
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:
parent
a8727d7b39
commit
af697c6999
3 changed files with 12 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue