Added property to indicate if output device accepts commands

Instead of how this was previously done, it's now tied to the auth state.

CL-541
This commit is contained in:
Jaime van Kessel 2017-11-23 17:07:24 +01:00
parent 0b91112d72
commit 1c2c4d4163
3 changed files with 25 additions and 0 deletions

View file

@ -65,6 +65,15 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice):
self._compressing_gcode = False
self._gcode = []
self.authenticationStateChanged.connect(self._onAuthenticationStateChanged)
def _onAuthenticationStateChanged(self):
# We only accept commands if we are authenticated.
if self._authentication_state == AuthState.Authenticated:
self.setAcceptsCommands(True)
else:
self.setAcceptsCommands(False)
def _setupMessages(self):
self._authentication_requested_message = Message(i18n_catalog.i18nc("@info:status",
"Access to the printer requested. Please approve the request on the printer"),