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.
This commit is contained in:
Ghostkeeper 2021-10-19 17:47:40 +02:00
parent 97edf59660
commit ffce865c85
No known key found for this signature in database
GPG Key ID: 68F39EA88EEED5FF

View File

@ -5,7 +5,9 @@ import os.path
from PyQt5.QtCore import pyqtSlot from PyQt5.QtCore import pyqtSlot
from typing import Optional, TYPE_CHECKING from typing import Optional, TYPE_CHECKING
from cura.ApplicationMetadata import CuraSDKVersion
from cura.CuraApplication import CuraApplication # Creating QML objects and managing packages. 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.Extension import Extension # We are implementing the main object of an extension here.
from UM.Logger import Logger from UM.Logger import Logger
from UM.PluginRegistry import PluginRegistry # To find out where we are stored (the proper way). 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. 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): def __init__(self):
super().__init__() super().__init__()
self._window: Optional["QObject"] = None # If the window has been loaded yet, it'll be cached in here. self._window: Optional["QObject"] = None # If the window has been loaded yet, it'll be cached in here.