Sat, 02 Nov 2019 19:24:46 +0100
MicroPython:
- added a menu entry to open the firmware download page of a device
--- a/docs/changelog Sat Nov 02 18:21:01 2019 +0100 +++ b/docs/changelog Sat Nov 02 19:24:46 2019 +0100 @@ -5,6 +5,7 @@ - MicroPython -- added a menu entry to show the local and device time side-by-side -- added a PyBoard menu entry to flash a new firmware + -- added a menu entry to open the firmware download page of a device Version 19.11: - bug fixes
--- a/eric6/MicroPython/CircuitPythonDevices.py Sat Nov 02 18:21:01 2019 +0100 +++ b/eric6/MicroPython/CircuitPythonDevices.py Sat Nov 02 19:24:46 2019 +0100 @@ -244,3 +244,12 @@ @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")
--- a/eric6/MicroPython/EspDevices.py Sat Nov 02 18:21:01 2019 +0100 +++ b/eric6/MicroPython/EspDevices.py Sat Nov 02 19:24:46 2019 +0100 @@ -246,3 +246,12 @@ @rtype str """ return Preferences.getMicroPython("MicroPythonDocuUrl") + + def getFirmwareUrl(self): + """ + Public method to get the device firmware download URL. + + @return firmware download URL of the device + @rtype str + """ + return Preferences.getMicroPython("MicroPythonFirmwareUrl")
--- a/eric6/MicroPython/MicroPythonDevices.py Sat Nov 02 18:21:01 2019 +0100 +++ b/eric6/MicroPython/MicroPythonDevices.py Sat Nov 02 19:24:46 2019 +0100 @@ -368,3 +368,22 @@ @rtype str """ return "" + + def hasFirmwareUrl(self): + """ + Public method to check, if the device has a configured firmware + download URL. + + @return flag indicating a configured firmware download URL + @rtype bool + """ + return bool(self.getFirmwareUrl()) + + def getFirmwareUrl(self): + """ + Public method to get the device firmware download URL. + + @return firmware download URL of the device + @rtype str + """ + return ""
--- a/eric6/MicroPython/MicroPythonWidget.py Sat Nov 02 18:21:01 2019 +0100 +++ b/eric6/MicroPython/MicroPythonWidget.py Sat Nov 02 19:24:46 2019 +0100 @@ -1128,6 +1128,10 @@ self.__device.addDeviceMenuEntries(self.__superMenu) self.__superMenu.addSeparator() act = self.__superMenu.addAction( + self.tr("Download Firmware"), self.__downloadFirmware) + act.setEnabled(self.__device.hasFirmwareUrl()) + self.__superMenu.addSeparator() + act = self.__superMenu.addAction( self.tr("Show Documentation"), self.__showDocumentation) act.setEnabled(self.__device.hasDocumentationUrl()) self.__superMenu.addSeparator() @@ -1452,6 +1456,18 @@ e5App().getObject("UserInterface").launchHelpViewer(url) @pyqtSlot() + def __downloadFirmware(self): + """ + Private slot to open the firmware download page. + """ + if self.__device is None or not self.__device.hasFirmwareUrl(): + # abort silently + return + + url = self.__device.getFirmwareUrl() + e5App().getObject("UserInterface").launchHelpViewer(url) + + @pyqtSlot() def __configure(self): """ Private slot to open the MicroPython configuration page.
--- a/eric6/MicroPython/MicrobitDevices.py Sat Nov 02 18:21:01 2019 +0100 +++ b/eric6/MicroPython/MicrobitDevices.py Sat Nov 02 19:24:46 2019 +0100 @@ -299,3 +299,12 @@ @rtype str """ return Preferences.getMicroPython("MicrobitDocuUrl") + + def getFirmwareUrl(self): + """ + Public method to get the device firmware download URL. + + @return firmware download URL of the device + @rtype str + """ + return Preferences.getMicroPython("MicrobitFirmwareUrl")
--- a/eric6/MicroPython/PyBoardDevices.py Sat Nov 02 18:21:01 2019 +0100 +++ b/eric6/MicroPython/PyBoardDevices.py Sat Nov 02 19:24:46 2019 +0100 @@ -180,7 +180,16 @@ @rtype str """ return Preferences.getMicroPython("MicroPythonDocuUrl") - + + def getFirmwareUrl(self): + """ + Public method to get the device firmware download URL. + + @return firmware download URL of the device + @rtype str + """ + return Preferences.getMicroPython("MicroPythonFirmwareUrl") + def addDeviceMenuEntries(self, menu): """ Public method to add device specific entries to the given menu.
--- a/eric6/Preferences/ConfigurationPages/MicroPythonPage.py Sat Nov 02 18:21:01 2019 +0100 +++ b/eric6/Preferences/ConfigurationPages/MicroPythonPage.py Sat Nov 02 19:24:46 2019 +0100 @@ -56,6 +56,12 @@ Preferences.getMicroPython("MpyCrossCompiler")) self.dfuUtilPathPicker.setText( Preferences.getMicroPython("DfuUtilPath")) + self.micropythonFirmwareUrlLineEdit.setText( + Preferences.getMicroPython("MicroPythonFirmwareUrl")) + self.circuitpythonFirmwareUrlLineEdit.setText( + Preferences.getMicroPython("CircuitPythonFirmwareUrl")) + self.microbitFirmwareUrlLineEdit.setText( + Preferences.getMicroPython("MicrobitFirmwareUrl")) self.micropythonDocuUrlLineEdit.setText( Preferences.getMicroPython("MicroPythonDocuUrl")) self.circuitpythonDocuUrlLineEdit.setText( @@ -68,24 +74,42 @@ Public slot to save the MicroPython configuration. """ Preferences.setMicroPython( - "SerialTimeout", self.timeoutSpinBox.value() * 1000) + "SerialTimeout", + self.timeoutSpinBox.value() * 1000) # converted to milliseconds Preferences.setMicroPython( - "SyncTimeAfterConnect", self.syncTimeCheckBox.isChecked()) + "SyncTimeAfterConnect", + self.syncTimeCheckBox.isChecked()) Preferences.setMicroPython( - "ColorScheme", self.colorSchemeComboBox.currentText()) + "ColorScheme", + self.colorSchemeComboBox.currentText()) Preferences.setMicroPython( - "ReplLineWrap", self.replWrapCheckBox.isChecked()) + "ReplLineWrap", + self.replWrapCheckBox.isChecked()) Preferences.setMicroPython( - "MpyCrossCompiler", self.mpyCrossPicker.text()) + "MpyCrossCompiler", + self.mpyCrossPicker.text()) + Preferences.setMicroPython( + "DfuUtilPath", + self.dfuUtilPathPicker.text()) Preferences.setMicroPython( - "DfuUtilPath", self.dfuUtilPathPicker.text()) + "MicroPythonFirmwareUrl", + self.micropythonFirmwareUrlLineEdit.text()) Preferences.setMicroPython( - "MicroPythonDocuUrl", self.micropythonDocuUrlLineEdit.text()) + "CircuitPythonFirmwareUrl", + self.circuitpythonFirmwareUrlLineEdit.text()) + Preferences.setMicroPython( + "MicrobitFirmwareUrl", + self.microbitFirmwareUrlLineEdit.text()) Preferences.setMicroPython( - "CircuitPythonDocuUrl", self.circuitpythonDocuUrlLineEdit.text()) + "MicroPythonDocuUrl", + self.micropythonDocuUrlLineEdit.text()) Preferences.setMicroPython( - "MicrobitDocuUrl", self.microbitDocuUrlLineEdit.text()) + "CircuitPythonDocuUrl", + self.circuitpythonDocuUrlLineEdit.text()) + Preferences.setMicroPython( + "MicrobitDocuUrl", + self.microbitDocuUrlLineEdit.text()) def create(dlg):
--- a/eric6/Preferences/ConfigurationPages/MicroPythonPage.ui Sat Nov 02 18:21:01 2019 +0100 +++ b/eric6/Preferences/ConfigurationPages/MicroPythonPage.ui Sat Nov 02 19:24:46 2019 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>476</width> - <height>691</height> + <height>869</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> @@ -199,6 +199,57 @@ </widget> </item> <item> + <widget class="QGroupBox" name="groupBox_6"> + <property name="title"> + <string>Firmware</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>MicroPython:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="E5ClearableLineEdit" name="micropythonFirmwareUrlLineEdit"> + <property name="toolTip"> + <string>Enter the URL for the MicroPython firmware for PyBoard, ESP8266 and ESP32</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>CircuitPython:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5ClearableLineEdit" name="circuitpythonFirmwareUrlLineEdit"> + <property name="toolTip"> + <string>Enter the URL for the CircuitPython firmware</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>BBC micro:bit:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="E5ClearableLineEdit" name="microbitFirmwareUrlLineEdit"> + <property name="toolTip"> + <string>Enter the URL for the BBC micro:bit Firmware</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> <widget class="QGroupBox" name="groupBox_4"> <property name="title"> <string>Documentation</string> @@ -284,6 +335,9 @@ <tabstop>replWrapCheckBox</tabstop> <tabstop>mpyCrossPicker</tabstop> <tabstop>dfuUtilPathPicker</tabstop> + <tabstop>micropythonFirmwareUrlLineEdit</tabstop> + <tabstop>circuitpythonFirmwareUrlLineEdit</tabstop> + <tabstop>microbitFirmwareUrlLineEdit</tabstop> <tabstop>micropythonDocuUrlLineEdit</tabstop> <tabstop>circuitpythonDocuUrlLineEdit</tabstop> <tabstop>microbitDocuUrlLineEdit</tabstop>
--- a/eric6/Preferences/__init__.py Sat Nov 02 18:21:01 2019 +0100 +++ b/eric6/Preferences/__init__.py Sat Nov 02 19:24:46 2019 +0100 @@ -1458,8 +1458,10 @@ "https://circuitpython.readthedocs.io/en/latest/", "MicrobitDocuUrl": "https://microbit-micropython.readthedocs.io/en/latest/", + "MicroPythonFirmwareUrl": "http://micropython.org/download", + "CircuitPythonFirmwareUrl": "https://circuitpython.org/downloads", + "MicrobitFirmwareUrl": "https://microbit.org/guide/firmware/", } - # TODO: add URLs for getting the firmware if Globals.isWindowsPlatform(): microPythonDefaults["ColorScheme"] = "Windows 10" elif Globals.isMacPlatform():