Beispiel #1
0
def main():
    from xpra.platform import init, clean
    try:
        init("OpenGL-Check")
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()
        #replace ImportError with a log message:
        global gl_check_error
        errors = []

        def log_error(msg):
            log.error("ERROR: %s", msg)
            errors.append(msg)

        gl_check_error = log_error
        props = check_support(True)
        log.info("")
        if len(errors) > 0:
            log.info("OpenGL errors:")
            for e in errors:
                log.info("  %s", e)
        log.info("")
        log.info("OpenGL properties:")
        for k, v in props.items():
            #skip not human readable:
            if k not in ("extensions", "glconfig"):
                log.info("  %s : %s", str(k).ljust(24), v)
        return len(errors)
    finally:
        clean()
Beispiel #2
0
def main():
    from xpra.platform import init
    init("OSX-Shadow-Test", "OSX Shadow Test")

    defaults = make_defaults_struct()
    for x in ("daemon", "clipboard", "mmap", "speaker", "microphone",
              "cursors", "bell", "notifications", "system_tray", "sharing",
              "delay_tray", "opengl"):
        setattr(defaults, x, False)

    loop_exit = gtk.main_quit
    loop_run = gtk.main

    XPRA_DISPLAY = ":10"
    sp = "~/.xpra/%s-%s" % (socket.gethostname(), XPRA_DISPLAY[1:])
    sockpath = os.path.expanduser(sp)

    listener = socket.socket(socket.AF_UNIX)
    listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    listener.setblocking(1)
    listener.bind(sockpath)
    sockets = [listener]

    ss = ShadowServer()
    ss.init(sockets, defaults)
    ss.run()

    gobject.timeout_add(1000 * 120, loop_exit)
    loop_run()
Beispiel #3
0
    def test_all(self):
        set_default_name("platform info test", "platform-info-test")
        init()
        t = start_thread(threaded_server_init, "server-init")
        t.join()
        with program_context() as p:
            assert repr(p)
            assert get_application_name() == "platform-info-test"
            assert get_prgname() == "platform info test"

        if WIN32:  # pragma: no cover
            #we can check for command_error and command_info
            #on win32 because those trigger dialogs
            return
        calls = []

        def ccall(*args):
            calls.append(args)

        xpra_main.error = ccall
        xpra_main.info = ccall
        command_error("error")
        command_info("info")
        assert len(calls) == 2, "expected 2 messages but got: %s" % (calls, )
        set_prgname(None)
        clean()
Beispiel #4
0
def main():
    from xpra.platform import init, clean
    try:
        init("Platform-Events", "Platform Events Test")
        import sys
        if "-v" in sys.argv or "--verbose" in sys.argv:
            from xpra.platform.win32.win32_events import log as win32_event_logger
            log.enable_debug()
            win32_event_logger.enable_debug()

        def suspend():
            log.info("suspend event")

        def resume():
            log.info("resume event")

        fake_client = AdHocStruct()
        fake_client.window_with_grab = None
        fake_client.suspend = suspend
        fake_client.resume = resume
        fake_client.keyboard_helper = None
        ClientExtras(fake_client, None)

        import gobject
        gobject.threads_init()

        log.info("Event loop is running")
        loop = gobject.MainLoop()
        try:
            loop.run()
        except KeyboardInterrupt:
            log.info("exiting on keyboard interrupt")
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #5
0
def main():
    from xpra.platform import init, clean
    try:
        init("Loader", "Encoding Info")
        import sys
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()

        load_codecs()
        print("codecs and csc modules found:")
        #print("codec_status=%s" % codecs)
        for name in ALL_CODECS:
            mod = codecs.get(name, "")
            if mod and hasattr(mod, "__file__"):
                mod = mod.__file__
                if mod.startswith(os.getcwd()):
                    mod = mod[len(os.getcwd()):]
                    if mod.startswith(os.path.sep):
                        mod = mod[1:]
            print("* %s : %s" % (name.ljust(20), mod))
        print("")
        print("codecs versions:")
        def pver(v):
            if type(v)==tuple:
                return ".".join([str(x) for x in v])
            elif type(v)==str and v.startswith("v"):
                return v[1:]
            return str(v)
        for name in sorted(codec_versions.keys()):
            version = codec_versions[name]
            print("* %s : %s" % (name.ljust(20), pver(version)))
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #6
0
def main():
    if "-v" in sys.argv or "--verbose" in sys.argv:
        from xpra.log import add_debug_category, enable_debug_for
        add_debug_category("printing")
        enable_debug_for("printing")
        try:
            sys.argv.remove("-v")
        except:
            pass
        try:
            sys.argv.remove("--verbose")
        except:
            pass

    from xpra.util import nonl, pver

    def print_dict(d):
        for k in sorted(d.keys()):
            v = d[k]
            print("* %s : %s" % (k.ljust(32), nonl(pver(v))))

    from xpra.platform import init, clean
    try:
        init("Printing", "Printing")
        if len(sys.argv) < 3:
            print_dict(get_printers())
        else:
            printer = sys.argv[1]
            print_files(printer, sys.argv[2:], "Print Command", {})
    finally:
        clean()
Beispiel #7
0
def main():
    from xpra.util import nonl
    def print_options(o):
        for k,ot in sorted(OPTION_TYPES.items()):
            v = getattr(o, name_to_field(k), "")
            if ot==bool and v is None:
                v = "Auto"
            if type(v)==list:
                v = ", ".join(str(x) for x in v)
            print("* %-32s : %s" % (k, nonl(v)))
    from xpra.platform import init, clean
    try:
        init("Config-Info", "Config Info")
        args = list(sys.argv[1:])
        if "-v" in args:
            global debug
            def debug(*args):
                print(args[0] % args[1:])
            args.remove("-v")

        print("Default Configuration:")
        print_options(make_defaults_struct())
        if len(args)>0:
            for filename in args:
                print("")
                print("Configuration file '%s':" % filename)
                if not os.path.exists(filename):
                    print(" Error: file not found")
                    continue
                d = read_config(filename)
                config = dict_to_validated_config(d)
                print_options(config)
    finally:
        clean()
Beispiel #8
0
def main():
    from xpra.platform import init, clean
    try:
        init("Platform-Events", "Platform Events Test")
        import sys
        if "-v" in sys.argv or "--verbose" in sys.argv:
            from xpra.platform.win32.win32_events import log as win32_event_logger
            log.enable_debug()
            win32_event_logger.enable_debug()

        def suspend():
            log.info("suspend event")
        def resume():
            log.info("resume event")
        fake_client = AdHocStruct()
        fake_client.window_with_grab = None
        fake_client.suspend = suspend
        fake_client.resume = resume
        fake_client.keyboard_helper = None
        ClientExtras(fake_client)

        import gobject
        gobject.threads_init()

        log.info("Event loop is running")
        loop = gobject.MainLoop()
        try:
            loop.run()
        except KeyboardInterrupt:
            log.info("exiting on keyboard interrupt")
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #9
0
def main():
    from xpra.platform import init,clean
    try:
        init("OpenGL-Check")
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()
        #replace ImportError with a log message:
        global gl_check_error
        errors = []
        def log_error(msg):
            log.error("ERROR: %s", msg)
            errors.append(msg)
        gl_check_error = log_error
        props = check_support(True)
        log.info("")
        if len(errors)>0:
            log.info("OpenGL errors:")
            for e in errors:
                log.info("  %s", e)
        log.info("")
        log.info("OpenGL properties:")
        for k,v in props.items():
            #skip not human readable:
            if k not in ("extensions", "glconfig"):
                log.info("  %s : %s", str(k).ljust(24), v)
        return len(errors)
    finally:
        clean()
Beispiel #10
0
def main():
    from xpra.platform import init, clean
    from xpra.log import enable_color
    try:
        init("Loader", "Encoding Info")
        enable_color()
        verbose = "-v" in sys.argv or "--verbose" in sys.argv
        if verbose:
            log.enable_debug()

        load_codecs()
        print("codecs and csc modules found:")
        #print("codec_status=%s" % codecs)
        for name in sorted(ALL_CODECS):
            mod = codecs.get(name, "")
            f = mod
            if mod and hasattr(mod, "__file__"):
                f = mod.__file__
                if f.startswith(os.getcwd()):
                    f = f[len(os.getcwd()):]
                    if f.startswith(os.path.sep):
                        f = f[1:]
            print("* %s : %s" % (name.ljust(20), f))
            if mod and verbose:
                try:
                    if name.find("csc") >= 0:
                        cs = list(mod.get_input_colorspaces())
                        for c in list(cs):
                            cs += list(mod.get_output_colorspaces(c))
                        print("                         colorspaces: %s" %
                              ", ".join(list(set(cs))))
                    elif name.find("enc") >= 0 or name.find("dec") >= 0:
                        encodings = mod.get_encodings()
                        print("                         encodings: %s" %
                              ", ".join(encodings))
                    try:
                        i = mod.get_info()
                        for k, v in sorted(i.items()):
                            print("                         %s = %s" % (k, v))
                    except:
                        pass
                except Exception as e:
                    print("error getting extra information on %s: %s" %
                          (name, e))
        print("")
        print("codecs versions:")

        def pver(v):
            if type(v) == tuple:
                return ".".join([str(x) for x in v])
            elif type(v) in (str, unicode) and v.startswith("v"):
                return v[1:]
            return str(v)

        for name in sorted(codec_versions.keys()):
            version = codec_versions[name]
            print("* %s : %s" % (name.ljust(20), pver(version)))
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #11
0
def main():
    def print_dict(d):
        for k in sorted(d.keys()):
            v = d[k]
            print("* %s : %s" % (k.ljust(32), nonl(pver(v))))
    from xpra.platform import init, clean
    try:
        init("Version-Info", "Version Info")
        print("Build:")
        print_dict(get_version_info())
        print("")
        print("Platform:")
        pi = get_platform_info()
        #ugly workaround for the fact that "sys.platform" has no key..
        if "" in pi:
            pi["sys"] = pi[""]
            del pi[""]
        print_dict(pi)
        print("")
        print("Host:")
        d = get_host_info()
        #add os specific version info:
        try:
            from xpra.platform.info import get_version_info as pvinfo
            d.update(pvinfo())
        except:
            pass
        print_dict(d)
    finally:
        clean()
Beispiel #12
0
def main():
    if "-v" in sys.argv or "--verbose" in sys.argv:
        from xpra.log import add_debug_category, enable_debug_for

        add_debug_category("printing")
        enable_debug_for("printing")
        try:
            sys.argv.remove("-v")
        except:
            pass
        try:
            sys.argv.remove("--verbose")
        except:
            pass

    from xpra.util import nonl, pver

    def print_dict(d):
        for k in sorted(d.keys()):
            v = d[k]
            print("* %s : %s" % (k.ljust(32), nonl(pver(v))))

    from xpra.platform import init, clean

    try:
        init("Printing", "Printing")
        if len(sys.argv) < 3:
            print_dict(get_printers())
        else:
            printer = sys.argv[1]
            print_files(printer, sys.argv[2:], "Print Command", {})
    finally:
        clean()
Beispiel #13
0
def main():
    global pygst_version, gst_version, gst_vinfo
    from xpra.platform import init, clean
    from xpra.log import enable_color
    try:
        init("GStreamer-Info", "GStreamer Information")
        enable_color()
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()
        import_gst()
        print("Loaded Python GStreamer version %s for Python %s.%s" %
              (gst_vinfo, sys.version_info[0], sys.version_info[1]))
        print("GStreamer plugins found: %s" %
              ", ".join(get_all_plugin_names()))
        print("")
        print("GStreamer version: %s" % ".".join([str(x)
                                                  for x in gst_version]))
        print("PyGStreamer version: %s" %
              ".".join([str(x) for x in pygst_version]))
        print("")
        encs = [x for x in CODEC_ORDER if has_encoder(x)]
        decs = [x for x in CODEC_ORDER if has_decoder(x)]
        print("encoders supported: %s" % ", ".join(encs))
        print("decoders supported: %s" % ", ".join(decs))
    finally:
        clean()
Beispiel #14
0
def main():
    from xpra.platform import init
    init("OSX-Shadow-Test", "OSX Shadow Test")

    defaults = make_defaults_struct()
    for x in ("daemon", "clipboard", "mmap", "speaker", "microphone",
              "cursors", "bell", "notifications",
              "system_tray", "sharing",
              "delay_tray", "opengl"):
        setattr(defaults, x, False)

    loop_exit = gtk.main_quit
    loop_run = gtk.main


    XPRA_DISPLAY = ":10"
    sp = "~/.xpra/%s-%s" % (socket.gethostname(), XPRA_DISPLAY[1:])
    sockpath = os.path.expanduser(sp)

    listener = socket.socket(socket.AF_UNIX)
    listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    listener.setblocking(1)
    listener.bind(sockpath)
    sockets = [listener]

    ss = ShadowServer()
    ss.init(sockets, defaults)
    ss.run()

    gobject.timeout_add(1000*120, loop_exit)
    loop_run()
Beispiel #15
0
def main():
    if "-v" in sys.argv or "--verbose" in sys.argv:
        from xpra.log import add_debug_category, enable_debug_for
        add_debug_category("printing")
        enable_debug_for("printing")
        try:
            sys.argv.remove("-v")
        except:
            pass
        try:
            sys.argv.remove("--verbose")
        except:
            pass

    from xpra.platform import init, clean
    from xpra.log import enable_color
    try:
        init("PyCUPS Printing")
        enable_color()
        validate_setup()
        log.info("")
        log.info("printer definitions:")
        for k, v in get_printer_definitions().items():
            log.info("* %-32s: %s", k, v)
        log.info("")
        log.info("local printers:")
        printers = get_printers()
        for k, d in get_all_printers().items():
            log.info("* %s%s", k, [" (NOT EXPORTED)", ""][int(k in printers)])
            for pk, pv in d.items():
                if pk == "printer-state" and pv in PRINTER_STATE:
                    pv = "%s (%s)" % (pv, PRINTER_STATE.get(pv))
                log.info("    %-32s: %s", pk, pv)
    finally:
        clean()
Beispiel #16
0
def main():
    from xpra.platform import init,clean
    from xpra.platform.gui import init as gui_init
    from xpra.util import pver
    try:
        init("OpenGL-Check")
        gui_init()
        verbose = "-v" in sys.argv or "--verbose" in sys.argv
        if verbose:
            log.enable_debug()
        #replace ImportError with a log message:
        global gl_check_error
        errors = []
        def log_error(msg):
            log.error("ERROR: %s", msg)
            errors.append(msg)
        gl_check_error = log_error
        props = check_support(0, True, verbose)
        log.info("")
        if len(errors)>0:
            log.info("OpenGL errors:")
            for e in errors:
                log.info("  %s", e)
        log.info("")
        log.info("OpenGL properties:")
        for k in sorted(props.keys()):
            v = props[k]
            #skip not human readable:
            if k not in ("extensions", "glconfig"):
                log.info("* %s : %s", str(k).ljust(24), pver(v))
        return len(errors)
    finally:
        clean()
Beispiel #17
0
def main():
    from xpra.platform import init, clean
    from xpra.util import pver
    try:
        init("OpenGL-Check")
        verbose = "-v" in sys.argv or "--verbose" in sys.argv
        if verbose:
            log.enable_debug()
        #replace ImportError with a log message:
        global gl_check_error
        errors = []

        def log_error(msg):
            log.error("ERROR: %s", msg)
            errors.append(msg)

        gl_check_error = log_error
        props = check_support(0, True, verbose)
        log.info("")
        if len(errors) > 0:
            log.info("OpenGL errors:")
            for e in errors:
                log.info("  %s", e)
        log.info("")
        log.info("OpenGL properties:")
        for k in sorted(props.keys()):
            v = props[k]
            #skip not human readable:
            if k not in ("extensions", "glconfig"):
                log.info("* %s : %s", str(k).ljust(24), pver(v))
        return len(errors)
    finally:
        clean()
Beispiel #18
0
def main():
    def print_dict(d):
        for k in sorted(d.keys()):
            v = d[k]
            print("* %s : %s" % (k.ljust(32), nonl(pver(v))))
    from xpra.platform import init, clean
    try:
        init("Version-Info", "Version Info")
        print("Build:")
        print_dict(get_version_info())
        print("")
        print("Platform:")
        pi = get_platform_info()
        #ugly workaround for the fact that "sys.platform" has no key..
        if "" in pi:
            pi["sys"] = pi[""]
            del pi[""]
        print_dict(pi)
        print("")
        print("Host:")
        d = get_host_info()
        #add os specific version info:
        try:
            from xpra.platform.info import get_version_info as pvinfo
            d.update(pvinfo())
        except:
            pass
        print_dict(d)
    finally:
        clean()
Beispiel #19
0
def main():
    from multiprocessing import freeze_support  #@UnresolvedImport
    freeze_support()

    os.environ["XPRA_REDIRECT_OUTPUT"] = "1"
    #os.environ["XPRA_LOG_FILENAME"] = "E:\\Proxy.log"
    #os.environ["XPRA_ALL_DEBUG"] = "1"
    os.environ["XPRA_NAMED_PIPE_UNRESTRICTED"] = "1"

    from xpra.platform import init, set_default_name
    set_default_name("Xpra-Proxy")
    init()

    from xpra.scripts.main import main
    args = sys.argv[:1] + [
        "proxy",
        "--bind=xpra-proxy",
        "--auth=sys",
        "--bind-tcp=0.0.0.0:14500",
        "--tcp-auth=sys",
        #"--mdns=no",
        "-d",
        "win32,proxy",
    ] + sys.argv[1:]
    commonappdata = get_commonappdata_dir()
    if commonappdata:
        ssl_cert = os.path.join(commonappdata, "Xpra", "ssl-cert.pem")
        if os.path.exists(ssl_cert):
            args.append("--ssl-cert=%s" % ssl_cert)
    sys.exit(main(sys.argv[0], args))
Beispiel #20
0
def main():
    from xpra.platform import init, clean
    try:
        init("Loader", "Encoding Info")
        verbose = "-v" in sys.argv or "--verbose" in sys.argv
        if verbose:
            log.enable_debug()

        load_codecs()
        print("codecs and csc modules found:")
        #print("codec_status=%s" % codecs)
        for name in ALL_CODECS:
            mod = codecs.get(name, "")
            f = mod
            if mod and hasattr(mod, "__file__"):
                f = mod.__file__
                if f.startswith(os.getcwd()):
                    f = f[len(os.getcwd()):]
                    if f.startswith(os.path.sep):
                        f = f[1:]
            print("* %s : %s" % (name.ljust(20), f))
            if mod and verbose:
                try:
                    if name=="PIL":
                        #special case for PIL which can be used for both encoding and decoding:
                        from xpra.codecs.codec_constants import get_PIL_encodings, get_PIL_decodings
                        e = get_PIL_encodings(mod)
                        print("                         ENCODE: %s" % ", ".join(e))
                        d = get_PIL_decodings(mod)
                        print("                         DECODE: %s" % ", ".join(d))
                    elif name.find("csc")>=0:
                        cs = list(mod.get_input_colorspaces())
                        for c in list(cs):
                            cs += list(mod.get_output_colorspaces(c))
                        print("                         %s" % ", ".join(list(set(cs))))
                    elif name.find("enc")>=0 or name.find("dec")>=0:
                        encodings = mod.get_encodings()
                        print("                         %s" % ", ".join(encodings))
                    try:
                        i = mod.get_info()
                        print("                         %s" % i)
                    except:
                        pass
                except Exception as e:
                    print("error getting extra information on %s: %s" % (name, e))
        print("")
        print("codecs versions:")
        def pver(v):
            if type(v)==tuple:
                return ".".join([str(x) for x in v])
            elif type(v) in (str, unicode) and v.startswith("v"):
                return v[1:]
            return str(v)
        for name in sorted(codec_versions.keys()):
            version = codec_versions[name]
            print("* %s : %s" % (name.ljust(20), pver(version)))
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #21
0
def main():
    from xpra.platform import init, clean
    try:
        init("Keyboard-Test", "Keyboard Test Tool")
        KeyboardStateInfoWindow()
        gtk.main()
    finally:
        clean()
Beispiel #22
0
def main():
    from xpra.platform import init, clean
    try:
        init("Clipboard-Test", "Clipboard Test Tool")
        ClipboardStateInfoWindow()
        gtk.main()
    finally:
        clean()
Beispiel #23
0
def main():
    from xpra.platform import init, clean
    try:
        init("OSX Extras")
        log.enable_debug()
        ce = ClientExtras(None, None)
        ce.run()
    finally:
        clean()
Beispiel #24
0
def main():
    from xpra.platform import init, clean
    try:
        init("Packet Encoding", "Packet Encoding Info")
        for k,v in sorted(get_packet_encoding_caps().items()):
            print(k.ljust(20)+": "+str(v))
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #25
0
def main():
    from xpra.platform import init, clean
    try:
        init("Compression", "Compression Info")
        for k,v in sorted(get_compression_caps().items()):
            print(k.ljust(20)+": "+str(v))
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #26
0
def main():
    from xpra.platform import init, clean
    try:
        init("Packet Encoding", "Packet Encoding Info")
        for k, v in sorted(get_packet_encoding_caps().items()):
            print(k.ljust(20) + ": " + str(v))
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #27
0
def main():
    from xpra.platform import init, clean
    from xpra.log import enable_color
    try:
        init("Clipboard-Test", "Clipboard Test Tool")
        enable_color()
        ClipboardStateInfoWindow()
        gtk.main()
    finally:
        clean()
Beispiel #28
0
def main():
    from xpra.platform import init, clean
    from xpra.log import enable_color
    try:
        init("Keyboard-Test", "Keyboard Test Tool")
        enable_color()
        KeyboardStateInfoWindow()
        gtk.main()
    finally:
        clean()
Beispiel #29
0
def main():
    def print_dict(d):
        for k in sorted(d.keys()):
            v = d[k]
            print("* %s : %s" % (str(k).replace(".version", "").ljust(12), nonl(pver(v))))
    from xpra.platform import init, clean
    try:
        init("GTK-Version-Info", "GTK Version Info")
        print_dict(GTK_VERSION_INFO)
    finally:
        clean()
Beispiel #30
0
def main():
    from xpra.os_util import set_application_name, set_prgname
    if sys.platform.startswith("win"):
        from xpra.platform.win32 import set_redirect_output, set_log_filename
        set_redirect_output(True)
        set_log_filename("Keyboard_Test.log")
    init()
    set_prgname("Keyboard Test Tool")
    set_application_name("Keyboard Test Tool")
    KeyboardStateInfoWindow()
    gtk.main()
Beispiel #31
0
def main():
    from xpra.gtk_util import set_application_name, set_prgname
    set_prgname("Clipboard Test Tool")
    set_application_name("Clipboard Test Tool")
    if sys.platform.startswith("win"):
        from xpra.win32 import set_redirect_output, set_log_filename
        set_redirect_output(True)
        set_log_filename("Clipboard_Test.log")
    init()
    ClipboardStateInfoWindow()
    gtk.main()
Beispiel #32
0
def main():
    init("Clipboard-Test", "Primary Clipboard Test Tool")

    frc = FakeRemoteClipboard()
    gobject.timeout_add(1000, frc.fake_token)
    #gobject.timeout_add(1200, fake_target, 0)
    #gobject.timeout_add(1400, fake_target, 1)
    #gobject.timeout_add(1600, fake_target, 2)
    #gobject.timeout_add(1800, fake_data, 2)
    #gobject.timeout_add(2500, fake_data, 3)
    #gobject.timeout_add(3500, fake_data, 5)
    gtk.main()
Beispiel #33
0
def main():
	init("Clipboard-Test", "Primary Clipboard Test Tool")

	frc = FakeRemoteClipboard()
	gobject.timeout_add(1000, frc.fake_token)
	#gobject.timeout_add(1200, fake_target, 0)
	#gobject.timeout_add(1400, fake_target, 1)
	#gobject.timeout_add(1600, fake_target, 2)
	#gobject.timeout_add(1800, fake_data, 2)
	#gobject.timeout_add(2500, fake_data, 3)
	#gobject.timeout_add(3500, fake_data, 5)
	gtk.main()
Beispiel #34
0
def main():
    from xpra.platform import init, clean
    from xpra.log import enable_color
    try:
        init("Pulseaudio-Info")
        enable_color()
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()
        i = get_info()
        for k in sorted(i):
            log.info("%s : %s", k.ljust(64), i[k])
    finally:
        clean()
def main():
    init("Network-Test", "Xpra Network Protocol Test Tool")
    mainloop = gobject.MainLoop()
    ss = SimpleServer()
    ss.init(mainloop.quit)

    def start_client(*args):
        sc = SimpleClient()
        sc.init(mainloop.quit, [("hello", ()), ("disconnect", "because we want to")])
        return False

    gobject.timeout_add(1000 * 1, start_client)
    mainloop.run()
Beispiel #36
0
def main():
    from xpra.platform import init, clean
    try:
        init("Codec-Constants", "Codec Constants Info")
        import sys
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()
        log.info("LOSSY_PIXEL_FORMATS=%s", LOSSY_PIXEL_FORMATS)
        log.info("PIXEL_SUBSAMPLING=%s", PIXEL_SUBSAMPLING)
        log.info("RGB_FORMATS=%s", RGB_FORMATS)
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #37
0
def main():
    from xpra.platform import init, clean
    try:
        init("Shadow-Test", "Shadow Server Screen Capture Test")
        rwm = Win32RootWindowModel(None)
        pngdata = rwm.take_screenshot()
        FILENAME = "screenshot.png"
        with open(FILENAME, "wb") as f:
            f.write(pngdata[4])
        print("saved screenshot as %s" % FILENAME)
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #38
0
def main():
    from xpra.platform import init, clean
    try:
        init("Codec-Constants", "Codec Constants Info")
        import sys
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()
        log.info("LOSSY_PIXEL_FORMATS=%s", LOSSY_PIXEL_FORMATS)
        log.info("PIXEL_SUBSAMPLING=%s", PIXEL_SUBSAMPLING)
        log.info("RGB_FORMATS=%s", RGB_FORMATS)
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #39
0
def main():
    from xpra.platform import init, clean
    from xpra.log import enable_color
    try:
        init("Pulseaudio-Info")
        enable_color()
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()
        i = get_info()
        for k in sorted(i):
            log.info("%s : %s", k.ljust(64), i[k])
    finally:
        clean()
Beispiel #40
0
def main():
    from xpra.platform import init, clean
    try:
        init("Shadow-Test", "Shadow Server Screen Capture Test")
        rwm = Win32RootWindowModel(None)
        pngdata = rwm.take_screenshot()
        FILENAME = "screenshot.png"
        with open(FILENAME , "wb") as f:
            f.write(pngdata[4])
        print("saved screenshot as %s" % FILENAME)
    finally:
        #this will wait for input on win32:
        clean()
def main():
    init("Network-Test", "Xpra Network Protocol Test Tool")
    mainloop = gobject.MainLoop()
    ss = SimpleServer()
    ss.init(mainloop.quit)

    def start_client(*args):
        sc = SimpleClient()
        sc.init(mainloop.quit, [("hello", ()),
                                ("disconnect", "because we want to")])
        return False

    gobject.timeout_add(1000 * 1, start_client)
    mainloop.run()
Beispiel #42
0
def main():
    from xpra.platform import init, clean
    try:
        init("GStreamer-Info", "GStreamer Information")
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()
        log.info("GStreamer plugins found: %s", ", ".join(get_all_plugin_names()))
        log.info("")
        encs = [x for x in CODEC_ORDER if has_encoder(x)]
        decs = [x for x in CODEC_ORDER if has_decoder(x)]
        log.info("encoders supported: %s", encs)
        log.info("decoders supported: %s", decs)
    finally:
        clean()
Beispiel #43
0
def main():
    import sys
    from xpra.platform import init, clean
    try:
        init("Keymap-Tool", "Keymap Information Tool")
        if "-v" in sys.argv:
            log.enable_debug()
        gtk_keymap = get_gtk_keymap()
        def pkey(*entries):
            print(("".join([str(x).ljust(18) for x in entries])).strip())
        pkey("keyval", "name", "keycode", "group", "level")
        for x in gtk_keymap:
            pkey(*x)
    finally:
        clean()
Beispiel #44
0
def main():
    from xpra.util import nonl, pver
    def print_dict(d, vformat=pver):
        for k in sorted(d.keys()):
            v = d[k]
            print("* %s : %s" % (str(k).replace(".version", "").ljust(12), nonl(vformat(v))))
    from xpra.platform import init, clean
    try:
        init("GTK-Version-Info", "GTK Version Info")
        print("GTK Version:")
        print_dict(get_gtk_version_info())
        print("Display:")
        print_dict(get_display_info(), vformat=str)
    finally:
        clean()
Beispiel #45
0
def main():
    from xpra.util import nonl, pver
    def print_dict(d):
        for k in sorted(d.keys()):
            v = d[k]
            print("* %s : %s" % (k.ljust(32), nonl(pver(v))))
    from xpra.platform import init, clean
    try:
        init("Features-Info", "Features Info")
        d = {}
        for k in sorted(_features_list_):
            d[k] = globals()[k]
        print_dict(d)
    finally:
        clean()
Beispiel #46
0
def main():
    import sys
    from xpra.platform import init, clean
    try:
        init("Keymap-Tool", "Keymap Information Tool")
        if "-v" in sys.argv:
            log.enable_debug()
        gtk_keymap = get_gtk_keymap()
        def pkey(*entries):
            print(("".join([str(x).ljust(18) for x in entries])).strip())
        pkey("keyval", "name", "keycode", "group", "level")
        for x in gtk_keymap:
            pkey(*x)
    finally:
        clean()
Beispiel #47
0
def main():
    if "-v" in sys.argv or "--verbose" in sys.argv:
        from xpra.log import add_debug_category
        add_debug_category("util")

    from xpra.util import nonl, pver
    def print_dict(d):
        for k in sorted(d.keys()):
            v = d[k]
            print("* %s : %s" % (k.ljust(32), nonl(pver(v))))
    from xpra.platform import init, clean
    try:
        init("Path-Info", "Path Info")
        print_dict(get_info())
    finally:
        clean()
Beispiel #48
0
def main():
    from xpra.platform import init, clean
    try:
        init("GStreamer-Info", "GStreamer Information")
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()
        print("GStreamer plugins found: %s" % ", ".join(get_all_plugin_names()))
        print("")
        print("GStreamer version: %s" % ".".join([str(x) for x in gst_version]))
        print("PyGStreamer version: %s" % ".".join([str(x) for x in pygst_version]))
        print("")
        encs = [x for x in CODEC_ORDER if has_encoder(x)]
        decs = [x for x in CODEC_ORDER if has_decoder(x)]
        print("encoders supported: %s" % str(encs))
        print("decoders supported: %s" % str(decs))
    finally:
        clean()
Beispiel #49
0
def main():
    from xpra.platform import init, clean
    from xpra.log import enable_color
    try:
        init("Network-Info", "Network Info")
        enable_color()
        verbose = "-v" in sys.argv or "--verbose" in sys.argv
        if verbose:
            log.enable_debug()

        print("Network interfaces found:")
        for iface in get_interfaces():
            if if_nametoindex:
                print("* %s (index=%s)" %
                      (iface.ljust(20), if_nametoindex(iface)))
            else:
                print("* %s" % iface)

        def pver(v):
            if type(v) in (tuple, list):
                s = ""
                for i in range(len(v)):
                    if i > 0:
                        #dot seperated numbers
                        if type(v[i - 1]) == int:
                            s += "."
                        else:
                            s += ", "
                    s += str(v[i])
                return s
            elif type(v) == str and v.startswith("v"):
                return v[1:]
            return str(v)

        print("")
        print("Protocol Capabilities:")
        from xpra.net.protocol import get_network_caps
        netcaps = get_network_caps()
        if netifaces_version:
            netcaps["netifaces.version"] = netifaces_version
        for k in sorted(netcaps.keys()):
            print("* %s : %s" % (str(k).ljust(20), pver(netcaps[k])))

    finally:
        #this will wait for input on win32:
        clean()
Beispiel #50
0
def main():
    from xpra.util import nonl, pver

    def print_dict(d):
        for k in sorted(d.keys()):
            v = d[k]
            print("* %s : %s" % (k.ljust(32), nonl(pver(v))))

    from xpra.platform import init, clean
    try:
        init("Features-Info", "Features Info")
        d = {}
        for k in sorted(_features_list_):
            d[k] = globals()[k]
        print_dict(d)
    finally:
        clean()
Beispiel #51
0
def main():
    if "-v" in sys.argv or "--verbose" in sys.argv:
        log.enable_debug()

    from xpra.platform import init, clean
    try:
        init("Nvidia-Info", "Nvidia Info")
        #this will log the version number:
        identify_nvidia_module_version()
        log.info("NVENC license keys:")
        for v in (0, 3, 4):
            keys = get_nvenc_license_keys(v)
            log.info("* version %s: %s key(s)", v or "common", len(keys))
            for k in keys:
                log.info("  %s", k)
    finally:
        clean()
Beispiel #52
0
def main():
	from xpra.platform import init, clean
	from xpra.log import enable_color
	try:
		init("Network-Info", "Network Info")
		enable_color()
		verbose = "-v" in sys.argv or "--verbose" in sys.argv
		if verbose:
			log.enable_debug()

		print("Network interfaces found:")
		for iface in get_interfaces():
			if if_nametoindex:
				print("* %s (index=%s)" % (iface.ljust(20), if_nametoindex(iface)))
			else:
				print("* %s" % iface)

		def pver(v):
			if type(v) in (tuple, list):
				s = ""
				for i in range(len(v)):
					if i>0:
						#dot seperated numbers
						if type(v[i-1])==int:
							s += "."
						else:
							s += ", "
					s += str(v[i])
				return s
			elif type(v)==str and v.startswith("v"):
				return v[1:]
			return str(v)

		print("")
		print("Protocol Capabilities:")
		from xpra.net.protocol import get_network_caps
		netcaps = get_network_caps()
		if netifaces_version:
			netcaps["netifaces.version"] = netifaces_version
		for k in sorted(netcaps.keys()):
			print("* %s : %s" % (str(k).ljust(20), pver(netcaps[k])))

	finally:
		#this will wait for input on win32:
		clean()
Beispiel #53
0
def main():
    from xpra.platform import init, clean
    try:
        init("Codec-Constants", "Codec Constants Info")
        import sys
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()

        try:
            from PIL import Image   #@UnresolvedImport @UnusedImport
            import PIL              #@UnresolvedImport
        except:
            PIL = None
        print("PIL encodings: %s" % ", ".join(get_PIL_encodings(PIL)))
        print("PIL decodings: %s" % ", ".join(get_PIL_decodings(PIL)))
    finally:
        #this will wait for input on win32:
        clean()
Beispiel #54
0
def main():
    import sys
    from xpra.platform import init, clean
    from xpra.log import enable_color
    try:
        init("Keymap-Tool", "Keymap Information Tool")
        enable_color()
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()
        gtk_keymap = get_gtk_keymap()
        sizes = [16, 28, 8, 8, 8]
        def pkey(*entries):
            print(("".join([str(x).ljust(sizes[i]) for i,x in enumerate(entries)])).strip())
        pkey("keyval", "name", "keycode", "group", "level")
        for x in gtk_keymap:
            pkey(*x)
    finally:
        clean()
Beispiel #55
0
def main():
    if "-v" in sys.argv or "--verbose" in sys.argv:
        from xpra.log import add_debug_category

        add_debug_category("util")

    from xpra.util import nonl, pver

    def print_dict(d):
        for k in sorted(d.keys()):
            v = d[k]
            print("* %s : %s" % (k.ljust(32), nonl(pver(v))))

    from xpra.platform import init, clean

    try:
        init("Path-Info", "Path Info")
        print_dict(get_info())
    finally:
        clean()