mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-20 12:49:38 +08:00
Workaround for process-events during multiple http requests.
Would not work otherwise, but that should have been true in the old situation then as well? CURA-12156
This commit is contained in:
parent
a50fa29a0f
commit
b295ca7d04
@ -98,7 +98,12 @@ class CreateBackupJob(Job):
|
||||
backup_meta_data["description"] = "{}.backup.{}.cura.zip".format(timestamp, backup_meta_data["cura_release"])
|
||||
self._requestUploadSlot(backup_meta_data, len(self._backup_zip))
|
||||
|
||||
self._job_done.wait()
|
||||
# Note: One 'process events' call wasn't enough with the changed situation somehow.
|
||||
active_done_check = False
|
||||
while not active_done_check:
|
||||
CuraApplication.getInstance().processEvents()
|
||||
active_done_check = self._job_done.wait(0.02)
|
||||
|
||||
if self.backup_upload_error_message == "":
|
||||
self._upload_message.setText(catalog.i18nc("@info:backup_status", "Your backup has finished uploading."))
|
||||
self._upload_message.setProgress(None) # Hide progress bar
|
||||
@ -117,9 +122,6 @@ class CreateBackupJob(Job):
|
||||
"metadata": backup_metadata
|
||||
}
|
||||
}).encode()
|
||||
|
||||
CuraApplication.getInstance().processEvents() # Needed??
|
||||
|
||||
HttpRequestManager.getInstance().put(
|
||||
self._api_backup_url,
|
||||
data = payload,
|
||||
@ -127,8 +129,6 @@ class CreateBackupJob(Job):
|
||||
error_callback = self._onUploadSlotCompleted,
|
||||
scope = self._json_cloud_scope)
|
||||
|
||||
CuraApplication.getInstance().processEvents() # Needed??
|
||||
|
||||
def _onUploadSlotCompleted(self, reply: QNetworkReply, error: Optional["QNetworkReply.NetworkError"] = None) -> None:
|
||||
if HttpRequestManager.safeHttpStatus(reply) >= 300:
|
||||
replyText = HttpRequestManager.readText(reply)
|
||||
|
Loading…
x
Reference in New Issue
Block a user