Example #1
0
def main():
    dirname = sys.argv[1]
    if not os.path.exists(dirname):
        print("cannot find %s" % dirname)
        sys.exit(1)
    skip = 0
    try:
        skip = int(sys.argv[2])
    except:
        pass
    count = 999
    try:
        count = int(sys.argv[3])
    except:
        pass
    W = 1024
    H = 1200
    window_classes = []
    try:
        from xpra.client.gl.gtk2.nativegl_client_window import GLClientWindow
        window_classes.append(GLClientWindow)
    except Exception as e:
        print("no opengl window: %s" % e)
    try:
        from xpra.client.gtk2.client_window import ClientWindow
        window_classes.append(ClientWindow)
    except Exception as e:
        print("no pixmap window: %s" % e)
    client = FakeGTKClient()
    client.log_events = False
    windows = []
    for window_class in window_classes:
        windows.append(WindowAnim(window_class, client, 1, W, H))

    actions = []
    all_dirs = sorted(os.listdir(dirname))[skip:skip + count]
    print("all dirs=%s", (all_dirs, ))
    for i, d in enumerate(all_dirs):
        d = os.path.join(dirname, d)
        actions += frame_replay(d, windows, i)

    actions = list(reversed(actions))

    def handle_key_action(window, event):
        if event.pressed:
            a = actions.pop()
            #print("handle_key_action: action=%s" % (a[0], ))
            a[0](*a[1:])

    #print("actions=%s" % ([x[0] for x in actions], ))
    client.handle_key_action = handle_key_action
    try:
        gtk_main()
    except KeyboardInterrupt:
        pass
def main():
    dirname = sys.argv[1]
    if not os.path.exists(dirname):
        print("cannot find %s" % dirname)
        sys.exit(1)
    skip = 0
    try:
        skip = int(sys.argv[2])
    except:
        pass
    count = 999
    try:
        count = int(sys.argv[3])
    except:
        pass
    W = 1024
    H = 1200
    window_classes = []
    try:
        from xpra.client.gl.gtk2.gl_client_window import GLClientWindow
        window_classes.append(GLClientWindow)
    except Exception as e:
        print("no opengl window: %s" % e)
    try:
        from xpra.client.gtk2.border_client_window import BorderClientWindow
        window_classes.append(BorderClientWindow)
    except Exception as e:
        print("no pixmap window: %s" % e)
    client = FakeGTKClient()
    client.log_events = False
    windows = []
    for window_class in window_classes:
        windows.append(WindowAnim(window_class, client, 1, W, H))

    actions = []
    all_dirs = sorted(os.listdir(dirname))[skip:skip+count]
    print("all dirs=%s", (all_dirs,))
    for i,d in enumerate(all_dirs):
        d = os.path.join(dirname, d)
        actions += frame_replay(d, windows, i)

    actions = list(reversed(actions))
    def handle_key_action(window, event):
        if event.pressed:
            a = actions.pop()
            #print("handle_key_action: action=%s" % (a[0], ))
            a[0](*a[1:])

    #print("actions=%s" % ([x[0] for x in actions], ))
    client.handle_key_action = handle_key_action
    try:
        gtk_main()
    except KeyboardInterrupt:
        pass
def main():
    W = 640
    H = 480
    try:
        from xpra.client.gl.gtk2.nativegl_client_window import GLClientWindow
        window_class = GLClientWindow
    except Exception as e:
        print("no opengl window: %s" % e)
        from xpra.client.gtk2.client_window import ClientWindow
        window_class = ClientWindow
    client = FakeGTKClient()
    window = WindowAnim(window_class, client, 1)
    window.paint_png()
    for i in range(4):
        glib.timeout_add(500, window.paint_crect,               W//4*i + W//8, 100, 32, 32, 0x30*i)
    for i in range(50):
        glib.timeout_add(1000+i*20, window.paint_crect,         int(W//3+math.sin(i/10.0)*128), int(H//2-32+math.cos(i/10.0)*64), 32, 32, 0xA0008000+i*5)
        glib.timeout_add(1000+i*20, window.paint_and_vscroll,   -1)
        glib.timeout_add(2000+i*20, window.paint_crect,         int(W//3*2-math.sin(i/10.0)*128), int(H//2-16-math.cos(i/10.0)*64), 32, 32, 0x00F020FF-i*5)
        glib.timeout_add(2000+i*20, window.paint_and_vscroll,   +1)
    for i in range(200):
        glib.timeout_add(4000+i*20, window.split_vscroll,       max(1, i//50))
        glib.timeout_add(4000+i*20, window.paint_crect,         0, H//2-1, W, 2)

    try:
        gtk_main()
    except KeyboardInterrupt:
        pass
Example #4
0
def main():
    import sys
    def argint(n, d):
        try:
            return int(sys.argv[n])
        except:
            return d
    N = argint(1, 1)        #number of windows
    delay = argint(2, 20)
    ydelta = argint(3, 1)
    animate = argint(4, 1)
    client = FakeGTKClient()
    print("%i windows, delay=%ims, ydelta=%i" % (N, delay, ydelta))
    window_classes = []
    try:
        from xpra.client.gtk2.border_client_window import BorderClientWindow
        window_classes.append(BorderClientWindow)
    except:
        pass
    try:
        from xpra.client.gl.gtk2.gl_client_window import GLClientWindow
        window_classes.append(GLClientWindow)
    except:
        pass
    for wid in range(N):
        window_class = window_classes[wid % len(window_classes)]
        anim = WindowAnim(window_class, client, wid, animate=animate)
        glib.idle_add(anim.scrolluponce, ydelta)
        glib.timeout_add(delay, anim.scrollup, ydelta)
    try:
        gtk_main()
    except KeyboardInterrupt:
        pass
Example #5
0
def main():
    client = FakeGTKClient()
    try:
        from xpra.client.gl.gtk2.nativegl_client_window import GLClientWindow
        window_class = GLClientWindow
    except:
        from xpra.client.gtk2.client_window import ClientWindow
        window_class = ClientWindow
    anim = WindowAnim(window_class, client)
    glib.timeout_add(100, anim.movearound)
    try:
        gtk_main()
    except KeyboardInterrupt:
        pass