|
35 | 35 |
|
36 | 36 | from typing import Iterator, Tuple |
37 | 37 |
|
38 | | -from PyQt5.QtCore import QSettings, QProcess, QTimer, Qt, QIODevice, pyqtSlot, \ |
39 | | - QObject, QThread, pyqtSignal |
| 38 | +from PyQt5.QtCore import QSettings, QProcess, QTimer, Qt, QIODevice, pyqtSlot |
40 | 39 | from PyQt5.QtWidgets import QWidget, QLabel, QComboBox, QGridLayout, \ |
41 | 40 | QPushButton, QApplication, QLineEdit, QFileDialog, QPlainTextEdit, \ |
42 | 41 | QAction, QActionGroup, QMenu, QMenuBar, QMainWindow, QMessageBox |
|
45 | 44 |
|
46 | 45 | import sys |
47 | 46 | import os |
48 | | -from time import sleep |
49 | 47 |
|
50 | 48 | import esptool |
51 | 49 | from esptool import ESPLoader |
@@ -98,19 +96,6 @@ def flush(self) -> None: |
98 | 96 | def isatty(self): |
99 | 97 | return True |
100 | 98 |
|
101 | | -class ESPTool(QObject): |
102 | | - finished = pyqtSignal() |
103 | | - |
104 | | - def run(self, command): |
105 | | - """Run esptool in a separate thread to stop the GUI from freezing""" |
106 | | - try: |
107 | | - esptool.main(command) |
108 | | - except (ValueError, IOError, FatalError, ImportError, NotImplementedInROMError, UnsupportedCommandError, NotSupportedError, RuntimeError) as err: |
109 | | - print(str(err)) |
110 | | - except: |
111 | | - pass |
112 | | - self.finished.emit() |
113 | | - |
114 | 99 | # noinspection PyArgumentList |
115 | 100 |
|
116 | 101 | class MainWidget(QWidget): |
@@ -376,17 +361,6 @@ def on_upload_btn_pressed(self) -> None: |
376 | 361 |
|
377 | 362 | #print("python esptool.py %s\n\n" % " ".join(command)) # Useful for debugging - cut and paste into a command prompt |
378 | 363 |
|
379 | | - self.thread = QThread() |
380 | | - self.espTool = ESPTool() |
381 | | - self.espTool.moveToThread(self.thread) |
382 | | - self.thread.started.connect(self.espTool.run(command)) |
383 | | - self.thread.finished.connect(lambda: self.upload_btn.setEnabled(True)) |
384 | | - self.espTool.finished.connect(self.thread.quit) |
385 | | - self.espTool.finished.connect(self.espTool.deleteLater) |
386 | | - self.thread.finished.connect(self.thread.deleteLater) |
387 | | - self.upload_btn.setEnabled(False) |
388 | | - #self.thread.start() |
389 | | - |
390 | 364 | try: |
391 | 365 | esptool.main(command) |
392 | 366 | except (ValueError, IOError, FatalError, ImportError, NotImplementedInROMError, UnsupportedCommandError, NotSupportedError, RuntimeError) as err: |
|
0 commit comments