mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 02:19:04 +08:00
fixed exceptions caused by disconnecting printer
This commit is contained in:
parent
352d8658aa
commit
c0d39ff287
@ -338,8 +338,8 @@ class PrinterConnection(SignalEmitter):
|
|||||||
try:
|
try:
|
||||||
ret = self._serial.readline()
|
ret = self._serial.readline()
|
||||||
except:
|
except:
|
||||||
self._log("Unexpected error while reading serial port.")
|
Logger.log('e',"Unexpected error while reading serial port.")
|
||||||
self._errorValue = getExceptionString()
|
#self._errorValue = getExceptionString()
|
||||||
self.close()
|
self.close()
|
||||||
return None
|
return None
|
||||||
#if ret == '':
|
#if ret == '':
|
||||||
|
@ -51,8 +51,8 @@ class USBPrinterManager(SignalEmitter,PluginObject):
|
|||||||
for serial_port in disconnected_ports: # Close connections and remove them from list.
|
for serial_port in disconnected_ports: # Close connections and remove them from list.
|
||||||
connection = self.getConnectionByPort(serial_port)
|
connection = self.getConnectionByPort(serial_port)
|
||||||
if connection != None:
|
if connection != None:
|
||||||
|
self._printer_connections.remove(connection)
|
||||||
connection.close()
|
connection.close()
|
||||||
self._printer_connections.remove(connection)
|
|
||||||
time.sleep(5) #Throttle, as we don't need this information to be updated every single second.
|
time.sleep(5) #Throttle, as we don't need this information to be updated every single second.
|
||||||
|
|
||||||
## Attempt to connect with all possible connections.
|
## Attempt to connect with all possible connections.
|
||||||
@ -111,7 +111,8 @@ class USBPrinterManager(SignalEmitter,PluginObject):
|
|||||||
'icon': 'print_usb',
|
'icon': 'print_usb',
|
||||||
'priority': 1
|
'priority': 1
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
Application.getInstance().removeOutputDevice(serial_port)
|
||||||
def _writeToSerial(self, serial_port):
|
def _writeToSerial(self, serial_port):
|
||||||
for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()):
|
for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()):
|
||||||
if type(node) is not SceneNode or not node.getMeshData():
|
if type(node) is not SceneNode or not node.getMeshData():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user