From a11878b1991401a3dd24e5518eaa27e19838875c Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 20 Feb 2019 10:40:23 +0100 Subject: [PATCH 1/6] Log warning instead of exception if no connection Contributes to CL-1245 --- cura/OAuth2/AuthorizationHelpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/OAuth2/AuthorizationHelpers.py b/cura/OAuth2/AuthorizationHelpers.py index f125876879..bf70bf693a 100644 --- a/cura/OAuth2/AuthorizationHelpers.py +++ b/cura/OAuth2/AuthorizationHelpers.py @@ -92,7 +92,7 @@ class AuthorizationHelpers: }) except requests.exceptions.ConnectionError: # Connection was suddenly dropped. Nothing we can do about that. - Logger.logException("e", "Something failed while attempting to parse the JWT token") + Logger.log("w", "Something failed while attempting to parse the JWT token") return None if token_request.status_code not in (200, 201): Logger.log("w", "Could not retrieve token data from auth server: %s", token_request.text) From 09fe06b8bf463fd0805fa767bbe34087adc0c700 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 20 Feb 2019 10:45:36 +0100 Subject: [PATCH 2/6] Add some kaizen changes from #5328 Contributes to CL-1245 --- cura/OAuth2/AuthorizationService.py | 6 +----- plugins/UM3NetworkPrinting/src/Cloud/CloudApiClient.py | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cura/OAuth2/AuthorizationService.py b/cura/OAuth2/AuthorizationService.py index 3c2f66d037..442c5d388d 100644 --- a/cura/OAuth2/AuthorizationService.py +++ b/cura/OAuth2/AuthorizationService.py @@ -66,11 +66,7 @@ class AuthorizationService: # \sa _parseJWT def getUserProfile(self) -> Optional["UserProfile"]: if not self._user_profile: - try: - self._user_profile = self._parseJWT() - except requests.exceptions.ConnectionError: - # Unable to get connection, can't login. - return None + self._user_profile = self._parseJWT() if not self._user_profile and self._auth_data: # If there is still no user profile from the JWT, we have to log in again. diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudApiClient.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudApiClient.py index adff94bbbc..87c7a50838 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudApiClient.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudApiClient.py @@ -159,9 +159,13 @@ class CloudApiClient: model: Type[CloudApiClientModel], ) -> None: def parse() -> None: + # Don't try to parse the reply if we didn't get one + if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) is None: + return status_code, response = self._parseReply(reply) self._anti_gc_callbacks.remove(parse) - return self._parseModels(response, on_finished, model) + self._parseModels(response, on_finished, model) + return self._anti_gc_callbacks.append(parse) reply.finished.connect(parse) From cb8804b86a5ee2faafa256ddb8b0107d641e68d0 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 20 Feb 2019 10:46:15 +0100 Subject: [PATCH 3/6] Revert "Add some kaizen changes from #5328" This reverts commit 09fe06b8bf463fd0805fa767bbe34087adc0c700. --- cura/OAuth2/AuthorizationService.py | 6 +++++- plugins/UM3NetworkPrinting/src/Cloud/CloudApiClient.py | 6 +----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cura/OAuth2/AuthorizationService.py b/cura/OAuth2/AuthorizationService.py index 442c5d388d..3c2f66d037 100644 --- a/cura/OAuth2/AuthorizationService.py +++ b/cura/OAuth2/AuthorizationService.py @@ -66,7 +66,11 @@ class AuthorizationService: # \sa _parseJWT def getUserProfile(self) -> Optional["UserProfile"]: if not self._user_profile: - self._user_profile = self._parseJWT() + try: + self._user_profile = self._parseJWT() + except requests.exceptions.ConnectionError: + # Unable to get connection, can't login. + return None if not self._user_profile and self._auth_data: # If there is still no user profile from the JWT, we have to log in again. diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudApiClient.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudApiClient.py index 87c7a50838..adff94bbbc 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudApiClient.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudApiClient.py @@ -159,13 +159,9 @@ class CloudApiClient: model: Type[CloudApiClientModel], ) -> None: def parse() -> None: - # Don't try to parse the reply if we didn't get one - if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) is None: - return status_code, response = self._parseReply(reply) self._anti_gc_callbacks.remove(parse) - self._parseModels(response, on_finished, model) - return + return self._parseModels(response, on_finished, model) self._anti_gc_callbacks.append(parse) reply.finished.connect(parse) From a5761cb56bc305401fb16059661cbcbd855f3a2d Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 20 Feb 2019 14:08:13 +0100 Subject: [PATCH 4/6] Use new property names for cloud connection detection --- plugins/MonitorStage/MonitorMain.qml | 2 +- plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml index a73650ed6a..ae7923656b 100644 --- a/plugins/MonitorStage/MonitorMain.qml +++ b/plugins/MonitorStage/MonitorMain.qml @@ -11,7 +11,7 @@ Rectangle { id: viewportOverlay - property bool isConnected: Cura.MachineManager.activeMachineHasActiveNetworkConnection || Cura.MachineManager.activeMachineHasActiveCloudConnection + property bool isConnected: Cura.MachineManager.activeMachineIsUsingCloudConnection property bool isNetworkConfigurable: ["Ultimaker 3", "Ultimaker 3 Extended", "Ultimaker S5"].indexOf(Cura.MachineManager.activeMachineDefinitionName) > -1 property bool isNetworkConfigured: { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml index 5d824ada97..6eaff20f71 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml @@ -171,11 +171,11 @@ Item // When printing over the cloud we don't recieve print jobs until there is one, so // unless there's at least one print job we'll be stuck with skeleton loading // indefinitely. - if (Cura.MachineManager.activeMachineHasActiveCloudConnection) + if (Cura.MachineManager.activeMachineIsUsingCloudConnection || OutputDevice.receivedPrintJobs) { return OutputDevice.queuedPrintJobs } - return OutputDevice.receivedPrintJobs ? OutputDevice.queuedPrintJobs : [null,null] + return [null, null] } spacing: 6 // TODO: Theme! } From 10f0a5663d1cb47203c3e63e41b0c09dc6f3d6bf Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 20 Feb 2019 14:32:19 +0100 Subject: [PATCH 5/6] Update MonitorMain.qml --- plugins/MonitorStage/MonitorMain.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml index ae7923656b..88193737bb 100644 --- a/plugins/MonitorStage/MonitorMain.qml +++ b/plugins/MonitorStage/MonitorMain.qml @@ -11,7 +11,7 @@ Rectangle { id: viewportOverlay - property bool isConnected: Cura.MachineManager.activeMachineIsUsingCloudConnection + property bool isConnected: Cura.MachineManager.activeMachineHasNetworkConnection || Cura.MachineManager.activeMachineHasCloudConnection property bool isNetworkConfigurable: ["Ultimaker 3", "Ultimaker 3 Extended", "Ultimaker S5"].indexOf(Cura.MachineManager.activeMachineDefinitionName) > -1 property bool isNetworkConfigured: { From ab25bcaf2f361ae115a331a6fe694ad48c72848a Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 21 Feb 2019 08:54:05 +0100 Subject: [PATCH 6/6] Tiny fix tranlation typo Spanish (X -> Y). --- resources/i18n/es_ES/fdmprinter.def.json.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/i18n/es_ES/fdmprinter.def.json.po b/resources/i18n/es_ES/fdmprinter.def.json.po index bd4ad9fd7f..3b519e7aec 100644 --- a/resources/i18n/es_ES/fdmprinter.def.json.po +++ b/resources/i18n/es_ES/fdmprinter.def.json.po @@ -1604,7 +1604,7 @@ msgstr "El patrĂ³n de relleno se mueve esta distancia a lo largo del eje X." #: fdmprinter.def.json msgctxt "infill_offset_y label" msgid "Infill Y Offset" -msgstr "Desplazamiento del relleno sobre el eje X" +msgstr "Desplazamiento del relleno sobre el eje Y" #: fdmprinter.def.json msgctxt "infill_offset_y description"