mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-07-02 15:15:10 +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"])
|
backup_meta_data["description"] = "{}.backup.{}.cura.zip".format(timestamp, backup_meta_data["cura_release"])
|
||||||
self._requestUploadSlot(backup_meta_data, len(self._backup_zip))
|
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 == "":
|
if self.backup_upload_error_message == "":
|
||||||
self._upload_message.setText(catalog.i18nc("@info:backup_status", "Your backup has finished uploading."))
|
self._upload_message.setText(catalog.i18nc("@info:backup_status", "Your backup has finished uploading."))
|
||||||
self._upload_message.setProgress(None) # Hide progress bar
|
self._upload_message.setProgress(None) # Hide progress bar
|
||||||
@ -117,9 +122,6 @@ class CreateBackupJob(Job):
|
|||||||
"metadata": backup_metadata
|
"metadata": backup_metadata
|
||||||
}
|
}
|
||||||
}).encode()
|
}).encode()
|
||||||
|
|
||||||
CuraApplication.getInstance().processEvents() # Needed??
|
|
||||||
|
|
||||||
HttpRequestManager.getInstance().put(
|
HttpRequestManager.getInstance().put(
|
||||||
self._api_backup_url,
|
self._api_backup_url,
|
||||||
data = payload,
|
data = payload,
|
||||||
@ -127,8 +129,6 @@ class CreateBackupJob(Job):
|
|||||||
error_callback = self._onUploadSlotCompleted,
|
error_callback = self._onUploadSlotCompleted,
|
||||||
scope = self._json_cloud_scope)
|
scope = self._json_cloud_scope)
|
||||||
|
|
||||||
CuraApplication.getInstance().processEvents() # Needed??
|
|
||||||
|
|
||||||
def _onUploadSlotCompleted(self, reply: QNetworkReply, error: Optional["QNetworkReply.NetworkError"] = None) -> None:
|
def _onUploadSlotCompleted(self, reply: QNetworkReply, error: Optional["QNetworkReply.NetworkError"] = None) -> None:
|
||||||
if HttpRequestManager.safeHttpStatus(reply) >= 300:
|
if HttpRequestManager.safeHttpStatus(reply) >= 300:
|
||||||
replyText = HttpRequestManager.readText(reply)
|
replyText = HttpRequestManager.readText(reply)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user