Skip to content

Commit 01a0e30

Browse files
committed
v1.3 - without threads
1 parent dbe6215 commit 01a0e30

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

Uploader_GUI/RTK_Firmware_Uploader_GUI.py

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535

3636
from typing import Iterator, Tuple
3737

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
4039
from PyQt5.QtWidgets import QWidget, QLabel, QComboBox, QGridLayout, \
4140
QPushButton, QApplication, QLineEdit, QFileDialog, QPlainTextEdit, \
4241
QAction, QActionGroup, QMenu, QMenuBar, QMainWindow, QMessageBox
@@ -45,7 +44,6 @@
4544

4645
import sys
4746
import os
48-
from time import sleep
4947

5048
import esptool
5149
from esptool import ESPLoader
@@ -98,19 +96,6 @@ def flush(self) -> None:
9896
def isatty(self):
9997
return True
10098

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-
11499
# noinspection PyArgumentList
115100

116101
class MainWidget(QWidget):
@@ -376,17 +361,6 @@ def on_upload_btn_pressed(self) -> None:
376361

377362
#print("python esptool.py %s\n\n" % " ".join(command)) # Useful for debugging - cut and paste into a command prompt
378363

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-
390364
try:
391365
esptool.main(command)
392366
except (ValueError, IOError, FatalError, ImportError, NotImplementedInROMError, UnsupportedCommandError, NotSupportedError, RuntimeError) as err:
-182 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)