mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-07-24 20:04:27 +08:00
Properly close all open USB connections on shut down
Contributes to #82
This commit is contained in:
parent
a83bcedb22
commit
20874d88ad
@ -46,6 +46,8 @@ class USBPrinterManager(QObject, SignalEmitter, Extension):
|
||||
## Add menu item to top menu of the application.
|
||||
self.setMenuName("Firmware")
|
||||
self.addMenuItem(i18n_catalog.i18n("Update Firmware"), self.updateAllFirmware)
|
||||
|
||||
Application.getInstance().applicationShuttingDown.connect(self._onApplicationShuttingDown)
|
||||
|
||||
pyqtError = pyqtSignal(str, arguments = ["error"])
|
||||
processingProgress = pyqtSignal(float, arguments = ["amount"])
|
||||
@ -292,3 +294,7 @@ class USBPrinterManager(QObject, SignalEmitter, Extension):
|
||||
else:
|
||||
base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.*") + glob.glob("/dev/tty.usb*") + glob.glob("/dev/rfcomm*") + glob.glob("/dev/serial/by-id/*")
|
||||
return base_list
|
||||
|
||||
def _onApplicationShuttingDown(self):
|
||||
for connection in self._printer_connections:
|
||||
connection.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user