Skip to content

Commit

Permalink
Fix mtk_gui thread
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler committed Aug 24, 2024
1 parent f1bece6 commit 57c0ea0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions mtk_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def load_translations(application):


class MainWindow(QMainWindow):
def __init__(self):
def __init__(self, thread):
super(MainWindow, self).__init__()
self.readpartitionCheckboxes = None
self.ui = Ui_MainWindow()
Expand All @@ -142,7 +142,7 @@ def __init__(self):
self.ui.connectInfo.setMinimumSize(200, 500)
self.ui.connectInfo.setMaximumSize(9900, 500)
self.ui.showdebugbtn.clicked.connect(self.showDebugInfo)

self.thread = thread
self.devhandler = None
self.readflash = None

Expand Down Expand Up @@ -240,7 +240,7 @@ def setdevhandler(self, devhandler):

def initread(self):
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.disableButtonsSignal.connect(self.disablebuttons)
self.ui.readpartitionsbtn.clicked.connect(self.readflash.dumpPartition)
Expand Down Expand Up @@ -509,7 +509,10 @@ def main():
app = QApplication(sys.argv)
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.addFile(path.get_images_path('logo_32.png'), QSize(32, 32))
Expand All @@ -535,11 +538,9 @@ def main():
# win.setFixedSize(746, 400 + addTopMargin)

# Device setup
loglevel = logging.INFO
devhandler = DeviceHandler(parent=app, preloader=None, loglevel=loglevel)
devhandler.sendToLogSignal.connect(win.sendToLog)
# Get the device info
thread = asyncThread(parent=app, n=0, function=getDevInfo, parameters=[loglevel, phoneInfo, devhandler])

thread.sendToLogSignal.connect(win.sendToLog)
thread.sendUpdateSignal.connect(win.updateGui)
thread.sendToProgressSignal.connect(win.sendToProgress)
Expand Down

0 comments on commit 57c0ea0

Please sign in to comment.