当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QThread方法代码示例

本文整理汇总了Python中qtpy.QtCore.QThread方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QThread方法的具体用法?Python QtCore.QThread怎么用?Python QtCore.QThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qtpy.QtCore的用法示例。


在下文中一共展示了QtCore.QThread方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: wait_connections_stopped

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QThread [as 别名]
def wait_connections_stopped(self):
        self.log.debug('Waiting for {} connections threads to stop'.format(len(self.threads)))
        for thread in self.threads.copy():
            try:
                if not thread.wait(1500):
                    # @Hmm: sometimes wait() complains about QThread waiting on itself
                    self.log.debug("Thread \"{}\" didn't stop in time, exiting".format(thread))
                    return
            except RuntimeError:  # happens when thread has been deleted before we got to it
                self.log.debug('Thread {} has been deleted already'.format(thread))
        self.log.debug('Waiting for connections has stopped') 
开发者ID:busimus,项目名称:cutelog,代码行数:13,代码来源:listener.py

示例2: _create_worker

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QThread [as 别名]
def _create_worker(self, method, *args, **kwargs):
        """Create a worker for this client to be run in a separate thread."""
        # FIXME: this might be heavy...
        thread = QThread()
        worker = ClientWorker(method, args, kwargs)
        worker.moveToThread(thread)
        worker.sig_finished.connect(self._start)
        worker.sig_finished.connect(thread.quit)
        thread.started.connect(worker.start)
        self._queue.append(thread)
        self._threads.append(thread)
        self._workers.append(worker)
        self._start()
        return worker 
开发者ID:spyder-ide,项目名称:conda-manager,代码行数:16,代码来源:client_api.py

示例3: _create_worker

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QThread [as 别名]
def _create_worker(self, method, *args, **kwargs):
        """Create a new worker instance."""
        thread = QThread()
        worker = RequestsDownloadWorker(method, args, kwargs)
        worker.moveToThread(thread)
        worker.sig_finished.connect(self._start)
        self._sig_download_finished.connect(worker.sig_download_finished)
        self._sig_download_progress.connect(worker.sig_download_progress)
        worker.sig_finished.connect(thread.quit)
        thread.started.connect(worker.start)
        self._queue.append(thread)
        self._threads.append(thread)
        self._workers.append(worker)
        self._start()
        return worker 
开发者ID:spyder-ide,项目名称:conda-manager,代码行数:17,代码来源:download_api.py


注:本文中的qtpy.QtCore.QThread方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。