diff --git a/mtk_gui.py b/mtk_gui.py index 2bd1418b..1cf0c35b 100755 --- a/mtk_gui.py +++ b/mtk_gui.py @@ -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() @@ -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 @@ -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) @@ -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)) @@ -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)