12345678910111213141516171819202122232425262728293031323334 |
- from UM.Logger import Logger
- from cura.ReaderWriters.ProfileWriter import ProfileWriter
- import zipfile
- class CuraProfileWriter(ProfileWriter):
-
-
-
-
-
-
- def write(self, path, profiles):
- if type(profiles) != list:
- profiles = [profiles]
- stream = open(path, "wb")
- archive = zipfile.ZipFile(stream, "w", compression=zipfile.ZIP_DEFLATED)
- try:
-
- for profile in profiles:
- serialized = profile.serialize()
- profile_file = zipfile.ZipInfo(profile.getId())
- archive.writestr(profile_file, serialized)
- except Exception as e:
- Logger.log("e", "Failed to write profile to %s: %s", path, str(e))
- return False
- finally:
- archive.close()
- return True
|