No longer chache singleton objects

CURA-6005
This commit is contained in:
Jaime van Kessel 2019-01-03 16:44:08 +01:00
parent 773190bee1
commit 65183ade0a
3 changed files with 13 additions and 18 deletions

View file

@ -12,16 +12,14 @@ import requests
from UM.Logger import Logger
from UM.Message import Message
from UM.Signal import Signal
from cura.CuraApplication import CuraApplication
from .UploadBackupJob import UploadBackupJob
from .Settings import Settings
## The DriveApiService is responsible for interacting with the CuraDrive API and Cura's backup handling.
class DriveApiService:
"""
The DriveApiService is responsible for interacting with the CuraDrive API and Cura's backup handling.
"""
GET_BACKUPS_URL = "{}/backups".format(Settings.DRIVE_API_URL)
PUT_BACKUP_URL = "{}/backups".format(Settings.DRIVE_API_URL)
DELETE_BACKUP_URL = "{}/backups".format(Settings.DRIVE_API_URL)
@ -32,9 +30,8 @@ class DriveApiService:
# Emit signal when creating backup started or finished.
onCreatingStateChanged = Signal()
def __init__(self, cura_api) -> None:
"""Create a new instance of the Drive API service and set the cura_api object."""
self._cura_api = cura_api
def __init__(self) -> None:
self._cura_api = CuraApplication.getInstance().getCuraAPI()
def getBackups(self) -> List[Dict[str, Any]]:
"""Get all backups from the API."""