Qt5->Qt6: More renamed stuff.

part of CURA-8591
This commit is contained in:
Remco Burema 2021-12-29 11:18:49 +01:00
parent 97da0b9183
commit 20b435af76
No known key found for this signature in database
GPG key ID: 215C49431D43F98C
19 changed files with 42 additions and 42 deletions

View file

@ -165,7 +165,7 @@ class CloudApiClient:
request = QNetworkRequest(QUrl(path))
if content_type:
request.setHeader(QNetworkRequest.ContentTypeHeader, content_type)
request.setHeader(QNetworkRequest.KnownHeaders.ContentTypeHeader, content_type)
access_token = self._account.accessToken
if access_token:
request.setRawHeader(b"Authorization", "Bearer {}".format(access_token).encode())
@ -179,7 +179,7 @@ class CloudApiClient:
:return: A tuple with a status code and a dictionary.
"""
status_code = reply.attribute(QNetworkRequest.HttpStatusCodeAttribute)
status_code = reply.attribute(QNetworkRequest.Attribute.HttpStatusCodeAttribute)
try:
response = bytes(reply.readAll()).decode()
return status_code, json.loads(response)
@ -233,7 +233,7 @@ class CloudApiClient:
self._anti_gc_callbacks.remove(parse)
# Don't try to parse the reply if we didn't get one
if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) is None:
if reply.attribute(QNetworkRequest.Attribute.HttpStatusCodeAttribute) is None:
if on_error is not None:
on_error()
return

View file

@ -272,7 +272,7 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
"""
Displays a message when an error occurs specific to uploading print job (i.e. queue is full).
"""
error_code = reply.attribute(QNetworkRequest.HttpStatusCodeAttribute)
error_code = reply.attribute(QNetworkRequest.Attribute.HttpStatusCodeAttribute)
if error_code == 409:
PrintJobUploadQueueFullMessage().show()
else:

View file

@ -106,9 +106,9 @@ class ToolPathUploader:
"""Checks whether a chunk of data was uploaded successfully, starting the next chunk if needed."""
Logger.log("i", "Finished callback %s %s",
reply.attribute(QNetworkRequest.HttpStatusCodeAttribute), reply.url().toString())
reply.attribute(QNetworkRequest.Attribute.HttpStatusCodeAttribute), reply.url().toString())
status_code = reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) # type: Optional[int]
status_code = reply.attribute(QNetworkRequest.Attribute.HttpStatusCodeAttribute) # type: Optional[int]
if not status_code:
Logger.log("e", "Reply contained no status code.")
self._errorCallback(reply, None)

View file

@ -42,6 +42,6 @@ class UM3PrintJobOutputModel(PrintJobOutputModel):
def _onImageLoaded(self, reply: QNetworkReply, error: Optional["QNetworkReply.NetworkError"] = None) -> None:
if not HttpRequestManager.replyIndicatesSuccess(reply, error):
Logger.warning("Requesting preview image failed, response code {0} while trying to connect to {1}".format(
reply.attribute(QNetworkRequest.HttpStatusCodeAttribute), reply.url()))
reply.attribute(QNetworkRequest.Attribute.HttpStatusCodeAttribute), reply.url()))
return
self.updatePreviewImageData(reply.readAll())

View file

@ -118,9 +118,9 @@ class ClusterApiClient:
"""
url = QUrl("http://" + self._address + path)
request = QNetworkRequest(url)
request.setAttribute(QNetworkRequest.FollowRedirectsAttribute, True)
request.setAttribute(QNetworkRequest.Attribute.RedirectPolicyAttribute, QNetworkRequest.RedirectPolicy.ManualRedirectPolicy)
if content_type:
request.setHeader(QNetworkRequest.ContentTypeHeader, content_type)
request.setHeader(QNetworkRequest.KnownHeaders.ContentTypeHeader, content_type)
return request
@staticmethod
@ -130,7 +130,7 @@ class ClusterApiClient:
:param reply: The reply from the server.
:return: A tuple with a status code and a dictionary.
"""
status_code = reply.attribute(QNetworkRequest.HttpStatusCodeAttribute)
status_code = reply.attribute(QNetworkRequest.Attribute.HttpStatusCodeAttribute)
try:
response = bytes(reply.readAll()).decode()
return status_code, json.loads(response)
@ -173,7 +173,7 @@ class ClusterApiClient:
self._anti_gc_callbacks.remove(parse)
# Don't try to parse the reply if we didn't get one
if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) is None:
if reply.attribute(QNetworkRequest.Attribute.HttpStatusCodeAttribute) is None:
return
if reply.error() > 0:

View file

@ -152,7 +152,7 @@ class SendMaterialJob(Job):
def _sendingFinished(self, reply: QNetworkReply) -> None:
"""Check a reply from an upload to the printer and log an error when the call failed"""
if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200:
if reply.attribute(QNetworkRequest.Attribute.HttpStatusCodeAttribute) != 200:
Logger.log("w", "Error while syncing material: %s", reply.errorString())
return
body = reply.readAll().data().decode('utf8')