With the lambda it would capture the variable of printer_id. It wouldn't actually store the value of printer_id in teh created lambda. As a result, it was using the current value of printer_id when the lambda executes, rather than the value of printer_id when the lambda is constructed. A bit weird how that works in Python's lambdas.
With partial functions it works properly.
Contributes to issue CURA-8609.
The API endpoint got renamed (without my awareness). It also needed to be a POST request, probably since the beginning. And apparently it needs everything to be in a sub-field called 'data' for some reason.
Contributes to issue CURA-8609.
The entire response is contained in a lone 'data' field in the response. Why this is necessary I don't know, because indeed everything the server can tell us is data so everything would be in a 'data' field. But that's how the API reacts so that's how we'll have to parse it.
Contributes to issue CURA-8609.
It could be that this archive is not accessible any more for whatever reason. Write-only file systems, quarantined files, etc. Whatever the reason, Cura shouldn't crash on this because it's not in Cura's control.
Contributes to issue CURA-8609.
It could be that the archive fails to save because the user doesn't have access to its own temporary folder, the firewall quarantines the archive, there's not enough disk space, whatever. These errors need to be handled and not crash Cura.
Contributes to issue CURA-8609.
This indicates how we're using it, and also allows for use of symbols in the code rather than strings, which integrate better with tooling.
Contributes to issue CURA-8609.
Partialmethod is not callable apparently. I think the problem is that it's calling the method outside of the scope of the class here. I'm probably not using it right. Lambas are easier since they automatically take their scope along with them.
Contributes to issue CURA-8609.
Apparently the API is now a PUT request rather than a GET request. It needs a bit more metadata which can be hard-coded for our client.
Contributes to issue CURA-8609.
This way we can ask the printer status from QML even if it's updated via a job on a different thread and different class and all that.
Contributes to issue CURA-8609.
Apparently the Cloud will need to know the file size before it gets uploaded. It is used as a redundancy code to verify that it's not corrupt there.
Perhaps they should ask for a CRC instead, being more reliable against an upload containing only null bytes or whatever, but that is not up to me to decide.
Contributes to issue CURA-8609.
Steps involved are:
- Create an archive of all materials.
- Request the cloud API to provide a URL to upload the archive to.
- Upload the archive to that API.
Currently the two internet requests are asynchronous, meaning that the job will 'end' before the upload is complete. Most likely the job instance will even be deleted before we get a response from the server. So this won't work, really. Need to structure that a bit differently. But I want to save this progress because it embodies the happy path well.
Contributes to issue CURA-8609.