當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。