Added error checking, added typing, renamed function. CURA-5389

This commit is contained in:
Jack Ha 2018-07-12 14:06:34 +02:00
parent af02dc2758
commit 2bd8350141
5 changed files with 27 additions and 13 deletions

View file

@ -455,8 +455,14 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice):
self.setAuthenticationState(AuthState.AuthenticationDenied)
self._authentication_failed_message.show()
def _saveAuthentication(self):
def _saveAuthentication(self) -> None:
global_container_stack = CuraApplication.getInstance().getGlobalContainerStack()
if self._authentication_key is None:
Logger.log("e", "Authentication key is None, nothing to save.")
return
if self._authentication_id is None:
Logger.log("e", "Authentication id is None, nothing to save.")
return
if global_container_stack:
global_container_stack.setMetaDataEntry("network_authentication_key", self._authentication_key)
@ -631,4 +637,4 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice):
result = "********" + result
return result
return self._authentication_key
return self._authentication_key