eric6/MicroPython/MicroPythonWidget.py

changeset 8134
a5c4ac339f2a
parent 8133
4d1d1c248f79
child 8135
7cbb1ebf8d2d
diff -r 4d1d1c248f79 -r a5c4ac339f2a eric6/MicroPython/MicroPythonWidget.py
--- a/eric6/MicroPython/MicroPythonWidget.py	Wed Feb 24 17:55:10 2021 +0100
+++ b/eric6/MicroPython/MicroPythonWidget.py	Wed Feb 24 20:17:35 2021 +0100
@@ -1008,17 +1008,22 @@
         """
         port = self.getCurrentPort()
         if not port:
-            # TODO: implement port and device selection dialog
-            deviceType = "circuitpython"
-            port = "ttyACM0"
-            vid = 0
-            pid = 0
-            
-            self.deviceIconLabel.setPixmap(MicroPythonDevices.getDeviceIcon(
-                deviceType, False))
-            self.__device = MicroPythonDevices.getDevice(deviceType, self,
-                                                         vid, pid)
-            self.__device.setButtons()
+            from .ConnectionSelectionDialog import ConnectionSelectionDialog
+            with E5OverridenCursor():
+                dlg = ConnectionSelectionDialog(
+                    self.__unknownPorts, self.__lastPort, self.__lastDeviceType
+                )
+                if dlg.exec() == QDialog.Accepted:
+                    vid, pid, port, deviceType = dlg.getData()
+                    
+                    self.deviceIconLabel.setPixmap(
+                        MicroPythonDevices.getDeviceIcon(deviceType, False))
+                    self.__device = MicroPythonDevices.getDevice(
+                        deviceType, self, vid, pid)
+                    self.__device.setButtons()
+                    
+                    self.__lastPort = port
+                    self.__lastDeviceType = deviceType
         
         if self.__interface.connectToDevice(port):
             self.__setConnected(True)

eric ide

mercurial