diff options
author | Ghostkeeper <rubend@tutanota.com> | 2021-10-12 14:04:22 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2021-10-12 14:04:22 +0300 |
commit | 4ccd4caaad92d1333f7f5288982ca5db5dbc46d6 (patch) | |
tree | 7cd1097a1ee4dcd73d3fdd61a7995135e6228d9d /cura/PrinterOutput | |
parent | bdc269f8abe463349933e5cbc02456a5e65ee7b1 (diff) |
Store material profile ID received from the upload request
We'll need this later to be able to tell the server which material archive it should send to certain printers.
Contributes to issue CURA-8609.
Diffstat (limited to 'cura/PrinterOutput')
-rw-r--r-- | cura/PrinterOutput/UploadMaterialsJob.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cura/PrinterOutput/UploadMaterialsJob.py b/cura/PrinterOutput/UploadMaterialsJob.py index 7cad115bb1..def7ff261f 100644 --- a/cura/PrinterOutput/UploadMaterialsJob.py +++ b/cura/PrinterOutput/UploadMaterialsJob.py @@ -36,6 +36,7 @@ class UploadMaterialsJob(Job): self._material_sync = material_sync self._scope = JsonDecoratorScope(UltimakerCloudScope(cura.CuraApplication.CuraApplication.getInstance())) # type: JsonDecoratorScope self._archive_filename = None # type: Optional[str] + self._archive_remote_id = None # type: Optional[str] # ID that the server gives to this archive. Used to communicate about the archive to the server. uploadCompleted = Signal() uploadProgressChanged = Signal() @@ -69,10 +70,15 @@ class UploadMaterialsJob(Job): return if "upload_url" not in response_data: Logger.error(f"Invalid response to material upload request: Missing 'upload_url' field to upload archive to.") - self.setResult(self.Result.Failed) + self.setResult(self.Result.FAILED) + return + if "material_profile_id" not in response_data: + Logger.error(f"Invalid response to material upload request: Missing 'material_profile_id' to communicate about the materials with the server.") + self.setResult(self.Result.FAILED) return upload_url = response_data["upload_url"] + self._archive_remote_id = response_data["material_profile_id"] file_data = open(self._archive_filename, "rb").read() http = HttpRequestManager.getInstance() http.put( |