本文整理汇总了Python中twisted.internet.main.installReactor函数的典型用法代码示例。如果您正苦于以下问题:Python installReactor函数的具体用法?Python installReactor怎么用?Python installReactor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了installReactor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, evManager):
self.state = ReactorSpinController.STATE_STOPPED
self.evManager = evManager
self.evManager.RegisterListener( self )
self.reactor = SelectReactor()
installReactor(self.reactor)
self.loopingCall = LoopingCall(self.FireTick)
示例2: install
def install(runLoop=None, runner=None):
"""
Configure the twisted mainloop to be run inside CFRunLoop.
@param runLoop: the run loop to use.
@param runner: the function to call in order to actually invoke the main
loop. This will default to L{CFRunLoopRun} if not specified. However,
this is not an appropriate choice for GUI applications, as you need to
run NSApplicationMain (or something like it). For example, to run the
Twisted mainloop in a PyObjC application, your C{main.py} should look
something like this::
from PyObjCTools import AppHelper
from twisted.internet.cfreactor import install
install(runner=AppHelper.runEventLoop)
# initialize your application
reactor.run()
@return: The installed reactor.
@rtype: L{CFReactor}
"""
reactor = CFReactor(runLoop=runLoop, runner=runner)
from twisted.internet.main import installReactor
installReactor(reactor)
return reactor
示例3: portableInstall
def portableInstall():
"""Configure the twisted mainloop to be run inside the gtk mainloop.
"""
reactor = PortableGtkReactor()
from twisted.internet.main import installReactor
installReactor(reactor)
return reactor
示例4: install
def install():
"""
Configure the twisted mainloop to be run inside the qt mainloop.
"""
from twisted.internet import main
reactor = QTReactor()
main.installReactor(reactor)
示例5: install
def install():
"""
Install the epoll() reactor.
"""
p = EPollReactor()
from twisted.internet.main import installReactor
installReactor(p)
示例6: install
def install():
"""Configure the twisted mainloop to be run using the select() reactor.
"""
reactor = ThreadedSelectReactor()
from twisted.internet.main import installReactor
installReactor(reactor)
return reactor
示例7: install
def install():
"""
Configure the twisted mainloop to be run inside the glib mainloop.
"""
reactor = Glib2Reactor()
from twisted.internet.main import installReactor
installReactor(reactor)
示例8: install
def install():
"""
Install the Qt reactor.
"""
p = QtReactor()
from twisted.internet.main import installReactor
installReactor(p)
示例9: install
def install():
"""Install the context tracking reactor."""
# Install logging patches.
originalFormatter = log.textFromEventDict
def newFormatter(*args, **kw):
"""Augmented log formatter that includes context information."""
originalResult = originalFormatter(*args, **kw)
values = AsyncFrame.currentFrame.getLocals()
if values:
originalResult += ' %r' % values
return originalResult
log.textFromEventDict = newFormatter
# Patch threads.deferToThread(Pool)
originalDeferToThreadPool = threads.deferToThreadPool
def deferToThreadPool(*args, **kw):
"""Patches defer to thread pool to install the context when running the callback."""
deferred = originalDeferToThreadPool(*args, **kw)
# pylint: disable=W0212
deferred._startRunCallbacks = wrapped(deferred._startRunCallbacks, 'Thread')
return deferred
threads.deferToThreadPool = deferToThreadPool
# Overwrite the reactor.
del sys.modules['twisted.internet.reactor']
r = FrameTrackingReactor()
from twisted.internet.main import installReactor
installReactor(r)
示例10: install
def install(app=None):
"""
Configure the twisted mainloop to be run inside the e2 mainloop.
"""
from twisted.internet import main
reactor = e2reactor()
main.installReactor(reactor)
示例11: install
def install():
"""
Install the kqueue() reactor.
"""
p = KQueueReactor()
from twisted.internet.main import installReactor
installReactor(p)
示例12: posixinstall
def posixinstall():
"""
Install the Qt reactor.
"""
from twisted.internet.main import installReactor
p = QtReactor()
installReactor(p)
示例13: install
def install():
"""
Configure the twisted mainloop to be run inside the npyscreen mainloop.
"""
reactor = NpyscreenReactor()
from twisted.internet.main import installReactor
installReactor(reactor)
return reactor
示例14: install
def install():
"""
Setup Twisted+Pyglet integration based on the Pyglet event loop.
"""
reactor = PygletReactor()
from twisted.internet.main import installReactor
installReactor(reactor)
return reactor
示例15: win32install
def win32install():
"""
Install the Qt reactor.
"""
p = QtEventReactor()
from twisted.internet.main import installReactor
installReactor(p)
return p