def restoreBackup(self, zip_file: bytes, meta_data: Dict[str,
                                                             str]) -> None:
        """
        Restore a back-up from a given ZipFile.
        :param zip_file: A bytes object containing the actual back-up.
        :param meta_data: A dict containing some metadata that is needed to restore the back-up correctly.
        """

        if not meta_data.get("cura_release", None):
            # If there is no "cura_release" specified in the meta data, we don't execute a backup restore.
            Logger.log(
                "w",
                "Tried to restore a backup without specifying a Cura version number."
            )
            return

        self._disableAutoSave()

        backup = Backup(self._application,
                        zip_file=zip_file,
                        meta_data=meta_data)
        restored = backup.restore()
        if restored:
            # At this point, Cura will need to restart for the changes to take effect.
            # We don't want to store the data at this point as that would override the just-restored backup.
            self._application.windowClosed(save_data=False)
예제 #2
0
    def restoreBackup(self, zip_file: bytes, meta_data: Dict[str, str]) -> None:
        if not meta_data.get("cura_release", None):
            # If there is no "cura_release" specified in the meta data, we don't execute a backup restore.
            Logger.log("w", "Tried to restore a backup without specifying a Cura version number.")
            return

        self._disableAutoSave()

        backup = Backup(self._application, zip_file = zip_file, meta_data = meta_data)
        restored = backup.restore()
        if restored:
            # At this point, Cura will need to restart for the changes to take effect.
            # We don't want to store the data at this point as that would override the just-restored backup.
            self._application.windowClosed(save_data = False)
예제 #3
0
파일: BackupsManager.py 프로젝트: tzp1/Cura
    def restoreBackup(self, zip_file: bytes, meta_data: dict) -> None:
        if not meta_data.get("cura_release", None):
            # If there is no "cura_release" specified in the meta data, we don't execute a backup restore.
            Logger.log(
                "w",
                "Tried to restore a backup without specifying a Cura version number."
            )
            return

        self._disableAutoSave()

        backup = Backup(zip_file=zip_file, meta_data=meta_data)
        restored = backup.restore()
        if restored:
            # At this point, Cura will need to restart for the changes to take effect.
            # We don't want to store the data at this point as that would override the just-restored backup.
            self._application.windowClosed(save_data=False)