Use lambdas instead of functools

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.
This commit is contained in:
Ghostkeeper 2021-10-12 17:47:05 +02:00
parent 2d53a548dc
commit a703e6b882
No known key found for this signature in database
GPG key ID: 68F39EA88EEED5FF

View file

@ -2,7 +2,6 @@
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
import enum import enum
import functools
import json # To serialise metadata for API calls. import json # To serialise metadata for API calls.
import os # To delete the archive when we're done. import os # To delete the archive when we're done.
from PyQt5.QtCore import QUrl from PyQt5.QtCore import QUrl
@ -132,8 +131,8 @@ class UploadMaterialsJob(Job):
http = HttpRequestManager.getInstance() http = HttpRequestManager.getInstance()
http.get( http.get(
url = self.UPLOAD_CONFIRM_URL.format(cluster_id = cluster_id, cluster_printer_id = printer_id), url = self.UPLOAD_CONFIRM_URL.format(cluster_id = cluster_id, cluster_printer_id = printer_id),
callback = functools.partialmethod(self.onUploadConfirmed, printer_id), callback = lambda reply, error: self.onUploadConfirmed(printer_id, reply, error),
error_callback = functools.partialmethod(self.onUploadConfirmed, printer_id), # Let this same function handle the error too. error_callback = lambda reply, error: self.onUploadConfirmed(printer_id, reply, error), # Let this same function handle the error too.
scope = self._scope scope = self._scope
) )