From 486fc7f17643332313689a5f222f93deb069a043 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 14 Jun 2016 09:46:01 +0200 Subject: [PATCH] When no globalcontainer is set, no check to connect is performed CURA-49 --- NetworkPrinterOutputDevicePlugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NetworkPrinterOutputDevicePlugin.py b/NetworkPrinterOutputDevicePlugin.py index 946e510608..9c187e5065 100644 --- a/NetworkPrinterOutputDevicePlugin.py +++ b/NetworkPrinterOutputDevicePlugin.py @@ -47,9 +47,10 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin): def addPrinter(self, name, address, properties): printer = NetworkPrinterOutputDevice.NetworkPrinterOutputDevice(name, address, properties) self._printers[printer.getKey()] = printer - if printer.getKey() == Application.getInstance().getGlobalContainerStack().getMetaDataEntry("key"): + global_container_stack = Application.getInstance().getGlobalContainerStack() + if global_container_stack and printer.getKey() == global_container_stack.getMetaDataEntry("key"): self._printers[printer.getKey()].connect() - printer.connectionStateChanged.connect(self._onPrinterConnectionStateChanged) + printer.connectionStateChanged.connect(self._onPrinterConnectionStateChanged) ## Handler for when the connection state of one of the detected printers changes def _onPrinterConnectionStateChanged(self, key):