mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Also send signature file if it exists
The files are not placed there yet when unpacking a package, as far as I know. Next time. Contributes to issue CURA-5034.
This commit is contained in:
parent
4727340ae4
commit
4e46963f58
1 changed files with 8 additions and 0 deletions
|
@ -28,9 +28,17 @@ class SendMaterialJob(Job):
|
|||
continue
|
||||
_, file_name = os.path.split(file_path)
|
||||
Logger.log("d", "Syncing material profile with printer: {file_name}".format(file_name = file_name))
|
||||
|
||||
parts = []
|
||||
with open(file_path, "rb") as f:
|
||||
parts.append(self.device._createFormPart("name=\"file\"; filename=\"{file_name}\"".format(file_name = file_name), f.read()))
|
||||
parts.append(self.device._createFormPart("name=\"filename\"", file_name.encode("utf-8"), "text/plain"))
|
||||
|
||||
without_extension, _ = os.path.splitext(file_path)
|
||||
signature_file_path = without_extension + ".sig"
|
||||
if os.path.exists(signature_file_path):
|
||||
_, signature_file_name = os.path.split(signature_file_path)
|
||||
with open(signature_file_path, "rb") as f:
|
||||
parts.append(self.device._createFormPart("name=\"signature_file\"; filename=\"{file_name}\"".format(file_name = signature_file_name), f.read()))
|
||||
|
||||
self.device.postFormWithParts(target = "/materials", parts = parts)
|
Loading…
Add table
Add a link
Reference in a new issue