Exemplo n.º 1
0
def run():
    # Output transport/protocol
    output_transport, output_protocol = yield from loop.connect_write_pipe(BaseProtocol, os.fdopen(0, 'wb'))

    with raw_mode(sys.stdin.fileno()):
        # Enter alternate screen buffer
        with alternate_screen(output_transport.write):
            # Create session and renderer
            session = PyMuxSession()
            renderer = PipeRenderer(output_transport.write)
            session.add_renderer(renderer)

            # handle resize events
            call_on_sigwinch(session.update_size)

            # Input transport/protocol
            input_transport, input_protocol = yield from loop.connect_read_pipe(
                                lambda:PyMuxInputProtocol(session), sys.stdin)

            yield from session.run()
Exemplo n.º 2
0
def run():
    # Output transport/protocol
    output_transport, output_protocol = yield from loop.connect_write_pipe(
        BaseProtocol, os.fdopen(0, 'wb'))

    with raw_mode(sys.stdin.fileno()):
        # Enter alternate screen buffer
        with alternate_screen(output_transport.write):
            # Create session and renderer
            session = PyMuxSession()
            renderer = PipeRenderer(output_transport.write)
            session.add_renderer(renderer)

            # handle resize events
            call_on_sigwinch(session.update_size)

            # Input transport/protocol
            input_transport, input_protocol = yield from loop.connect_read_pipe(
                lambda: PyMuxInputProtocol(session), sys.stdin)

            yield from session.run()
def run():
    session = PyMuxSession()
    connections = []

    def protocol_factory():
        """ Factory of ServerProtocol instances """
        def done_callback():
            connections.remove(protocol)

        protocol = ServerProtocol(session, done_callback)
        connections.append(protocol)
        return protocol

    # Start AMP Listener.
    server = yield from loop.create_server(protocol_factory, 'localhost', 4376)

    # Run the session (this is blocking untill all panes in this session are
    # finished.)
    yield from session.run()

    # Disconnect all clients.
    for c in connections:
        result = yield from c.call_remote(DetachClient)
Exemplo n.º 4
0
def run(socket_name, socket_):
    session = PyMuxSession(socket_name)
    connections = []

    def protocol_factory():
        """ Factory of ServerProtocol instances """
        def done_callback():
            connections.remove(protocol)

        protocol = ServerProtocol(session, done_callback)
        connections.append(protocol)
        return protocol

    # Start AMP Listener.
    server = yield from loop.create_server(protocol_factory, sock=socket_)

    # Run the session (this is blocking until all panes in this session are
    # finished.)
    yield from session.run()

    # Disconnect all clients.
    for c in connections:
        result = yield from c.call_remote(DetachClient)