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


Python reactor.runReturn函数代码示例

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


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


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