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


Python QtCore.QThread方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def __init__(self):
        super(WorkerStack, self).__init__()

        self.workers = []
        self.threads = []
        self.load = {}                                  # {'worker_name': tasks_count}

        # Create workers crew
        for i in range(0, 2):
            worker = Worker(self, 'Slogger-' + str(i))
            thread = QtCore.QThread()

            worker.moveToThread(thread)
            worker.connect(thread, QtCore.SIGNAL("started()"), worker.run)
            worker.task_completed.connect(self.on_task_completed)

            thread.start()

            self.workers.append(worker)
            self.threads.append(thread)
            self.load[worker.name] = 0 
开发者ID:Denvi,项目名称:FlatCAM,代码行数:23,代码来源:FlatCAMWorkerStack.py

示例2: main

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def main():

    # Create Queue and redirect sys.stdout to this queue
    queue = Queue()
    sys.stdout = StdoutQueue(queue)

    # Start the main GUI class
    app = QtGui.QApplication(sys.argv)
    form = MainWindow()
    form.show()

    # Create thread that will listen for new strings in the queue. Upon new
    #   items, Receiver will emit a signal, which will be sent to the
    #   onDataReady method in the MainWindow class. The onDataReady method
    #   will add the string to the text editor in the GUI.
    thread = QtCore.QThread()
    receiver = Receiver(queue)
    receiver.signal.connect(form.onDataReady)
    receiver.moveToThread(thread)
    thread.started.connect(receiver.run)
    thread.start()

    sys.exit(app.exec_()) 
开发者ID:camisatx,项目名称:pySecMaster,代码行数:25,代码来源:main_gui.py

示例3: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def __init__(self, srv, layer, extent, zoom, outFile, outCRS, seedOnly, recurseUpZoomLevels):
		QtCore.QThread.__init__(self, None)
		self.srv = srv
		self.layer = layer
		self.extent = extent

		self.outFile = outFile
		self.outCRS = outCRS
		self.seedOnly = seedOnly
		if recurseUpZoomLevels and seedOnly:
			self.zoom = list(range(self.srv.layers[self.layer].zmin, zoom+1))
			self.rq = BBoxRequestMZ(self.srv.srcTms, self.extent, self.zoom)
			print(self.rq.nbTiles, self.srv.srcTms.bboxRequest(self.extent, zoom).nbTiles)
		else:
			self.zoom = zoom
			self.rq = self.srv.srcTms.bboxRequest(self.extent, self.zoom) 
开发者ID:domlysz,项目名称:BlenderGIS,代码行数:18,代码来源:QtMapServiceClient.py

示例4: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def __init__(self, parent=None, target=None, args=()):
        """
        This class is meant for heavy lifing that has to happen in a separate
        thread, to keep the UI responding.  It will take a callable `target'
        and execute it in a separate thread with the given `args'.  Please
        note that a reference to the thread object will be pre-pendend to the
        arguments list passed to th callable, to allow acces to the methods
        provided by this class to modify the progress bar used to show the
        user the progress of the work executed in the thread.
        """
        QtCore.QThread.__init__(self, parent)
        self.target = target
        self.args = (self,) + args 
开发者ID:linuxscout,项目名称:mishkal,代码行数:15,代码来源:appgui.py

示例5: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def __init__(self):
		QtCore.QThread.__init__(self, parent=None)
		self.urls = []
		self.processing = False 
开发者ID:SECFORCE,项目名称:sparta,代码行数:6,代码来源:auxiliary.py

示例6: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def __init__(self, cmdQueue):
        QtCore.QThread.__init__(self)
        self.running = True
        self.cmdQueue = cmdQueue

        self.limitDelta = 1.0 / 60.0  # 60fps
        self.delta = 0.0
        self.lastTime = 0.0 
开发者ID:ubuntunux,项目名称:PyEngine3D,代码行数:10,代码来源:MainWindow.py

示例7: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def __init__(self):
    QtCore.QThread.__init__(self)
    self.run_loop = True

  # Helps ensure that the thread quits before it's destroyed. 
开发者ID:pyskell,项目名称:slouchy,代码行数:7,代码来源:slouchy.py

示例8: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def __init__(self):
		QtCore.QThread.__init__(self) 
开发者ID:PacktPublishing,项目名称:ROS-Programming-Building-Powerful-Robots,代码行数:4,代码来源:robot_gui.py

示例9: run

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def run(self):
        QtCore.QThread.sleep(4)
        print('Done sleeping') 
开发者ID:fabioz,项目名称:PyDev.Debugger,代码行数:5,代码来源:_debugger_case_qthread4.py

示例10: main

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def main(argv=None):
    app = None

    # create the application if necessary
    if not QtGui.QApplication.instance():
        app = QtGui.QApplication(argv)
        app.setQuitOnLastWindowClosed(True)
        app.setOrganizationName("GGPO")
        QtCore.QCoreApplication.setApplicationName("GGPO")
    ColorTheme.saveDefaultStyle()
    controller = Controller()
    thread = QtCore.QThread()
    controller.moveToThread(thread)
    thread.started.connect(controller.selectLoop)
    thread.start()

    def loggedIn():
        controller.connectUdp()
        window = GGPOWindow()
        window.setWindowIcon(QtGui.QIcon(':/assets/icon-128.png'))
        window.setController(controller)
        window.restorePreference()
        controller.sendListChannels()
        window.show()
        window.raise_()
        window.activateWindow()

    logindialog = LoginDialog()
    logindialog.setController(controller)
    logindialog.accepted.connect(loggedIn)
    logindialog.rejected.connect(sys.exit)
    logindialog.exec_()
    logindialog.raise_()
    logindialog.activateWindow()

    return app.exec_() 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:38,代码来源:main.py

示例11: run

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def run(cls, checkonly, statusMsgCallback=None, finishedCallback=None):
        if cls._thread:
            logdebug().error('Already has a download thread running')
        cls._thread = QtCore.QThread()
        cls._worker = SyncWorker(checkonly)
        cls._worker.moveToThread(cls._thread)
        if finishedCallback:
            cls._worker.sigFinished.connect(finishedCallback)
        cls._worker.sigFinished.connect(cls.cleanup)
        if statusMsgCallback:
            cls._worker.sigStatusMessage.connect(statusMsgCallback)
        cls._thread.started.connect(cls._worker.download)
        cls._thread.start() 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:15,代码来源:unsupportedsavestates.py

示例12: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def __init__(self, icon, parent=None):
    QtGui.QSystemTrayIcon.__init__(self, icon, parent)
    menu = QtGui.QMenu(parent)
    s = os.popen("nsaway --plugins").read().split("\n")
    # Magic
    s = s[2].split("[")[1].replace("]", "").split(", ")
    s = [si.replace("'","") for si in s]
    # It's clean
    # Plugin
    for item in s:
      entry = menu.addAction(item)
      self.connect(entry,QtCore.SIGNAL('triggered()'), lambda item=item: self.exec_plugin(item))
    # Finished plugin loading
    menu.addSeparator()
    changeicon = menu.addAction("Reset Status")
    menu.addSeparator()
    exitAction = menu.addAction("Exit")
    self.setContextMenu(menu)
    exitAction.triggered.connect(self.quit)
    changeicon.triggered.connect(self.reset_icon)
    self.thread = QtCore.QThread()
    self.listener = Listener()
    self.listener.moveToThread(self.thread)

    self.thread.started.connect(self.listener.loop)
    self.listener.message.connect(self.signal_received)

    QtCore.QTimer.singleShot(0, self.thread.start) 
开发者ID:TheZ3ro,项目名称:nsaway,代码行数:30,代码来源:tray.py

示例13: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def __init__(self,parent=None,win_info=None):
		QtCore.QThread.__init__(self,parent)
		self.win_info=win_info
		self.parent=parent 
开发者ID:the-duck,项目名称:launcher,代码行数:6,代码来源:Window.py

示例14: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def __init__(self,parent=None):
		QtCore.QThread.__init__(self,parent)
		self.parent=parent 
开发者ID:the-duck,项目名称:launcher,代码行数:5,代码来源:Main.py

示例15: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QThread [as 别名]
def __init__(self, ip, port, parent = None):
        QtCore.QThread.__init__(self, parent)
        self.ip = ip
        self.port = port 
开发者ID:kakaroto,项目名称:SWProxy,代码行数:6,代码来源:gui.py


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