diff options
Diffstat (limited to 'cura/API/Backups.py')
-rw-r--r-- | cura/API/Backups.py | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/cura/API/Backups.py b/cura/API/Backups.py index ef74e74be0..1940d38a36 100644 --- a/cura/API/Backups.py +++ b/cura/API/Backups.py @@ -8,28 +8,37 @@ if TYPE_CHECKING: from cura.CuraApplication import CuraApplication -## The back-ups API provides a version-proof bridge between Cura's -# BackupManager and plug-ins 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"})`` class Backups: + """The back-ups API provides a version-proof bridge between Cura's + + BackupManager and plug-ins that hook into it. + + Usage: + + .. code-block:: python + + from cura.API import CuraAPI + api = CuraAPI() + api.backups.createBackup() + api.backups.restoreBackup(my_zip_file, {"cura_release": "3.1"}) + """ def __init__(self, application: "CuraApplication") -> None: self.manager = BackupsManager(application) - ## Create a new back-up using the BackupsManager. - # \return Tuple containing a ZIP file with the back-up data and a dict - # with metadata about the back-up. def createBackup(self) -> Tuple[Optional[bytes], Optional[Dict[str, Any]]]: + """Create a new back-up using the BackupsManager. + + :return: Tuple containing a ZIP file with the back-up data and a dict with metadata about the back-up. + """ + return self.manager.createBackup() - ## Restore a back-up using the BackupsManager. - # \param zip_file A ZIP file containing the actual back-up data. - # \param meta_data Some metadata needed for restoring a back-up, like the - # Cura version number. def restoreBackup(self, zip_file: bytes, meta_data: Dict[str, Any]) -> None: + """Restore a back-up using the BackupsManager. + + :param zip_file: A ZIP file containing the actual back-up data. + :param meta_data: Some metadata needed for restoring a back-up, like the Cura version number. + """ + return self.manager.restoreBackup(zip_file, meta_data) |