From 2a593e316b93e9aabc581bb6c3e96fc0a3d36e28 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 28 Jun 2017 11:49:07 +0200 Subject: [PATCH] Close camera upon disconnecting instead of relying on Uranium to do that Uranium shouldn't know about no camera. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 18bf22d18d..2a9dedc20c 100755 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -188,9 +188,18 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): else: self._updatePrinterType("unknown") + Application.getInstance().getOutputDeviceManager().outputDevicesChanged.connect(self._onOutputDevicesChanged) + def _onNetworkAccesibleChanged(self, accessible): Logger.log("d", "Network accessible state changed to: %s", accessible) + ## Triggered when the output device manager changes devices. + # + # This is how we can detect that our device is no longer active now. + def _onOutputDevicesChanged(self): + if self.getId() not in Application.getInstance().getOutputDeviceManager().getOutputDeviceIds(): + self.stopCamera() + def _onAuthenticationTimer(self): self._authentication_counter += 1 self._authentication_requested_message.setProgress(self._authentication_counter / self._max_authentication_counter * 100)