Ejemplo n.º 1
0
def main():
    log = Logger("client")
    from xpra.client.gtk2.tray_menu import GTK2TrayMenu
    client = FakeClient()
    log.info("creating tray menu")
    tray = GTK2TrayMenu(client)
    client.menu = tray.build()
    client.fire_handshake_callbacks()
    log.info("creating tray widget")
    def tray_click(button, pressed, time=0):
        log.info("tray_click(%s, %s, %s)", button, pressed, time)
        if button==1 and pressed:
            glib.idle_add(tray.activate, button, time)
        elif button==3 and not pressed:
            glib.idle_add(tray.popup, button, time)
    def tray_mouseover(*args):
        log.info("tray_mouseover(%s)", args)
    def tray_exit(*args):
        log.info("tray_exit(%s)", args)
        gtk.main_quit()
    def tray_geometry(*args):
        log.info("tray_geometry%s", args)
    GTKStatusIconTray(client, client.menu, "test", None, size_changed_cb=tray_geometry(), click_cb=tray_click, mouseover_cb=tray_mouseover, exit_cb=tray_exit)
    log.info("running main loop")
    gtk.main()
Ejemplo n.º 2
0
def gl_backing_test(gl_client_window_class=None, w=200, h=100):
    window = gl_client_window_class(FakeClient(), None, 1, 0, 0, w, h, {},
                                    False, {}, 0)
    window.show()

    def update_backing(*args):
        log("update_backing(%s)", args)
        import random
        y = chr(int(random.random() * 256.0))
        u = chr(int(random.random() * 256.0))
        v = chr(int(random.random() * 256.0))
        img_data = [y * w * h * 2, u * w * h * 2, v * w * h * 2]
        rowstrides = [w, w, w]
        pixel_format = "YUV444P"

        def update_done(*args):
            log("update_done(%s)", args)

        window._backing.do_gl_paint(0, 0, w, h, img_data, rowstrides,
                                    pixel_format, [update_done])
        return True

    def initial_update(*args):
        update_backing()
        return False

    gobject.timeout_add(10, initial_update)
    gobject.timeout_add(1000 * 5, update_backing)
Ejemplo n.º 3
0
def main():
    log = Logger("client")
    from xpra.client.gtk2.tray_menu import GTK2TrayMenu
    client = FakeClient()
    log.info("creating tray menu")
    tray = GTK2TrayMenu(client)
    client.menu = tray.build()
    client.fire_handshake_callbacks()
    log.info("creating tray widget")

    def tray_click(button, pressed, time=0):
        log.info("tray_click(%s, %s, %s)", button, pressed, time)
        if button == 1 and pressed:
            glib.idle_add(tray.activate, button, time)
        elif button == 3 and not pressed:
            glib.idle_add(tray.popup, button, time)

    def tray_mouseover(*args):
        log.info("tray_mouseover(%s)", args)

    def tray_exit(*args):
        log.info("tray_exit(%s)", args)
        gtk.main_quit()

    def tray_geometry(*args):
        log.info("tray_geometry%s", args)

    GTKStatusIconTray(client,
                      client.menu,
                      "test",
                      None,
                      size_changed_cb=tray_geometry(),
                      click_cb=tray_click,
                      mouseover_cb=tray_mouseover,
                      exit_cb=tray_exit)
    log.info("running main loop")
    gtk.main()
Ejemplo n.º 4
0
 def __init__(self):
     FakeClient.__init__(self)
     self.source_remove = GLib.source_remove
     self.timeout_add = GLib.timeout_add
     self.idle_add = GLib.idle_add
Ejemplo n.º 5
0
 def __init__(self):
     FakeClient.__init__(self)
     self.source_remove = glib.source_remove
     self.timeout_add = glib.timeout_add
     self.idle_add = glib.idle_add