eric6/MicroPython/MicroPythonWidget.py

changeset 8137
97d37389fbfd
parent 8135
7cbb1ebf8d2d
child 8139
418c2d9a767d
--- a/eric6/MicroPython/MicroPythonWidget.py	Sat Feb 27 10:20:34 2021 +0100
+++ b/eric6/MicroPython/MicroPythonWidget.py	Sat Feb 27 11:28:22 2021 +0100
@@ -197,6 +197,8 @@
     
     dataReceived = pyqtSignal(bytes)
     
+    ManualMarker = "<manual>"
+    
     def __init__(self, parent=None):
         """
         Constructor
@@ -340,7 +342,13 @@
         
         self.__unknownPorts = unknownPorts
         if self.__unknownPorts:
-            self.connectButton.setEnabled(True)
+            if self.deviceTypeComboBox.count():
+                self.deviceTypeComboBox.insertSeparator(
+                    self.deviceTypeComboBox.count())
+            self.deviceTypeComboBox.addItem(self.tr("Manual Selection"))
+            self.deviceTypeComboBox.setItemData(
+                self.deviceTypeComboBox.count() - 1,
+                self.ManualMarker, self.DeviceTypeRole)
         
         index = self.deviceTypeComboBox.findText(currentDevice,
                                                  Qt.MatchExactly)
@@ -455,20 +463,22 @@
         """
         deviceType = self.deviceTypeComboBox.itemData(
             index, self.DeviceTypeRole)
-        self.deviceIconLabel.setPixmap(MicroPythonDevices.getDeviceIcon(
-            deviceType, False))
-        
-        vid = self.deviceTypeComboBox.itemData(
-            index, self.DeviceVidRole)
-        pid = self.deviceTypeComboBox.itemData(
-            index, self.DevicePidRole)
-        
-        self.__device = MicroPythonDevices.getDevice(deviceType, self,
-                                                     vid, pid)
-        self.__device.setButtons()
-        
-        self.connectButton.setEnabled(bool(deviceType) or
-                                      bool(self.__unknownPorts))
+        if deviceType == self.ManualMarker:
+            self.connectButton.setEnabled(bool(self.__unknownPorts))
+        else:
+            self.deviceIconLabel.setPixmap(MicroPythonDevices.getDeviceIcon(
+                deviceType, False))
+            
+            vid = self.deviceTypeComboBox.itemData(
+                index, self.DeviceVidRole)
+            pid = self.deviceTypeComboBox.itemData(
+                index, self.DevicePidRole)
+            
+            self.__device = MicroPythonDevices.getDevice(deviceType, self,
+                                                         vid, pid)
+            self.__device.setButtons()
+            
+            self.connectButton.setEnabled(bool(deviceType))
     
     @pyqtSlot()
     def on_checkButton_clicked(self):

eric ide

mercurial