From ffce865c855ffd79efea1250f1a58c1c1eebde5f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 19 Oct 2021 17:47:40 +0200 Subject: [PATCH] Add constant for API URLs I figured this out now. Don't want to forget it. We'll need it later anyway. Contributes to issue CURA-8556. --- plugins/Marketplace/Marketplace.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/Marketplace/Marketplace.py b/plugins/Marketplace/Marketplace.py index be2f66c7b2..1ae19718ef 100644 --- a/plugins/Marketplace/Marketplace.py +++ b/plugins/Marketplace/Marketplace.py @@ -5,7 +5,9 @@ import os.path from PyQt5.QtCore import pyqtSlot from typing import Optional, TYPE_CHECKING +from cura.ApplicationMetadata import CuraSDKVersion from cura.CuraApplication import CuraApplication # Creating QML objects and managing packages. +from cura.UltimakerCloud import UltimakerCloudConstants from UM.Extension import Extension # We are implementing the main object of an extension here. from UM.Logger import Logger from UM.PluginRegistry import PluginRegistry # To find out where we are stored (the proper way). @@ -18,6 +20,9 @@ class Marketplace(Extension): The main managing object for the Marketplace plug-in. """ + ROOT_URL = f"{UltimakerCloudConstants.CuraCloudAPIRoot}/cura-packages/v{UltimakerCloudConstants.CuraCloudAPIVersion}/cura/v{CuraSDKVersion}" # Root of all Marketplace API requests. + PACKAGES_URL = f"{ROOT_URL}/packages" # URL to use for requesting the list of packages. + def __init__(self): super().__init__() self._window: Optional["QObject"] = None # If the window has been loaded yet, it'll be cached in here.