eric7/MicroPython/EspBackupRestoreFirmwareDialog.py

branch
eric7
changeset 8945
b6be65111565
parent 8924
7f2cad9900cf
child 8955
202286fb4574
diff -r 84ff40a56784 -r b6be65111565 eric7/MicroPython/EspBackupRestoreFirmwareDialog.py
--- a/eric7/MicroPython/EspBackupRestoreFirmwareDialog.py	Tue Feb 08 16:22:59 2022 +0100
+++ b/eric7/MicroPython/EspBackupRestoreFirmwareDialog.py	Sat Feb 12 13:02:35 2022 +0100
@@ -36,6 +36,7 @@
     )
     
     FlashModes = [
+        ("", ""),
         ("Quad I/O", "qio"),
         ("Quad Output", "qout"),
         ("Dual I/O", "dio"),
@@ -100,12 +101,18 @@
         for text, chip in self.Chips:
             self.espComboBox.addItem(text, chip)
         
+        self.baudRateComboBox.addItems([
+            "74.880", "115.200", "230.400", "460.800", "921.600", "1.500.000"])
+        self.baudRateComboBox.setCurrentIndex(3)
+        
         self.firmwarePicker.setFilters(
             self.tr("Firmware Files (*.img);;All Files (*)"))
         if self.__isBackupMode:
             self.firmwarePicker.setMode(
                 EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE)
+            self.sizeInfoLabel.clear()
             self.modeComboBox.setEnabled(False)
+            self.modeInfoLabel.setEnabled(False)
             self.setWindowTitle(self.tr("Backup Firmware"))
         else:
             self.firmwarePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
@@ -151,6 +158,16 @@
         self.__updateOkButton()
     
     @pyqtSlot(str)
+    def on_sizeComboBox_currentTextChanged(self, size):
+        """
+        Private slot handling a change of the selected firmware size.
+        
+        @param size selected size text
+        @type str
+        """
+        self.__updateOkButton()
+    
+    @pyqtSlot(str)
     def on_firmwarePicker_textChanged(self, firmware):
         """
         Private slot handling a change of the firmware path.
@@ -165,12 +182,19 @@
         Public method to get the entered data.
         
         @return tuple containing the selected chip type, the firmware size,
-            the flash mode and the path of the firmware file
-        @rtype tuple of (str, str, str, str)
+            the baud rate or flashing, the flash mode and the path of the
+            firmware file
+        @rtype tuple of (str, str, str, str, str)
         """
+        if self.__isBackupMode:
+            flashSize = self.sizeComboBox.currentData()
+        else:
+            flashSize = self.sizeComboBox.currentText().replace(" ", "")
+        
         return (
             self.espComboBox.currentData(),
-            self.sizeComboBox.currentData(),
+            flashSize,
+            self.baudRateComboBox.currentText().replace(".", ""),
             self.modeComboBox.currentData(),
             self.firmwarePicker.text(),
         )

eric ide

mercurial