From 8714ff9edb30464cbbffaa47cc74afb4fb798f7f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 21 Jul 2020 17:32:59 +0200 Subject: [PATCH 1/3] Add more explanations for HWID being None --- plugins/USBPrinting/USBPrinterOutputDeviceManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index e3834808db..e4438e09db 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -117,7 +117,7 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin): for port in serial.tools.list_ports.comports(): if not isinstance(port, tuple): port = (port.device, port.description, port.hwid) - if not port[2]: # HWID may be None if the port got disconnected while processing. + if not port[2]: # HWID may be None if the port got disconnected while processing, the device is not USB or the system doesn't report the type. continue if only_list_usb and not port[2].startswith("USB"): continue From 9daab5ed9b8aec2f3d74b4018d4d32c9054b74bf Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 22 Jul 2020 09:50:46 +0200 Subject: [PATCH 2/3] Workaround for bug in PySerial: Don't crash if file doesn't exist Gonna report this upstream at the PySerial folks, if nobody else found this yet. Fixes Sentry issue CURA-11W. --- plugins/USBPrinting/USBPrinterOutputDeviceManager.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index e4438e09db..1e9b46cb1c 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -114,10 +114,14 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin): :param only_list_usb: If true, only usb ports are listed """ base_list = [] - for port in serial.tools.list_ports.comports(): + try: + port_list = serial.tools.list_ports.comports() + except TypeError: # Bug in PySerial causes a TypeError if port gets disconnected while processing. + port_list = [] + for port in port_list: if not isinstance(port, tuple): port = (port.device, port.description, port.hwid) - if not port[2]: # HWID may be None if the port got disconnected while processing, the device is not USB or the system doesn't report the type. + if not port[2]: # HWID may be None if the device is not USB or the system doesn't report the type. continue if only_list_usb and not port[2].startswith("USB"): continue From 302e0c627761cdd724e3be87abdac46a1d8b8222 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 22 Jul 2020 11:04:58 +0200 Subject: [PATCH 3/3] Remove redundant button. As discussed in the CCB this morning. Since the new profile will be the _changed to_ profile rather than the _changed from_ (the latter of which would make the button useful, but since the profile is already switched at that point it would be a lot of work), the 'Create New Profile ...' button (in the Keep/Discard dialog) is redundant, since you can always create a new profile if you select keep changes. --- .../qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml index a5ee7b5986..a22a5ca4f4 100644 --- a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml +++ b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml @@ -216,14 +216,5 @@ UM.Dialog base.hide() } } - - Button - { - id: createNewProfileButton - text: catalog.i18nc("@action:button", "Create New Profile"); - anchors.left: parent.left - action: Cura.Actions.addProfile - onClicked: base.hide() - } } } \ No newline at end of file