Fix mtk_gui thread

This commit is contained in:
Bjoern Kerler 2024-08-24 15:03:01 +02:00
parent f1bece6ead
commit 57c0ea0165
No known key found for this signature in database
GPG key ID: A3E0FAF79F2F4578

View file

@ -123,7 +123,7 @@ def load_translations(application):
class MainWindow(QMainWindow): class MainWindow(QMainWindow):
def __init__(self): def __init__(self, thread):
super(MainWindow, self).__init__() super(MainWindow, self).__init__()
self.readpartitionCheckboxes = None self.readpartitionCheckboxes = None
self.ui = Ui_MainWindow() self.ui = Ui_MainWindow()
@ -142,7 +142,7 @@ class MainWindow(QMainWindow):
self.ui.connectInfo.setMinimumSize(200, 500) self.ui.connectInfo.setMinimumSize(200, 500)
self.ui.connectInfo.setMaximumSize(9900, 500) self.ui.connectInfo.setMaximumSize(9900, 500)
self.ui.showdebugbtn.clicked.connect(self.showDebugInfo) self.ui.showdebugbtn.clicked.connect(self.showDebugInfo)
self.thread = thread
self.devhandler = None self.devhandler = None
self.readflash = None self.readflash = None
@ -240,7 +240,7 @@ class MainWindow(QMainWindow):
def initread(self): def initread(self):
self.readflash = ReadFlashWindow(self.ui, self, self.devhandler.da_handler, self.sendToLog) self.readflash = ReadFlashWindow(self.ui, self, self.devhandler.da_handler, self.sendToLog)
thread.sendUpdateSignal.connect(win.updateGui) self.thread.sendUpdateSignal.connect(self.updateGui)
self.readflash.enableButtonsSignal.connect(self.enablebuttons) self.readflash.enableButtonsSignal.connect(self.enablebuttons)
self.readflash.disableButtonsSignal.connect(self.disablebuttons) self.readflash.disableButtonsSignal.connect(self.disablebuttons)
self.ui.readpartitionsbtn.clicked.connect(self.readflash.dumpPartition) self.ui.readpartitionsbtn.clicked.connect(self.readflash.dumpPartition)
@ -509,7 +509,10 @@ def main():
app = QApplication(sys.argv) app = QApplication(sys.argv)
load_translations(app) load_translations(app)
win = MainWindow() loglevel = logging.INFO
devhandler = DeviceHandler(parent=app, preloader=None, loglevel=loglevel)
thread = asyncThread(parent=app, n=0, function=getDevInfo, parameters=[loglevel, phoneInfo, devhandler])
win = MainWindow(thread)
icon = QIcon() icon = QIcon()
icon.addFile(path.get_images_path('logo_32.png'), QSize(32, 32)) icon.addFile(path.get_images_path('logo_32.png'), QSize(32, 32))
@ -535,11 +538,9 @@ def main():
# win.setFixedSize(746, 400 + addTopMargin) # win.setFixedSize(746, 400 + addTopMargin)
# Device setup # Device setup
loglevel = logging.INFO
devhandler = DeviceHandler(parent=app, preloader=None, loglevel=loglevel)
devhandler.sendToLogSignal.connect(win.sendToLog) devhandler.sendToLogSignal.connect(win.sendToLog)
# Get the device info # Get the device info
thread = asyncThread(parent=app, n=0, function=getDevInfo, parameters=[loglevel, phoneInfo, devhandler])
thread.sendToLogSignal.connect(win.sendToLog) thread.sendToLogSignal.connect(win.sendToLog)
thread.sendUpdateSignal.connect(win.updateGui) thread.sendUpdateSignal.connect(win.updateGui)
thread.sendToProgressSignal.connect(win.sendToProgress) thread.sendToProgressSignal.connect(win.sendToProgress)