• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python reactor.runReturn函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中twisted.internet.reactor.runReturn函数的典型用法代码示例。如果您正苦于以下问题:Python runReturn函数的具体用法?Python runReturn怎么用?Python runReturn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: main

def main():
    log.startLogging(sys.stdout)
    parser = argparse.ArgumentParser(description="Exchange files!")
    args = parser.parse_args()
    
    # Initialize peer discovery using UDP multicast
    multiCastPort = 8006
    teiler = TeilerState()
    teiler.multiCastPort = multiCastPort
    reactor.listenMulticast(multiCastPort,
                            PeerDiscovery(teiler),
                            listenMultiple=True)
    log.msg("Initiating Peer Discovery")
    
    app = TeilerWindow(teiler)
    # Initialize file transfer service
    fileReceiver = FileReceiverFactory(teiler, app)
    reactor.listenTCP(teiler.tcpPort, fileReceiver)
    log.msg("Starting file listener on ", teiler.tcpPort)
    
    # qt4reactor requires runReturn() in order to work
    reactor.runReturn()
    
    # filetransfer.sendFile("/home/armin/tempzip.zip",port=teiler.tcpPort,address=teiler.address)
    # Create an instance of the application window and run it
    
    app.run()
开发者ID:arminhammer,项目名称:cteiler,代码行数:27,代码来源:teiler.py


示例2: mytest

def mytest(ip, port, username, password):
    domain = ""
    width = 1024
    height = 800
    fullscreen = False
    optimized = False
    recodedPath = None
    keyboardLayout = 'en'
    app = QtGui.QApplication(sys.argv)

    #add qt4 reactor
    import qt4reactor
    qt4reactor.install()

    if fullscreen:
        width = QtGui.QDesktopWidget().screenGeometry().width()
        height = QtGui.QDesktopWidget().screenGeometry().height()

    log.info("keyboard layout set to %s"%keyboardLayout)

    from twisted.internet import reactor
    ret = {"connected": False}
    mytimer = TimerThread(app, reactor, ret)
    mytimer.start()

    reactor.connectTCP(ip, int(port), RDPClientQtFactory(width, height, username, password, domain, fullscreen, keyboardLayout, optimized, "nego", recodedPath, mytimer))
    reactor.runReturn()
    app.exec_()
    return ret["connected"]
开发者ID:colin-zhou,项目名称:reserve,代码行数:29,代码来源:test.py


示例3: main

def main(width, height, path, timeout, hosts):
    """
    @summary: main algorithm
    @param height: {integer} height of screenshot
    @param width: {integer} width of screenshot
    @param timeout: {float} in sec
    @param hosts: {list(str(ip[:port]))}
    @return: {list(tuple(ip, port, Failure instance)} list of connection state
    """
    #create application
    app = QtGui.QApplication(sys.argv)
    
    #add qt4 reactor
    import qt4reactor
    qt4reactor.install()
    
    from twisted.internet import reactor
        
    for host in hosts:      
        if ':' in host:
            ip, port = host.split(':')
        else:
            ip, port = host, "3389"
            
        reactor.connectTCP(ip, int(port), RDPScreenShotFactory(reactor, app, width, height, path + "%s.jpg"%ip, timeout))
        
    reactor.runReturn()
    app.exec_()
    return RDPScreenShotFactory.__STATE__
开发者ID:ChrisTruncer,项目名称:rdpy,代码行数:29,代码来源:rdpy-rdpscreenshot.py


示例4: start

    def start(self):
        import qt4reactor
        app = get_app_qt4()
        qt4reactor.install()

        from twisted.internet import reactor
        self.reactor = reactor
        reactor.runReturn()
开发者ID:nmichaud,项目名称:codeflow,代码行数:8,代码来源:plugin.py


示例5: main

def main(args):
    app = Qt.QApplication(args)
    
    import qt4reactor
    qt4reactor.install()
    from twisted.internet import reactor
    import labrad, labrad.util, labrad.types
    
    demo = make()
    reactor.runReturn()
    sys.exit(app.exec_())
开发者ID:YulinWu,项目名称:servers,代码行数:11,代码来源:LabRADPlotWidget2.py


示例6: main

def main(args):
    app = Qt.QApplication(args)

    import qt4reactor
    qt4reactor.install()
    from twisted.internet import reactor

    reactor.runReturn()
    demo = make()
    v = app.exec_()
    reactor.threadpool.stop()
    sys.exit(v)
开发者ID:YulinWu,项目名称:servers,代码行数:12,代码来源:LabRADPlotWidget3.py


示例7: main

def main():
    """Run application."""
    # Hook up Qt application to Twisted.
    from twisted.internet import reactor

    # Make sure stopping twisted event also shuts down QT.
    reactor.addSystemEventTrigger('after', 'shutdown', app.quit)

    # Shutdown twisted when window is closed.
    app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), reactor.stop)

    # Do not block test to finish.
    reactor.runReturn()
开发者ID:ChaiZQ,项目名称:pyinstaller,代码行数:13,代码来源:test_twisted_qt4reactor.py


示例8: capture_host

def capture_host(cli_parsed, vnc_object):
    log._LOG_LEVEL = log.Level.ERROR
    app = QtGui.QApplication(sys.argv)

    # add qt4 reactor
    import qt4reactor
    qt4reactor.install()
    from twisted.internet import reactor
    reactor.connectTCP(
        vnc_object.remote_system, vnc_object.port, RFBScreenShotFactory(
            vnc_object.screenshot_path, reactor, app, vnc_object))

    reactor.runReturn()
    app.exec_()
开发者ID:AndrejLavrionovic,项目名称:ipsnapshoter,代码行数:14,代码来源:vnc_module.py


示例9: __init__

    def __init__(self, dbtype, host, user, pwd, winkas, ticket):

        self.dbtype = dbtype
        self.host = host
        self.port = -1
        self.user = user
        self.pwd = pwd
        self.winkas = winkas
        self.ticket = ticket
        self.timeout = 3

        self.event_id = None

        self.connect_db()
        reactor.runReturn()
开发者ID:hundeboll,项目名称:ticket,代码行数:15,代码来源:db.py


示例10: start

def start(app):
    """
    Start the mainloop.

    :param app: the main qt QApplication instance.
    :type app: QtCore.QApplication
    """
    from twisted.internet import reactor
    logger.debug('starting twisted reactor')

    # this seems to be troublesome under some
    # unidentified settings.
    #reactor.run()

    reactor.runReturn()
    app.exec_()
开发者ID:KwadroNaut,项目名称:bitmask_client,代码行数:16,代码来源:twisted_main.py


示例11: main

def main():
    """Main function"""
    app = QtGui.QApplication(sys.argv)
    import qt4reactor
    qt4reactor.install()
    from twisted.internet import reactor

    if len(sys.argv) > 1 and sys.argv[1] == "-t":
        interface = terminal.TerminalInterface()
        stdio.StandardIO(interface)
    else:
        interface = gui.GuiInterface()
    server = Server.Server(reactor, interface)
    interface.start(server)
    reactor.runReturn()
    app.exec_()
    reactor.stop()
开发者ID:PaulEcoffet,项目名称:Nex-yu-computer,代码行数:17,代码来源:nexyu.py


示例12: start_server

def start_server(qapplication, condition='1', no_ui=False, max_images=None):
    """
    Start a server associated with the given qapplication and experimental condition.
    Optionally, one can start a headless server using no_ui or constraint the maximum
    number of images in a meaning space using max_images.
    :param qapplication:
    :param condition:
    :param no_ui:
    :param max_images:
    :return:
    """
    from leaparticulator.p2p.ui.server import LeapP2PServerUI

    factory = None
    assert condition in ['1', '1r', '2', '2r', 'master']
    try:
        if no_ui:
            print "Headless mode..."
            sys.stdout.flush()
            factory = get_server_instance(condition=condition,
                                          ui=None,
                                          max_images=max_images)
            if not (constants.TESTING or reactor.running):
                print "Starting reactor..."
                reactor.runReturn()
        else:
            print "Normal GUI mode..."
            sys.stdout.flush()
            ui = LeapP2PServerUI(qapplication)
            factory = get_server_instance(condition=condition,
                                          ui=ui,
                                          max_images=max_images)
            ui.setFactory(factory)
            if not (constants.TESTING or reactor.running):
                print "Starting reactor..."
                reactor.runReturn()
            ui.go()
        return factory
    except IndexError, e:
        import traceback
        traceback.print_exc()
        print "ERROR: You should specify a condition (1/2/1r/2r) as a command line argument."
        sys.exit(-1)
开发者ID:keryil,项目名称:leaparticulatorqt,代码行数:43,代码来源:server.py


示例13: capture_host

def capture_host(cli_parsed, rdp_object):
    log._LOG_LEVEL = log.Level.ERROR
    width = 1200
    height = 800
    timeout = cli_parsed.timeout

    app = QtGui.QApplication(sys.argv)

    import qt4reactor
    qt4reactor.install()
    from twisted.internet import reactor

    reactor.connectTCP(
        rdp_object.remote_system, int(rdp_object.port), RDPScreenShotFactory(
            reactor, app, width, height,
            rdp_object.screenshot_path, timeout, rdp_object))

    reactor.runReturn()
    app.exec_()
开发者ID:ChrisTruncer,项目名称:EyeWitness,代码行数:19,代码来源:rdp_module.py


示例14: main

def main():
    log.startLogging(sys.stdout)
    
    config = Config(utils.getLiveInterface(),  # ip
                          9998,  # tcp port
                          utils.generateSessionID(),
                          utils.getUsername(),
                          PeerList(),
                          # udp connection information
                          '230.0.0.30',
                          8005,
                          os.path.join(os.path.expanduser("~"), "teiler"))

    reactor.listenMulticast(config.multiCastPort,
                            PeerDiscovery(
                                reactor,
                                config.sessionID,
                                config.peerList,
                                config.name,
                                config.multiCastAddress,
                                config.multiCastPort,
                                config.address,
                                config.tcpPort),
                            listenMultiple=True)

    app = Window(config)
    
    fileReceiver = FileReceiverFactory(config, app)
    reactor.listenTCP(config.tcpPort, fileReceiver)

    # Initialize file transfer service
    log.msg("Starting file listener on {0}".format(config.tcpPort))
    
    reactor.runReturn()
    
    # Create an instance of the application window and run it
    
    app.run()
开发者ID:arminhammer,项目名称:teiler,代码行数:38,代码来源:teiler.py


示例15: mytest

def mytest(ip, port, username, password):
    domain = ""
    width = 1024
    height = 800
    fullscreen = False
    optimized = False
    recodedPath = None
    keyboardLayout = 'en'
    app = QtGui.QApplication(sys.argv)

    my_initial()

    from twisted.internet import reactor
    ret = {"connected": False}
    mytimer = TimerThread(app, reactor, ret)
    mytimer.start()
    timeout = 2
    my_client = RDPClientQtFactory(width, height, username, password, domain, fullscreen, keyboardLayout, optimized, "nego", recodedPath, mytimer)
    mytimer.add_client(my_client)
    reactor.connectTCP(ip, int(port), my_client, timeout)
    reactor.runReturn()
    app.exec_()
    return ret
开发者ID:colin-zhou,项目名称:reserve,代码行数:23,代码来源:connect.py


示例16: makeconfig

  config = cPickle.load(open(configpath))
else:
  config = makeconfig()

mainwin = QMainWindow()
workspace = QWorkspace()
mainwin.setCentralWidget(workspace)

menubar = mainwin.menuBar()
mnufile = menubar.addMenu('&File')
mnuclose = mnufile.addAction('&Close')
mnunew = mnufile.addMenu("&New")
mnunewserver = mnunew.addAction("&Server window")
mnunewserver.connect(mnunewserver, SIGNAL('triggered()'), newserver)

networks = set()

newserver()

mainwin.showMaximized()

identf = protocol.ServerFactory()
identf.protocol = identd
try: reactor.listenTCP(113,identf)
except:
  print "Could not run identd server."
  #todo: show it in the gui 

reactor.runReturn()
sys.exit(app.exec_())
开发者ID:inhahe,项目名称:qtpyrc,代码行数:30,代码来源:qtpyrc.4.py


示例17: startReactor

 def startReactor(cls):
     reactor.runReturn()
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:2,代码来源:OVEFetch.py


示例18: __init__

    def __init__(self, appName = 'example', checkRoom = None, suggest = False, options=None):
        splash = None

        FXUI.app = QtGui.QApplication(sys.argv)
        FXUI.app.setApplicationName("wallaby - " + appName)

        for s in ['16', '32', '64', '128', '256']:
            FXUI.app.setWindowIcon(QtGui.QIcon(QtGui.QPixmap(':/icons/images/wallaby_logo_' + s + '.png')))

        pixmap = QtGui.QPixmap(":/images/images/wallaby_splash.png")
        splash = QtGui.QSplashScreen(pixmap)
        splash.show()
        splash.raise_()
        FXUI.app.processEvents()

        if USES_PYSIDE or FXUI.qt4reactor:
            print "Install qt4reactor. USES_PYSIDE =", USES_PYSIDE
            import wallaby.frontends.qt.reactor.qt4reactor as qtreactor
            qtreactor.install()
        else:
            threadedselect.install()
             
            from twisted.internet import reactor
            ii = Interleaver()
            reactor.interleave(ii.toInterleave)
            reactor.suggestThreadPoolSize(50)

        FXUI.mineIcon = QtGui.QIcon(':/icons/images/mine.png')
        FXUI.theirsIcon = QtGui.QIcon(':/icons/images/theirs.png')

        tapp = twisted.application.service.Application("gui")
        service  = FXLogger('wallaby.log')
        service.setServiceParent(tapp)
        service.startService()

        FX.appModule = 'wallaby.apps.' + appName

        try:
            from twisted.plugin import getCache
            pkg = __import__(FX.appModule, globals(), locals(), ["*"], 0)
            if pkg is not None and len(pkg.__path__) > 0 and os.path.exists(pkg.__path__[0]):
                FX.appPath = pkg.__path__[0]
            else:
                FX.appPath = os.path.join(".", "wallaby", "apps", appName)
        except:
            FX.appPath = os.path.join(".", "wallaby", "apps", appName)

        FXUI.css = None

        try:
            print "importing", options.module, "from", FX.appModule
            if options.module == "WallabyApp2" and os.path.exists(os.path.join(FX.appPath, "mainWindow.py")):
                mod = FX.imp(FX.appModule + '.mainWindow', False)
                if os.path.exists(os.path.join(FX.appPath, "mainWindow.css")):
                    FXUI.css = open(os.path.join(FX.appPath, "mainWindow.css")).read()
            else:
                module = options.module
                module = module[0].lower() + module[1:]
                mod = FX.imp(FX.appModule + '.' + module, False)

                if os.path.exists(os.path.join(FX.appPath, module + ".css")):
                    FXUI.css = open(os.path.join(FX.appPath, module + ".css")).read()
        except:
            mod = None

        if mod == None:
            FX.crit('Module', FX.appModule, 'not found')
            reactor.callWhenRunning(self.myQuit)
            if USES_PYSIDE or FXUI.qt4reactor: reactor.runReturn()
            FXUI.app.exec_()
            return

        try:
            FXUI.mainWindow = mod.MainWindow(self.myQuit, options)
            if FXUI.css is not None:
                FXUI.app.setStyle("plastique")
                FXUI.mainWindow.setStyleSheet(FXUI.css)
        except Exception as e:
            import traceback
            traceback.print_exc(file=sys.stdout)

            from twisted.internet import reactor
            reactor.callWhenRunning(self.myQuit)
            if USES_PYSIDE or FXUI.qt4reactor: reactor.runReturn()
            FXUI.app.exec_()
            return

        FXUI.mainWindow.setSplash(splash)

        from twisted.internet import reactor
        reactor.callWhenRunning(self.run, mod, options, checkRoom)

        FXUI.mainWindow.enabled = False
        FXUI.mainWindow.configure()
        FXUI.mainWindow.show()
        FXUI.mainWindow.raise_()

        signal.signal(signal.SIGINT, self.sigint_handler)
        signal.signal(signal.SIGTERM, self.sigint_handler)

#.........这里部分代码省略.........
开发者ID:FreshXOpenSource,项目名称:wallaby-frontend-qt,代码行数:101,代码来源:wallabyApp.py


示例19: exec_main_app

def exec_main_app():
    inst=UIController()
    inst.show()
    reactor.runReturn()
    #Somehow the reactor doesn't trigger shutdown automatically?
    exit_reactor(app.exec_())
开发者ID:subodhtirkey,项目名称:FiSH,代码行数:6,代码来源:app.py


示例20: _startup

 def _startup(self):
     from twisted.internet import reactor
     reactor.runReturn()
     self._process.register(self._appName)
     self._process.registerModule(self._appName, self.proxy)
     self._process.listen()
开发者ID:Pesa,项目名称:forse,代码行数:6,代码来源:OTPApplication.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python reactor.seconds函数代码示例发布时间:2022-05-27
下一篇:
Python reactor.run函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap