CircuitPython: added downloads menu for Firmware and Libraries.

Tue, 02 Feb 2021 14:32:59 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 02 Feb 2021 14:32:59 +0100
changeset 8053
5316e335722f
parent 8052
22d519ab13df
child 8054
3d9db64dff2f

CircuitPython: added downloads menu for Firmware and Libraries.

eric6/MicroPython/CircuitPythonDevices.py file | annotate | diff | comparison | revisions
eric6/MicroPython/MicroPythonWidget.py file | annotate | diff | comparison | revisions
eric6/Preferences/ConfigurationPages/MicroPythonPage.py file | annotate | diff | comparison | revisions
eric6/Preferences/ConfigurationPages/MicroPythonPage.ui file | annotate | diff | comparison | revisions
eric6/Preferences/__init__.py file | annotate | diff | comparison | revisions
--- a/eric6/MicroPython/CircuitPythonDevices.py	Tue Feb 02 09:45:20 2021 +0100
+++ b/eric6/MicroPython/CircuitPythonDevices.py	Tue Feb 02 14:32:59 2021 +0100
@@ -243,12 +243,27 @@
         @rtype str
         """
         return Preferences.getMicroPython("CircuitPythonDocuUrl")
+##    
+##    def getFirmwareUrl(self):
+##        """
+##        Public method to get the device firmware download URL.
+##        
+##        @return firmware download URL of the device
+##        @rtype str
+##        """
+##        return Preferences.getMicroPython("CircuitPythonFirmwareUrl")
     
-    def getFirmwareUrl(self):
+    def getDownloadMenuEntries(self):
         """
-        Public method to get the device firmware download URL.
+        Public method to retrieve the entries for the downloads menu.
         
-        @return firmware download URL of the device
-        @rtype str
+        @return list of tuples with menu text and URL to be opened for each
+            entry
+        @rtype list of tuple of (str, str)
         """
-        return Preferences.getMicroPython("CircuitPythonFirmwareUrl")
+        return [
+            (self.tr("CircuitPython Firmware"),
+             Preferences.getMicroPython("CircuitPythonFirmwareUrl")),
+            (self.tr("CircuitPython Libraries"),
+             Preferences.getMicroPython("CircuitPythonLibrariesUrl"))
+        ]
--- a/eric6/MicroPython/MicroPythonWidget.py	Tue Feb 02 09:45:20 2021 +0100
+++ b/eric6/MicroPython/MicroPythonWidget.py	Tue Feb 02 14:32:59 2021 +0100
@@ -309,7 +309,7 @@
                     index, board, self.DeviceTypeRole)
                 self.deviceTypeComboBox.setItemData(
                     index, portName, self.DevicePortRole)
-                
+            
         else:
             self.deviceInfoLabel.setText(
                 self.tr("No supported devices detected."))
--- a/eric6/Preferences/ConfigurationPages/MicroPythonPage.py	Tue Feb 02 09:45:20 2021 +0100
+++ b/eric6/Preferences/ConfigurationPages/MicroPythonPage.py	Tue Feb 02 14:32:59 2021 +0100
@@ -104,6 +104,8 @@
         # CircuitPython URLs
         self.circuitpythonFirmwareUrlLineEdit.setText(
             Preferences.getMicroPython("CircuitPythonFirmwareUrl"))
+        self.circuitpythonLibrariesUrlLineEdit.setText(
+            Preferences.getMicroPython("CircuitPythonLibrariesUrl"))
         self.circuitpythonDocuUrlLineEdit.setText(
             Preferences.getMicroPython("CircuitPythonDocuUrl"))
         
@@ -173,6 +175,9 @@
             "CircuitPythonFirmwareUrl",
             self.circuitpythonFirmwareUrlLineEdit.text())
         Preferences.setMicroPython(
+            "CircuitPythonLibrariesUrl",
+            self.circuitpythonLibrariesUrlLineEdit.text())
+        Preferences.setMicroPython(
             "CircuitPythonDocuUrl",
             self.circuitpythonDocuUrlLineEdit.text())
         
--- a/eric6/Preferences/ConfigurationPages/MicroPythonPage.ui	Tue Feb 02 09:45:20 2021 +0100
+++ b/eric6/Preferences/ConfigurationPages/MicroPythonPage.ui	Tue Feb 02 14:32:59 2021 +0100
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>476</width>
-    <height>1001</height>
+    <height>1031</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
@@ -285,13 +285,30 @@
        </widget>
       </item>
       <item row="1" column="0">
+       <widget class="QLabel" name="label_22">
+        <property name="text">
+         <string>Libraries:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="E5ClearableLineEdit" name="circuitpythonLibrariesUrlLineEdit">
+        <property name="toolTip">
+         <string>Enter the URL for the CircuitPython libraries</string>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
        <widget class="QLabel" name="label_16">
         <property name="text">
          <string>Documentation:</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="1">
+      <item row="2" column="1">
        <widget class="E5ClearableLineEdit" name="circuitpythonDocuUrlLineEdit">
         <property name="toolTip">
          <string>Enter the URL for the CircuitPython documentation</string>
@@ -442,6 +459,7 @@
   <tabstop>micropythonFirmwareUrlLineEdit</tabstop>
   <tabstop>micropythonDocuUrlLineEdit</tabstop>
   <tabstop>circuitpythonFirmwareUrlLineEdit</tabstop>
+  <tabstop>circuitpythonLibrariesUrlLineEdit</tabstop>
   <tabstop>circuitpythonDocuUrlLineEdit</tabstop>
   <tabstop>microbitFirmwareUrlLineEdit</tabstop>
   <tabstop>microbitMicroPythonUrlLineEdit</tabstop>
--- a/eric6/Preferences/__init__.py	Tue Feb 02 09:45:20 2021 +0100
+++ b/eric6/Preferences/__init__.py	Tue Feb 02 14:32:59 2021 +0100
@@ -1455,17 +1455,21 @@
         "MpyCrossCompiler": "",         # path of the mpy-cross compiler
         "DfuUtilPath": "",              # path of the dfu-util flashing tool
         "IgnoredUnknownDevices": "[]",  # empty list encoded as JSON
+        
         # MicroPython URLs
         "MicroPythonDocuUrl":
             "https://docs.micropython.org/en/latest/",
         "MicroPythonFirmwareUrl":
             "http://micropython.org/download/",
+        
         # CircuitPython URLS
         "CircuitPythonDocuUrl":
             "https://circuitpython.readthedocs.io/en/latest/",
         "CircuitPythonFirmwareUrl":
             "https://circuitpython.org/downloads/",
-        # TODO: add entry for Adafruit library
+        "CircuitPythonLibrariesUrl":
+            "https://circuitpython.org/libraries",
+        
         # BBC micro:bit URLs
         "MicrobitDocuUrl":
             "https://microbit-micropython.readthedocs.io/en/latest/",
@@ -1473,6 +1477,7 @@
             "https://microbit.org/guide/firmware/",
         "MicrobitMicroPythonUrl":
             "https://github.com/bbcmicrobit/micropython/releases/",
+        
         # calliope mini URLS
         "CalliopeDocuUrl":
             "https://github.com/calliope-mini/calliope-mini-micropython/",

eric ide

mercurial