diff -r a5c4ac339f2a -r 7cbb1ebf8d2d eric6/MicroPython/ConnectionSelectionDialog.py --- a/eric6/MicroPython/ConnectionSelectionDialog.py Wed Feb 24 20:17:35 2021 +0100 +++ b/eric6/MicroPython/ConnectionSelectionDialog.py Thu Feb 25 17:52:28 2021 +0100 @@ -50,7 +50,6 @@ index, portName, self.PortNameRole) self.portNameComboBox.setItemData( index, (vid, pid), self.VidPidRole) - self.portNameComboBox.setCurrentText(currentPort) self.deviceTypeComboBox.addItem("", "") for board, description in sorted( @@ -58,8 +57,18 @@ key=lambda x: x[1] ): self.deviceTypeComboBox.addItem(description, board) - index = self.deviceTypeComboBox.findData(currentType) - self.deviceTypeComboBox.setCurrentIndex(index) + + if self.portNameComboBox.currentText(): + # some ports were found; use the previously selected type as + # default + portIndex = self.portNameComboBox.findData( + currentPort, self.PortNameRole) + typeIndex = self.deviceTypeComboBox.findData(currentType) + else: + portIndex = 0 + typeIndex = 0 + self.portNameComboBox.setCurrentIndex(portIndex) + self.deviceTypeComboBox.setCurrentIndex(typeIndex) self.__updateOK()