fixed exceptions caused by disconnecting printer

This commit is contained in:
Jaime van Kessel 2015-04-07 15:19:44 +02:00
parent 352d8658aa
commit c0d39ff287
2 changed files with 5 additions and 4 deletions

View file

@ -51,8 +51,8 @@ class USBPrinterManager(SignalEmitter,PluginObject):
for serial_port in disconnected_ports: # Close connections and remove them from list.
connection = self.getConnectionByPort(serial_port)
if connection != None:
self._printer_connections.remove(connection)
connection.close()
self._printer_connections.remove(connection)
time.sleep(5) #Throttle, as we don't need this information to be updated every single second.
## Attempt to connect with all possible connections.
@ -111,7 +111,8 @@ class USBPrinterManager(SignalEmitter,PluginObject):
'icon': 'print_usb',
'priority': 1
})
else:
Application.getInstance().removeOutputDevice(serial_port)
def _writeToSerial(self, serial_port):
for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()):
if type(node) is not SceneNode or not node.getMeshData():