src/eric7/MicroPython/UF2FlashDialog.py

branch
eric7
changeset 10172
7367a211d865
parent 10112
dcbb8703b5b2
child 10208
d2fb44007ed3
equal deleted inserted replaced
10171:15070a32c15b 10172:7367a211d865
5 5
6 """ 6 """
7 Module implementing a dialog to flash any UF2 capable device. 7 Module implementing a dialog to flash any UF2 capable device.
8 """ 8 """
9 9
10 import contextlib
10 import os 11 import os
11 import shutil 12 import shutil
12 13
13 from PyQt6.QtCore import QCoreApplication, QEventLoop, Qt, QThread, pyqtSlot 14 from PyQt6.QtCore import QCoreApplication, QEventLoop, Qt, QThread, pyqtSlot
14 from PyQt6.QtSerialPort import QSerialPortInfo 15 from PyQt6.QtSerialPort import QSerialPortInfo
1019 ).format(firmwareType) 1020 ).format(firmwareType)
1020 ) 1021 )
1021 QCoreApplication.processEvents( 1022 QCoreApplication.processEvents(
1022 QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents 1023 QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents
1023 ) 1024 )
1024 shutil.copy(firmwarePath, volumePath) 1025 with contextlib.suppress(FileNotFoundError):
1026 shutil.copy(firmwarePath, volumePath)
1025 QThread.sleep(1) 1027 QThread.sleep(1)
1026 self.on_refreshButton_clicked() 1028 self.on_refreshButton_clicked()
1027 1029
1028 @pyqtSlot() 1030 @pyqtSlot()
1029 def on_refreshButton_clicked(self): 1031 def on_refreshButton_clicked(self):

eric ide

mercurial