UpdateThread now correctly uses join upon close

CURA-49
This commit is contained in:
Jaime van Kessel 2016-04-19 11:44:51 +02:00
parent cf061b2fbe
commit 94ed8c8177

View file

@ -20,7 +20,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
self._http_lock = threading.Lock() self._http_lock = threading.Lock()
self._http_connection = None self._http_connection = None
self._file = None self._file = None
self._thread = None self._update_thread = None
self._json_printer_state = None self._json_printer_state = None
@ -73,7 +73,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
def close(self): def close(self):
self._connection_state == ConnectionState.closed self._connection_state == ConnectionState.closed
self._thread = None self._update_thread.join()
self._update_thread = None
def requestWrite(self, node, file_name = None, filter_by_machine = False): def requestWrite(self, node, file_name = None, filter_by_machine = False):
self._file = getattr(Application.getInstance().getController().getScene(), "gcode_list") self._file = getattr(Application.getInstance().getController().getScene(), "gcode_list")
@ -84,11 +85,11 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
## Start the polling thread. ## Start the polling thread.
def connect(self): def connect(self):
if self._thread is None: if self._update_thread is None:
self.setConnectionState(ConnectionState.connecting) self.setConnectionState(ConnectionState.connecting)
self._thread = threading.Thread(target = self._update) self._update_thread = threading.Thread(target = self._update)
self._thread.daemon = True self._update_thread.daemon = True
self._thread.start() self._update_thread.start()
def getCameraImage(self): def getCameraImage(self):
pass #Do Nothing pass #Do Nothing