eric6/MicroPython/MicroPythonDevices.py

changeset 8062
8dc5acb30a8b
parent 8055
52fdd41517f3
child 8067
a467ab075be0
diff -r 979562f350bf -r 8dc5acb30a8b eric6/MicroPython/MicroPythonDevices.py
--- a/eric6/MicroPython/MicroPythonDevices.py	Wed Feb 03 19:14:35 2021 +0100
+++ b/eric6/MicroPython/MicroPythonDevices.py	Wed Feb 03 19:15:58 2021 +0100
@@ -12,6 +12,7 @@
 import os
 
 from PyQt5.QtCore import pyqtSlot, QObject
+from PyQt5.QtWidgets import QInputDialog
 
 from E5Gui.E5Application import e5App
 
@@ -58,8 +59,9 @@
             (0x04D8, 0xED94),       # PyCubed
             (0x04D8, 0xEDBE),       # SAM32
             (0x1D50, 0x60E8),       # PewPew Game Console
+            (0x2886, 0x002F),       # Seeed XIAO
             (0x2886, 0x802D),       # Seeed Wio Terminal
-            (0x2886, 0x002F),       # Seeed XIAO
+            (0x2886, 0x802F),       # Seeed XIAO
             (0x1B4F, 0x0016),       # Sparkfun Thing Plus - SAMD51
             (0x2341, 0x8057),       # Arduino Nano 33 IoT board
             (0x04D8, 0xEAD1),       # DynOSSAT-EDU-EPS
@@ -361,6 +363,28 @@
         return (Preferences.getMultiProject("Workspace") or
                 os.path.expanduser("~"))
     
+    def selectDeviceDirectory(self, deviceDirectories):
+        """
+        Public method to select the device directory from a list of detected
+        ones.
+        
+        @param deviceDirectories list of directories to select from
+        @type list of str
+        @return selected directory or an empty string
+        @rtype str
+        """
+        deviceDirectory, ok = QInputDialog.getItem(
+            None,
+            self.tr("Select Device Directory"),
+            self.tr("Select the directory for the connected device:"),
+            [""] + deviceDirectories,
+            0, False)
+        if ok:
+            return deviceDirectory
+        else:
+            # user cancelled
+            return ""
+    
     def sendCommands(self, commandsList):
         """
         Public method to send a list of commands to the device.

eric ide

mercurial