--- a/src/eric7/MicroPython/UF2FlashDialog.py Wed Mar 15 16:14:59 2023 +0100 +++ b/src/eric7/MicroPython/UF2FlashDialog.py Wed Mar 15 18:01:11 2023 +0100 @@ -657,9 +657,9 @@ @type str @return list of tuples with the board type, the port description, the VID and PID - @rtype list of tuple of (str, str, int, int) + @rtype list of tuple of (str, str, (int, int)) """ - foundDevices = [] + foundDevices = set() availablePorts = QSerialPortInfo.availablePorts() for port in availablePorts: @@ -675,7 +675,7 @@ vid, pid, ) in SupportedUF2Boards[board]["volumes"]: - foundDevices.append( + foundDevices.add( ( board, port.description(), @@ -689,29 +689,17 @@ with contextlib.suppress(KeyError): # find mounted volume volumes = SupportedUF2Boards[board]["volumes"][(0, 0)] - ##foundVolumes = [] for volume, description in volumes: if FileSystemUtilities.findVolume(volume, findAll=True): - foundDevices.append( + foundDevices.add( (board, port.description() or description, (0, 0)) ) - ##foundVolumes += FileSystemUtilities.findVolume(volume[0], findAll=True) - ##if foundVolumes: - ##foundDevices.append( - ##( - ##board, - ##QCoreApplication.translate( - ##"UF2FlashDialog", "'{0}' Board" - ##).format(board), - ##(0, 0), # VID/PID of (0, 0) is special - ##) - ##) # third run for CircuitPython boards in UF2 mode but with VID/PID being invalid for vidpid, volumes in SupportedUF2Boards["circuitpython"]["volumes"].items(): for volume, description in volumes: if FileSystemUtilities.findVolume(volume, findAll=True): - foundDevices.append( + foundDevices.add( ( "circuitpython", port.description() or description, @@ -719,7 +707,7 @@ ) ) - return foundDevices + return list(foundDevices) class UF2FlashDialog(QDialog, Ui_UF2FlashDialog):