diff --git a/plugins/Marketplace/Marketplace.py b/plugins/Marketplace/Marketplace.py index 921e9d1290..506b8347e2 100644 --- a/plugins/Marketplace/Marketplace.py +++ b/plugins/Marketplace/Marketplace.py @@ -3,6 +3,7 @@ import os.path from PyQt5.QtCore import pyqtSlot +from PyQt5.QtQml import qmlRegisterType from typing import Optional, TYPE_CHECKING from cura.ApplicationMetadata import CuraSDKVersion @@ -12,6 +13,8 @@ from UM.Extension import Extension # We are implementing the main object of an from UM.Logger import Logger from UM.PluginRegistry import PluginRegistry # To find out where we are stored (the proper way). +from .PackageList import PackageList # To register this type with QML. + if TYPE_CHECKING: from PyQt5.QtCore import QObject @@ -27,6 +30,8 @@ class Marketplace(Extension): super().__init__() self._window: Optional["QObject"] = None # If the window has been loaded yet, it'll be cached in here. + qmlRegisterType(PackageList, "Cura", 1, 7, "PackageList") + @pyqtSlot() def show(self) -> None: """ diff --git a/plugins/Marketplace/PackageList.py b/plugins/Marketplace/PackageList.py index dfb0f0ad57..e6a4e7a560 100644 --- a/plugins/Marketplace/PackageList.py +++ b/plugins/Marketplace/PackageList.py @@ -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 diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index 2d37483510..a43a9e55a4 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -2,8 +2,18 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.15 +import QtQuick.Controls 2.15 +import Cura 1.7 as Cura -Rectangle +Item { - color: "pink" //TODO + Repeater + { + model: Cura.PackageList{} + + Label + { + text: "Test" //TODO: Create a card for each package. + } + } } \ No newline at end of file