Merge pull request #3691 from ohrn/usb-gcode-check

Only open USB ports if the printer understands gcode.
This commit is contained in:
ChrisTerBeke 2018-05-24 14:08:52 +02:00 committed by GitHub
commit 965a24b225
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,10 +65,11 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin):
if container_stack is None:
time.sleep(5)
continue
port_list = [] # Just an empty list; all USB devices will be removed.
if container_stack.getMetaDataEntry("supports_usb_connection"):
machine_file_formats = [file_type.strip() for file_type in container_stack.getMetaDataEntry("file_formats").split(";")]
if "text/x-gcode" in machine_file_formats:
port_list = self.getSerialPortList(only_list_usb=True)
else:
port_list = [] # Just use an empty list; all USB devices will be removed.
self._addRemovePorts(port_list)
time.sleep(5)