Allow PackageList to be used as a model from QML

QML is leading here and holding the pointers for creation and destruction.

Contributes to issue CURA-8556.
This commit is contained in:
Ghostkeeper 2021-10-21 15:46:46 +02:00
parent 4337e81b77
commit 3138452f94
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
3 changed files with 19 additions and 4 deletions

View file

@ -9,7 +9,7 @@ from UM.Qt.ListModel import ListModel
from UM.TaskManagement.HttpRequestManager import HttpRequestManager # To request the package list from the API.
from UM.TaskManagement.HttpRequestScope import JsonDecoratorScope # To request JSON responses from the API.
from .Marketplace import PACKAGES_URL # To get the list of packages.
from . import Marketplace # To get the list of packages. Imported this way to prevent circular imports.
from .PackageModel import PackageModel # This list is a list of PackageModels.
if TYPE_CHECKING:
@ -47,7 +47,7 @@ class PackageList(ListModel):
http = HttpRequestManager.getInstance()
http.get(
PACKAGES_URL,
Marketplace.PACKAGES_URL,
scope = self._scope,
callback = self._parseResponse,
error_callback = self._onError