src/eric7/MicroPython/EspBackupRestoreFirmwareDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
--- a/src/eric7/MicroPython/EspBackupRestoreFirmwareDialog.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/MicroPython/EspBackupRestoreFirmwareDialog.py	Wed Jul 13 14:55:47 2022 +0200
@@ -15,17 +15,15 @@
 
 from EricWidgets.EricPathPicker import EricPathPickerModes
 
-from .Ui_EspBackupRestoreFirmwareDialog import (
-    Ui_EspBackupRestoreFirmwareDialog
-)
+from .Ui_EspBackupRestoreFirmwareDialog import Ui_EspBackupRestoreFirmwareDialog
 
 
-class EspBackupRestoreFirmwareDialog(QDialog,
-                                     Ui_EspBackupRestoreFirmwareDialog):
+class EspBackupRestoreFirmwareDialog(QDialog, Ui_EspBackupRestoreFirmwareDialog):
     """
     Class implementing a dialog to select the ESP chip type and the backup and
     restore parameters.
     """
+
     Chips = (
         ("", ""),
         ("ESP32", "esp32"),
@@ -34,7 +32,7 @@
         ("ESP32-S3", "esp32s3"),
         ("ESP8266", "esp8266"),
     )
-    
+
     FlashModes = [
         ("", ""),
         ("Quad I/O", "qio"),
@@ -42,7 +40,7 @@
         ("Dual I/O", "dio"),
         ("Dual Output", "dout"),
     ]
-    
+
     FlashSizes = {
         "esp32": [
             (" 1 MB", "0x100000"),
@@ -82,11 +80,11 @@
             ("16 MB", "0x1000000"),
         ],
     }
-    
+
     def __init__(self, backupMode=True, parent=None):
         """
         Constructor
-        
+
         @param backupMode flag indicating parameters for a firmware backup are
             requested
         @type bool
@@ -95,21 +93,22 @@
         """
         super().__init__(parent)
         self.setupUi(self)
-        
+
         self.__isBackupMode = backupMode
-        
+
         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.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 (*)"))
+
+        self.firmwarePicker.setFilters(self.tr("Firmware Files (*.img);;All Files (*)"))
         if self.__isBackupMode:
             self.firmwarePicker.setMode(
-                EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE)
+                EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE
+            )
             self.sizeInfoLabel.clear()
             self.modeComboBox.setEnabled(False)
             self.modeInfoLabel.setEnabled(False)
@@ -119,29 +118,27 @@
             for text, mode in self.FlashModes:
                 self.modeComboBox.addItem(text, mode)
             self.setWindowTitle(self.tr("Restore Firmware"))
-        
+
         msh = self.minimumSizeHint()
         self.resize(max(self.width(), msh.width()), msh.height())
-    
+
     def __updateOkButton(self):
         """
         Private method to update the state of the OK button.
         """
         firmwareFile = self.firmwarePicker.text()
-        enable = (bool(self.espComboBox.currentText()) and
-                  bool(firmwareFile))
+        enable = bool(self.espComboBox.currentText()) and bool(firmwareFile)
         if self.__isBackupMode:
             enable &= bool(self.sizeComboBox.currentText())
         else:
             enable &= os.path.exists(firmwareFile)
-        self.buttonBox.button(
-            QDialogButtonBox.StandardButton.Ok).setEnabled(enable)
-    
+        self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enable)
+
     @pyqtSlot(str)
     def on_espComboBox_currentTextChanged(self, chip):
         """
         Private slot to handle the selection of a chip type.
-        
+
         @param chip selected chip type
         @type str
         """
@@ -152,35 +149,35 @@
             self.sizeComboBox.addItem("")
             for text, data in self.FlashSizes[chipType]:
                 self.sizeComboBox.addItem(text, data)
-            
+
             self.sizeComboBox.setCurrentText(selectedSize)
-        
+
         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.
-        
+
         @param firmware path to the firmware
         @type str
         """
         self.__updateOkButton()
-    
+
     def getData(self):
         """
         Public method to get the entered data.
-        
+
         @return tuple containing the selected chip type, the firmware size,
             the baud rate or flashing, the flash mode and the path of the
             firmware file
@@ -188,10 +185,10 @@
         """
         flashSize = (
             self.sizeComboBox.currentData()
-            if self.__isBackupMode else
-            self.sizeComboBox.currentText().replace(" ", "")
+            if self.__isBackupMode
+            else self.sizeComboBox.currentText().replace(" ", "")
         )
-        
+
         return (
             self.espComboBox.currentData(),
             flashSize,

eric ide

mercurial