Pycharm只是在Qthread项目中以调试模式工作

时间:2018-10-27 08:56:42

标签: python-3.x pycharm qthread

我有此示例代码

def initializeData(self):
    # di.CSVImporter(self.configParser.get('SectionOne', 'Path'), sqlbase.engine)
    self.progressBar.setValue(0)
    self.progressBar.setVisible(True)
    initializer = DataCollector()
    self.threadInit = QThread()
    self.threadInit.setObjectName('initThread')
    initializer.moveToThread(self.threadInit)
    # get progress messages from worker:
    initializer.sig_step.connect(self.on_worker_step)
    initializer.sig_done.connect(self.on_worker_done)
    self.sig_abort_workers.connect(initializer.abort)
    self.threadInit.started.connect(initializer.initializeData)
    self.threadInit.start()  # this will emit 'started' and start thread's event loop

@pyqtSlot(int)
def on_worker_step(self, data: int):
    self.progressBar.setValue(data)

@pyqtSlot(int)
def on_worker_done(self, data: int):
    self.progressBar.setVisible(False)

@pyqtSlot(str)
def on_worker_send(self, data: str):
    self.statusBar().showMessage(data)



@pyqtSlot()
def abort_workers(self):
    self.sig_abort_workers.emit()
    # self.thread.quit()

当我在“调试”模式下运行它时,它可以工作,但在“发布”模式下却不能。这是因为配置吗?

调试模式配置如下:

configurationImage

0 个答案:

没有答案