diff options
author | ChrisTerBeke <ctbeke@gmail.com> | 2018-05-24 15:08:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-24 15:08:52 +0300 |
commit | 965a24b22564b30944adf8a8e29897f1d4437237 (patch) | |
tree | b79d8d5c4d5b06a328d34a63be7a72b1fdaa3fd1 /plugins | |
parent | dc52e939e9fa3d8d82aa9aed0c4b51d9edcfe8b9 (diff) | |
parent | 33e35e114e2b158344e4fd6a8c0412f3ff585e82 (diff) |
Merge pull request #3691 from ohrn/usb-gcode-check3.3
Only open USB ports if the printer understands gcode.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/USBPrinting/USBPrinterOutputDeviceManager.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index 58b6106fb0..5e9cd8ad1b 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -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"): - port_list = self.getSerialPortList(only_list_usb=True) - else: - port_list = [] # Just use an empty list; all USB devices will be removed. + 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) self._addRemovePorts(port_list) time.sleep(5) |