From 2fab1aef33cbbaff18244f3c67beee0424140d6e Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Fri, 18 May 2018 17:28:54 +0200 Subject: [PATCH] Rename Api to API --- cura/Api/Backups.py | 32 -------------------------------- cura/Api/__init__.py | 19 ------------------- 2 files changed, 51 deletions(-) delete mode 100644 cura/Api/Backups.py delete mode 100644 cura/Api/__init__.py diff --git a/cura/Api/Backups.py b/cura/Api/Backups.py deleted file mode 100644 index 663715ec29..0000000000 --- a/cura/Api/Backups.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) 2018 Ultimaker B.V. -# Cura is released under the terms of the LGPLv3 or higher. -from cura.Backups.BackupsManager import BackupsManager - - -class Backups: - """ - The backups API provides a version-proof bridge between Cura's BackupManager and plugins that hook into it. - - Usage: - from cura.Api import CuraApi - api = CuraApi() - api.backups.createBackup() - api.backups.restoreBackup(my_zip_file, {"cura_release": "3.1"}) - """ - - manager = BackupsManager() # Re-used instance of the backups manager. - - def createBackup(self) -> (bytes, dict): - """ - Create a new backup using the BackupsManager. - :return: Tuple containing a ZIP file with the backup data and a dict with meta data about the backup. - """ - return self.manager.createBackup() - - def restoreBackup(self, zip_file: bytes, meta_data: dict) -> None: - """ - Restore a backup using the BackupManager. - :param zip_file: A ZIP file containing the actual backup data. - :param meta_data: Some meta data needed for restoring a backup, like the Cura version number. - """ - return self.manager.restoreBackup(zip_file, meta_data) diff --git a/cura/Api/__init__.py b/cura/Api/__init__.py deleted file mode 100644 index c7cb8b5201..0000000000 --- a/cura/Api/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2018 Ultimaker B.V. -# Cura is released under the terms of the LGPLv3 or higher. -from UM.PluginRegistry import PluginRegistry -from cura.Api.Backups import Backups - - -class CuraApi: - """ - The official Cura API that plugins can use to interact with Cura. - Python does not technically prevent talking to other classes as well, - but this API provides a version-safe interface with proper deprecation warnings etc. - Usage of any other methods than the ones provided in this API can cause plugins to be unstable. - """ - - # For now we use the same API version to be consistent. - VERSION = PluginRegistry.APIVersion - - # Backups API. - backups = Backups()