src/eric7/MicroPython/Devices/EspDevices.py

branch
eric7
changeset 11005
b918c6c2736b
parent 10933
95a15b70f7bb
child 11006
a671918232f3
equal deleted inserted replaced
11004:5f8d929657b3 11005:b918c6c2736b
269 @pyqtSlot() 269 @pyqtSlot()
270 def __flashMicroPython(self): 270 def __flashMicroPython(self):
271 """ 271 """
272 Private slot to flash a MicroPython firmware to the device. 272 Private slot to flash a MicroPython firmware to the device.
273 """ 273 """
274 flashPythonFirmware(self.microPython.getCurrentPort()) 274 flashPythonFirmware(self.microPython.getCurrentPort(), parent=self.microPython)
275 275
276 @pyqtSlot() 276 @pyqtSlot()
277 def __flashAddons(self): 277 def __flashAddons(self):
278 """ 278 """
279 Private slot to flash some additional firmware images. 279 Private slot to flash some additional firmware images.
280 """ 280 """
281 flashAddonFirmware(self.microPython.getCurrentPort()) 281 flashAddonFirmware(self.microPython.getCurrentPort(), parent=self.microPython)
282 282
283 @pyqtSlot() 283 @pyqtSlot()
284 def __backupFlash(self): 284 def __backupFlash(self):
285 """ 285 """
286 Private slot to backup the currently flashed firmware. 286 Private slot to backup the currently flashed firmware.
287 """ 287 """
288 from .EspDialogs.EspBackupRestoreFirmwareDialog import ( 288 from .EspDialogs.EspBackupRestoreFirmwareDialog import (
289 EspBackupRestoreFirmwareDialog, 289 EspBackupRestoreFirmwareDialog,
290 ) 290 )
291 291
292 dlg = EspBackupRestoreFirmwareDialog(backupMode=True) 292 dlg = EspBackupRestoreFirmwareDialog(backupMode=True, parent=self.microPython)
293 if dlg.exec() == QDialog.DialogCode.Accepted: 293 if dlg.exec() == QDialog.DialogCode.Accepted:
294 chip, flashSize, baudRate, flashMode, firmware = dlg.getData() 294 chip, flashSize, baudRate, flashMode, firmware = dlg.getData()
295 flashArgs = [ 295 flashArgs = [
296 "-u", 296 "-u",
297 "-m", 297 "-m",
325 """ 325 """
326 from .EspDialogs.EspBackupRestoreFirmwareDialog import ( 326 from .EspDialogs.EspBackupRestoreFirmwareDialog import (
327 EspBackupRestoreFirmwareDialog, 327 EspBackupRestoreFirmwareDialog,
328 ) 328 )
329 329
330 dlg = EspBackupRestoreFirmwareDialog(backupMode=False) 330 dlg = EspBackupRestoreFirmwareDialog(backupMode=False, parent=self.microPython)
331 if dlg.exec() == QDialog.DialogCode.Accepted: 331 if dlg.exec() == QDialog.DialogCode.Accepted:
332 chip, flashSize, baudRate, flashMode, firmware = dlg.getData() 332 chip, flashSize, baudRate, flashMode, firmware = dlg.getData()
333 flashArgs = [ 333 flashArgs = [
334 "-u", 334 "-u",
335 "-m", 335 "-m",
1349 1349
1350 The country is the two-letter ISO 3166-1 Alpha-2 country code. 1350 The country is the two-letter ISO 3166-1 Alpha-2 country code.
1351 """ 1351 """
1352 from ..WifiDialogs.WifiCountryDialog import WifiCountryDialog 1352 from ..WifiDialogs.WifiCountryDialog import WifiCountryDialog
1353 1353
1354 dlg = WifiCountryDialog() 1354 dlg = WifiCountryDialog(parent=self.microPython)
1355 if dlg.exec() == QDialog.DialogCode.Accepted: 1355 if dlg.exec() == QDialog.DialogCode.Accepted:
1356 country, remember = dlg.getCountry() 1356 country, remember = dlg.getCountry()
1357 if remember: 1357 if remember:
1358 Preferences.setMicroPython("WifiCountry", country) 1358 Preferences.setMicroPython("WifiCountry", country)
1359 1359
1781 if res: 1781 if res:
1782 dlg.exec() 1782 dlg.exec()
1783 1783
1784 1784
1785 @pyqtSlot() 1785 @pyqtSlot()
1786 def flashPythonFirmware(port): 1786 def flashPythonFirmware(port, parent=None):
1787 """ 1787 """
1788 Slot to flash a MicroPython firmware to the device. 1788 Slot to flash a MicroPython firmware to the device.
1789 1789
1790 @param port name of the serial port device to be used 1790 @param port name of the serial port device to be used
1791 @type str 1791 @type str
1792 @param parent reference to the parent widget (defaults to None)
1793 @type QWidget
1792 """ 1794 """
1793 from .EspDialogs.EspFirmwareSelectionDialog import EspFirmwareSelectionDialog 1795 from .EspDialogs.EspFirmwareSelectionDialog import EspFirmwareSelectionDialog
1794 1796
1795 dlg = EspFirmwareSelectionDialog() 1797 dlg = EspFirmwareSelectionDialog(parent=parent)
1796 if dlg.exec() == QDialog.DialogCode.Accepted: 1798 if dlg.exec() == QDialog.DialogCode.Accepted:
1797 chip, firmware, baudRate, flashMode, flashAddress = dlg.getData() 1799 chip, firmware, baudRate, flashMode, flashAddress = dlg.getData()
1798 flashArgs = [ 1800 flashArgs = [
1799 "-u", 1801 "-u",
1800 "-m", 1802 "-m",
1827 if res: 1829 if res:
1828 dlg.exec() 1830 dlg.exec()
1829 1831
1830 1832
1831 @pyqtSlot() 1833 @pyqtSlot()
1832 def flashAddonFirmware(port): 1834 def flashAddonFirmware(port, parent=None):
1833 """ 1835 """
1834 Slot to flash some additional firmware images. 1836 Slot to flash some additional firmware images.
1835 1837
1836 @param port name of the serial port device to be used 1838 @param port name of the serial port device to be used
1837 @type str 1839 @type str
1840 @param parent reference to the parent widget (defaults to None)
1841 @type QWidget
1838 """ 1842 """
1839 from .EspDialogs.EspFirmwareSelectionDialog import EspFirmwareSelectionDialog 1843 from .EspDialogs.EspFirmwareSelectionDialog import EspFirmwareSelectionDialog
1840 1844
1841 dlg = EspFirmwareSelectionDialog(addon=True) 1845 dlg = EspFirmwareSelectionDialog(addon=True, parent=parent)
1842 if dlg.exec() == QDialog.DialogCode.Accepted: 1846 if dlg.exec() == QDialog.DialogCode.Accepted:
1843 chip, firmware, baudRate, flashMode, flashAddress = dlg.getData() 1847 chip, firmware, baudRate, flashMode, flashAddress = dlg.getData()
1844 flashArgs = [ 1848 flashArgs = [
1845 "-u", 1849 "-u",
1846 "-m", 1850 "-m",

eric ide

mercurial