23 class EspFirmwareSelectionDialog(QDialog, Ui_EspFirmwareSelectionDialog): |
23 class EspFirmwareSelectionDialog(QDialog, Ui_EspFirmwareSelectionDialog): |
24 """ |
24 """ |
25 Class implementing a dialog to select the ESP chip type and the firmware to |
25 Class implementing a dialog to select the ESP chip type and the firmware to |
26 be flashed. |
26 be flashed. |
27 """ |
27 """ |
|
28 FlashModes = ( |
|
29 ("", ""), |
|
30 ("Quad I/O", "qio"), |
|
31 ("Quad Output", "qout"), |
|
32 ("Dual I/O", "dio"), |
|
33 ("Dual Output", "dout"), |
|
34 ) |
|
35 |
28 def __init__(self, addon=False, parent=None): |
36 def __init__(self, addon=False, parent=None): |
29 """ |
37 """ |
30 Constructor |
38 Constructor |
31 |
39 |
32 @param addon flag indicating an addon firmware |
40 @param addon flag indicating an addon firmware |
42 self.firmwarePicker.setMode(E5PathPickerModes.OpenFileMode) |
50 self.firmwarePicker.setMode(E5PathPickerModes.OpenFileMode) |
43 self.firmwarePicker.setFilters( |
51 self.firmwarePicker.setFilters( |
44 self.tr("Firmware Files (*.bin);;All Files (*)")) |
52 self.tr("Firmware Files (*.bin);;All Files (*)")) |
45 |
53 |
46 self.espComboBox.addItems(["", "ESP32", "ESP8266"]) |
54 self.espComboBox.addItems(["", "ESP32", "ESP8266"]) |
|
55 |
|
56 for text, mode in self.FlashModes: |
|
57 self.modeComboBox.addItem(text, mode) |
47 |
58 |
48 if addon: |
59 if addon: |
49 self.__validator = QRegularExpressionValidator( |
60 self.__validator = QRegularExpressionValidator( |
50 QRegularExpression(r"[0-9a-fA-F]{0,4}") |
61 QRegularExpression(r"[0-9a-fA-F]{0,4}") |
51 ) |
62 ) |
91 def getData(self): |
102 def getData(self): |
92 """ |
103 """ |
93 Public method to get the entered data. |
104 Public method to get the entered data. |
94 |
105 |
95 @return tuple containing the selected chip type, the path of the |
106 @return tuple containing the selected chip type, the path of the |
96 firmware file and the flash address |
107 firmware file, the flash mode and the flash address |
97 @rtype tuple of (str, str, str) |
108 @rtype tuple of (str, str, str, str) |
98 """ |
109 """ |
99 if self.__addon: |
110 if self.__addon: |
100 address = self.addressEdit.text() |
111 address = self.addressEdit.text() |
101 else: |
112 else: |
102 address = "" |
113 address = "" |
103 |
114 |
104 return ( |
115 return ( |
105 self.espComboBox.currentText().lower(), |
116 self.espComboBox.currentText().lower(), |
106 self.firmwarePicker.text(), |
117 self.firmwarePicker.text(), |
|
118 self.modeComboBox.currentData(), |
107 address, |
119 address, |
108 ) |
120 ) |