Ejemplo n.º 1
0
def main(_args):
    from xpra.platform import program_context
    from xpra.log import enable_color
    with program_context("GTK-Menu Info"):
        enable_color()
        if "-q" in sys.argv:
            sys.argv.remove("-q")
        elif "--quiet" in sys.argv:
            sys.argv.remove("--quiet")
        else:
            log.enable_debug()
            from xpra.dbus.gtk_menuactions import log as gtkmalog
            gtkmalog.enable_debug()
        try:
            from xpra.x11.gtk2.gdk_display_source import display  #@UnresolvedImport
            wid = sys.argv[1]
            if wid.startswith("0x"):
                xid = int(wid[2:], 16)
            else:
                xid = int(wid)
        except Exception as e:
            log.error("Error: invalid window id: %s", e)
            log.error("usage:")
            log.error(" %s WINDOWID", sys.argv[0])
        else:
            #beware: this import has side-effects:
            import dbus.glib
            assert dbus.glib
            from xpra.dbus.common import loop_init
            loop_init()
            import gobject
            loop = gobject.MainLoop()
            v = dump_menuactions(display, xid)
            loop.run()
            del v
Ejemplo n.º 2
0
def main(args):
    from xpra.platform import program_context
    from xpra.log import enable_color
    with program_context("GTK-Menu Info"):
        enable_color()
        if "-q" in sys.argv:
            sys.argv.remove("-q")
        elif "--quiet" in sys.argv:
            sys.argv.remove("--quiet")
        else:
            log.enable_debug()
            from xpra.dbus.gtk_menuactions import log as gtkmalog
            gtkmalog.enable_debug()
        try:
            from xpra.x11.gtk2.gdk_display_source import display    #@UnresolvedImport
            wid = sys.argv[1]
            if wid.startswith("0x"):
                xid = int(wid[2:], 16)
            else:
                xid = int(wid)
        except Exception as e:
            log.error("Error: invalid window id: %s", e)
            log.error("usage:")
            log.error(" %s WINDOWID", sys.argv[0])
        else:
            #beware: this import has side-effects:
            import dbus.glib
            assert dbus.glib
            from xpra.dbus.common import loop_init
            loop_init()
            import gobject
            loop = gobject.MainLoop()
            v = dump_menuactions(display, xid)
            loop.run()
            del v
Ejemplo n.º 3
0
def main():
    def mdns_found(*args):
        print("mdns_found: %s" % (args, ))
    def mdns_add(*args):
        print("mdns_add: %s" % (args, ))
    def mdns_remove(*args):
        print("mdns_remove: %s" % (args, ))

    from xpra.dbus.common import loop_init
    loop_init()
    listener = AvahiListener(XPRA_MDNS_TYPE, mdns_found, mdns_add, mdns_remove)
    try:
        from gi.repository import GLib
        GLib.idle_add(listener.start)
        GLib.MainLoop().run()
    finally:
        listener.stop()
Ejemplo n.º 4
0
def main():
	def mdns_found(*args):
		print("mdns_found: %s" % (args, ))
	def mdns_add(*args):
		print("mdns_add: %s" % (args, ))
	def mdns_remove(*args):
		print("mdns_remove: %s" % (args, ))

	from xpra.dbus.common import loop_init
	loop_init()
	listener = AvahiListener(XPRA_MDNS_TYPE, mdns_found, mdns_add, mdns_remove)
	try:
		from xpra.gtk_common.gobject_compat import import_glib
		glib = import_glib()
		glib.idle_add(listener.start)
		glib.MainLoop().run()
	finally:
		listener.stop()
Ejemplo n.º 5
0
def main():
    def mdns_found(*args):
        print("mdns_found: %s" % (args, ))

    def mdns_add(*args):
        print("mdns_add: %s" % (args, ))

    def mdns_remove(*args):
        print("mdns_remove: %s" % (args, ))

    from xpra.dbus.common import loop_init
    loop_init()
    listener = AvahiListener(XPRA_MDNS_TYPE, mdns_found, mdns_add, mdns_remove)
    try:
        from xpra.gtk_common.gobject_compat import import_glib
        glib = import_glib()
        glib.idle_add(listener.start)
        glib.MainLoop().run()
    finally:
        listener.stop()
Ejemplo n.º 6
0
def main(args):
    from xpra.dbus.common import loop_init
    loop_init()
    w = WindowWithMenu()
    w.show_all()
    gtk.main()
Ejemplo n.º 7
0
def main(args):
    from xpra.dbus.common import loop_init
    loop_init()
    w = WindowWithMenu()
    w.show_all()
    gtk.main()