Ejemplo n.º 1
0
def test_foo():
    conn = Connection()
    conn.connect(passwd='Swordfish')
    # list(conn.send('alert("Hello");'))

    print(conn.send_sync('$.version;'))

    def callback(message, *args):
        print(message.command)
        print(message.content)


    def callback2(message, *args):
        print(message.command)
        print(message.content)
        print(args)

    listener = EventListener(conn)
    listener.start()
    listener.subscribe('foregroundColorChanged', callback)
    listener.subscribe('documentChanged', callback2, (True, 'xxx'))

    conn.send_sync('app.documents.add(100, 100)')

    print('test_foo')
    time.sleep(3)
    listener.stop()
Ejemplo n.º 2
0
def test_foo():
    conn = Connection()
    conn.connect(passwd='Swordfish')
    # list(conn.send('alert("Hello");'))

    print(conn.send_sync('$.version;'))

    def callback(message, *args):
        print(message.command)
        print(message.content)

    def callback2(message, *args):
        print(message.command)
        print(message.content)
        print(args)

    listener = EventListener(conn)
    listener.start()
    listener.subscribe('foregroundColorChanged', callback)
    listener.subscribe('documentChanged', callback2, (True, 'xxx'))

    conn.send_sync('app.documents.add(100, 100)')

    print('test_foo')
    time.sleep(3)
    listener.stop()
Ejemplo n.º 3
0
def f():
    def callback(message, *args):
        print(message.command)
        print(message.content)

    conn = Connection()
    conn.connect(passwd='Swordfish')
    listener = EventListener(conn)
    listener.start()
    listener.subscribe('foregroundColorChanged', callback)
    conn.send_sync('app.foregroundColor.rgb.red=0')
    conn.send_sync('app.foregroundColor.rgb.red=10')
    conn.send_sync('app.foregroundColor.rgb.red=20')
    conn.send_sync('app.foregroundColor.rgb.red=30')
    time.sleep(2)
    print('done')
Ejemplo n.º 4
0
def f():
    def callback(message, *args):
        print(message.command)
        print(message.content)

    conn = Connection()
    conn.connect(passwd='Swordfish')
    listener = EventListener(conn)
    listener.start()
    listener.subscribe('foregroundColorChanged', callback)
    conn.send_sync('app.foregroundColor.rgb.red=0')
    conn.send_sync('app.foregroundColor.rgb.red=10')
    conn.send_sync('app.foregroundColor.rgb.red=20')
    conn.send_sync('app.foregroundColor.rgb.red=30')
    time.sleep(2)
    print('done')