src/eric7/MicroPython/UF2FlashDialog.py

branch
eric7
changeset 9953
1aa8517bc61f
parent 9904
5d9a7d1afbd9
child 9954
7c5fa3eef082
diff -r 073eef323595 -r 1aa8517bc61f src/eric7/MicroPython/UF2FlashDialog.py
--- a/src/eric7/MicroPython/UF2FlashDialog.py	Fri Mar 31 09:50:43 2023 +0200
+++ b/src/eric7/MicroPython/UF2FlashDialog.py	Fri Mar 31 09:53:27 2023 +0200
@@ -785,7 +785,6 @@
                 self.__showSpecificInstructions(list(devices))
             else:
                 self.__showAllInstructions()
-            self.devicesComboBox.addItem("")
             self.devicesComboBox.addItem(self.tr("Manual Select"))
             self.devicesComboBox.setItemData(1, self.__manualType, self.DeviceTypeRole)
         elif len(devices) == 1:
@@ -799,10 +798,7 @@
             self.devicesComboBox.setItemData(1, self.__manualType, self.DeviceTypeRole)
             self.on_devicesComboBox_currentIndexChanged(0)
         else:
-            self.devicesComboBox.addItem("")
-            for index, (boardType, description, vidpid) in enumerate(
-                sorted(devices), 1
-            ):
+            for index, (boardType, description, vidpid) in enumerate(sorted(devices)):
                 self.devicesComboBox.addItem(description)
                 self.devicesComboBox.setItemData(index, boardType, self.DeviceTypeRole)
                 self.devicesComboBox.setItemData(index, vidpid, self.DeviceVidPidRole)
@@ -811,12 +807,14 @@
                 index + 1, self.__manualType, self.DeviceTypeRole
             )
 
-        # reselect the remembered device, if it is still there
+        # select the remembered device, if it is still there
         if currentDevice:
             self.devicesComboBox.setCurrentText(currentDevice)
             self.firmwarePicker.setText(firmwareFile)
+        elif len(devices) == 1:
+            self.devicesComboBox.setCurrentIndex(0)
         else:
-            self.devicesComboBox.setCurrentIndex(0)
+            self.devicesComboBox.setCurrentIndex(-1)
 
     def __updateFlashButton(self):
         """

eric ide

mercurial