eric6/MicroPython/MicrobitDevices.py

changeset 7552
b62e73df71dd
parent 7551
b159c55ea6dd
child 7780
41420f82c0ac
diff -r b159c55ea6dd -r b62e73df71dd eric6/MicroPython/MicrobitDevices.py
--- a/eric6/MicroPython/MicrobitDevices.py	Thu Apr 23 19:48:12 2020 +0200
+++ b/eric6/MicroPython/MicrobitDevices.py	Fri Apr 24 18:35:42 2020 +0200
@@ -189,7 +189,8 @@
             "Save the current script as 'main.py' on the connected device"))
         act.setEnabled(connected)
         menu.addSeparator()
-        act = menu.addAction(self.tr("Reset micro:bit"), self.__resetDevice)
+        act = menu.addAction(self.tr("Reset {0}").format(self.deviceName()),
+                             self.__resetDevice)
         act.setEnabled(connected)
     
     @pyqtSlot()
@@ -198,8 +199,14 @@
         Private slot to flash the default MicroPython firmware to the device.
         """
         # Attempts to find the path on the filesystem that represents the
-        # plugged in micro:bit board in maintenance mode.
-        deviceDirectory = Utilities.findVolume("MAINTENANCE")
+        # plugged in micro:bit board in maintenance mode or Calliope mini
+        # board in standard mode.
+        if self.__deviceType == "bbc_microbit":
+            # BBC micro:bit
+            deviceDirectory = Utilities.findVolume("MAINTENANCE")
+        else:
+            # Calliope mini
+            deviceDirectory = Utilities.findVolume("MINI")
         if not deviceDirectory:
             if self.__deviceType == "bbc_microbit":
                 # BBC micro:bit is not ready or not mounted
@@ -222,20 +229,12 @@
                     ))
             else:
                 # Calliope mini is not ready or not mounted
-                E5MessageBox.critical(
+                E5MessageBox.warning(
                     self.microPython,
                     self.tr("Flash MicroPython Firmware"),
-                    self.tr(
-                        '<p>The Calliope mini is not ready for flashing.'
-                        ' Follow these instructions.</p>'
-                        '<ul>'
-                        '<li>unplug USB cable and any batteries</li>'
-                        '<li>keep RESET button pressed an plug USB cable back'
-                        ' in</li>'
-                        '<li>a drive called MAINTENANCE should be available'
-                        '</li>'
-                        '</ul>'
-                    ))
+                    self.tr("Could not find an attached {0}.\n\n"
+                            "Please make sure the device is plugged "
+                            "into this computer.").format(self.deviceName()))
         else:
             downloadsPath = QStandardPaths.standardLocations(
                 QStandardPaths.DownloadLocation)[0]
@@ -334,7 +333,6 @@
                 "microbit.reset()",
             ])
         else:
-            # TODO: try this branch with a Calliope mini
             # Calliope mini
             self.microPython.commandsInterface().execute([
                 "import calliope_mini",

eric ide

mercurial