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


Python main.installReactor函数代码示例

本文整理汇总了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)
开发者ID:ClashTeak,项目名称:writing_games_tutorial,代码行数:7,代码来源:client.py

示例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
开发者ID:BarnetteME1,项目名称:indeed_scraper,代码行数:28,代码来源:cfreactor.py

示例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
开发者ID:galaxysd,项目名称:BitTorrent,代码行数:7,代码来源:gtkreactor.py

示例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)
开发者ID:AlickHill,项目名称:Lantern,代码行数:7,代码来源:qt4reactor.py

示例5: install

def install():
    """
    Install the epoll() reactor.
    """
    p = EPollReactor()
    from twisted.internet.main import installReactor
    installReactor(p)
开发者ID:AndyPanda95,项目名称:python-for-android,代码行数:7,代码来源:epollreactor.py

示例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
开发者ID:JohnDoes95,项目名称:project_parser,代码行数:7,代码来源:_threadedselect.py

示例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)
开发者ID:0004c,项目名称:VTK,代码行数:7,代码来源:glib2reactor.py

示例8: install

def install():
    """
    Install the Qt reactor.
    """
    p = QtReactor()
    from twisted.internet.main import installReactor
    installReactor(p)
开发者ID:FreshXOpenSource,项目名称:wallaby-frontend-qt,代码行数:7,代码来源:qtreactor.py

示例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)
开发者ID:yiminlong,项目名称:greplin-twisted-utils,代码行数:35,代码来源:thread.py

示例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)
开发者ID:st7TEAM,项目名称:dreambox,代码行数:7,代码来源:e2reactor.py

示例11: install

def install():
    """
    Install the kqueue() reactor.
    """
    p = KQueueReactor()
    from twisted.internet.main import installReactor
    installReactor(p)
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:7,代码来源:kqreactor.py

示例12: posixinstall

def posixinstall():
    """
    Install the Qt reactor.
    """

    from twisted.internet.main import installReactor
    p = QtReactor()
    installReactor(p)
开发者ID:joepie91,项目名称:aether-public,代码行数:8,代码来源:qt5reactor.py

示例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
开发者ID:dummys,项目名称:npyscreenreactor,代码行数:8,代码来源:__init__.py

示例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
开发者ID:kendase3,项目名称:pyglet-twisted,代码行数:8,代码来源:pygletreactor.py

示例15: win32install

def win32install():
    """
    Install the Qt reactor.
    """
    p = QtEventReactor()
    from twisted.internet.main import installReactor
    installReactor(p)
    return p
开发者ID:pyrf,项目名称:qtreactor,代码行数:8,代码来源:qt4reactor.py


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