Пример #1
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()
Пример #2
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()
Пример #3
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()
Пример #4
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()
Пример #5
0
def main():
    from xpra.platform import init as platform_init, clean
    from xpra.util import nonl
    from xpra.log import enable_color

    try:
        platform_init("GUI-Properties")
        enable_color()
        init()
        verbose = "-v" in sys.argv or "--verbose" in sys.argv
        if verbose:
            from xpra.log import get_all_loggers

            for x in get_all_loggers():
                x.enable_debug()

        # naughty, but how else can I hook this up?
        import os

        if os.name == "posix":
            try:
                from xpra.x11.bindings import posix_display_source  # @UnusedImport
            except:
                pass  # maybe running on OSX? hope for the best..
        i = get_info()
        for k in sorted(i.keys()):
            v = i[k]
            print("* %s : %s" % (k.ljust(32), nonl(v)))
    finally:
        clean()
Пример #6
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()
Пример #7
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()
Пример #8
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()
Пример #9
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()
Пример #10
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()
Пример #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()
Пример #12
0
def main():
    from xpra.platform.gui import init as gui_init
    from xpra.platform import init as platform_init,clean
    try:
        platform_init("XSettings")
        gui_init()
        verbose = "-v" in sys.argv or "--verbose" in sys.argv
        if verbose:
            from xpra.log import get_all_loggers
            for x in get_all_loggers():
                x.enable_debug()

        #naughty, but how else can I hook this up?
        import os
        if os.name!="posix":
            print("xsettings require a posix OS")
            return 1

        from xpra.x11.bindings import posix_display_source  #@UnresolvedImport - takes care of hooking up the display
        assert posix_display_source
        from xpra.x11.bindings.window_bindings import X11WindowBindings #@UnresolvedImport
        window_bindings = X11WindowBindings()
        selection = "_XSETTINGS_S0"
        owner = window_bindings.XGetSelectionOwner(selection)
        print("owner(%s)=%#x" % (selection, owner))
        XSETTINGS = "_XSETTINGS_SETTINGS"
        data = window_bindings.XGetWindowProperty(owner, XSETTINGS, XSETTINGS)
        serial, settings = get_settings(None, data)
        print("serial=%s" % serial)
        print("%s settings:" % len(settings))
        for s in settings:
            print(s)
        return 0
    finally:
        clean()
Пример #13
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()
Пример #14
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()
Пример #15
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()
Пример #16
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()
Пример #17
0
def main():
    from xpra.platform import init as platform_init, clean
    from xpra.util import nonl
    from xpra.log import enable_color
    try:
        platform_init("GUI-Properties")
        enable_color()
        init()
        verbose = "-v" in sys.argv or "--verbose" in sys.argv
        if verbose:
            from xpra.log import get_all_loggers
            for x in get_all_loggers():
                x.enable_debug()

        #naughty, but how else can I hook this up?
        import os
        if os.name == "posix":
            try:
                from xpra.x11.bindings import posix_display_source  #@UnusedImport
            except:
                pass  #maybe running on OSX? hope for the best..
        i = get_info()
        for k in sorted(i.keys()):
            v = i[k]
            print("* %s : %s" % (k.ljust(32), nonl(v)))
    finally:
        clean()
Пример #18
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()
Пример #19
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()
Пример #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()
Пример #21
0
def main():
    from xpra.platform import init, clean
    try:
        init("Keyboard-Test", "Keyboard Test Tool")
        KeyboardStateInfoWindow()
        gtk.main()
    finally:
        clean()
Пример #22
0
def main():
    from xpra.platform import init, clean
    try:
        init("Clipboard-Test", "Clipboard Test Tool")
        ClipboardStateInfoWindow()
        gtk.main()
    finally:
        clean()
Пример #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()
Пример #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()
Пример #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()
Пример #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()
Пример #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()
Пример #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()
Пример #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()
Пример #30
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()
Пример #31
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()
Пример #32
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()
Пример #33
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()
Пример #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()
Пример #35
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()
Пример #36
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()
Пример #37
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()
Пример #38
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()
Пример #39
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()
Пример #40
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()
Пример #41
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()
Пример #42
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()
Пример #43
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()
Пример #44
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()
Пример #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()
Пример #46
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()
Пример #47
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()
Пример #48
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()
Пример #49
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()
Пример #50
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()
Пример #51
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()
Пример #52
0
def main():
    global change_count
    import time
    from xpra.platform import init, clean
    try:
        init("OSX Clipboard Change Test")
        log.enable_debug()

        #init UI watcher with gobject (required by pasteboard monitoring code)
        from xpra.platform.ui_thread_watcher import get_UI_watcher
        gobject.threads_init()
        import gtk.gdk
        gtk.gdk.threads_init()
        get_UI_watcher(glib.timeout_add)

        log.info("testing pasteboard")
        if not init_pasteboard():
            log.warn("failed to initialize a pasteboard!")
            return
        assert update_clipboard_change_count is not None, "cannot access clipboard change count"
        cc = update_clipboard_change_count()
        log.info("current change count=%s", cc)
        clipboard = gtk.Clipboard(selection="CLIPBOARD")
        log.info("changing clipboard %s contents", clipboard)
        clipboard.set_text("HELLO WORLD %s" % time.time())
        cc = update_clipboard_change_count()
        log.info("new change count=%s", cc)
        log.info("any update to your clipboard should get logged (^C to exit)")
        while True:
            v = update_clipboard_change_count()
            if v != cc:
                log.info(
                    "success! the clipboard change has been detected, new change count=%s",
                    v)
            else:
                log.info(".")
            time.sleep(1)
        if v == cc:
            log.info("no clipboard change detected")
    finally:
        clean()
Пример #53
0
def main():
    global change_count
    import time
    from xpra.platform import init, clean
    try:
        init("OSX Clipboard Change Test")
        log.enable_debug()

        #init UI watcher with gobject (required by pasteboard monitoring code)
        from xpra.platform.ui_thread_watcher import get_UI_watcher
        gobject.threads_init()
        import gtk.gdk
        gtk.gdk.threads_init()
        get_UI_watcher(glib.timeout_add)

        log.info("testing pasteboard")
        if not init_pasteboard():
            log.warn("failed to initialize a pasteboard!")
            return
        assert update_clipboard_change_count is not None, "cannot access clipboard change count"
        cc = update_clipboard_change_count()
        log.info("current change count=%s", cc)
        clipboard = gtk.Clipboard(selection="CLIPBOARD")
        log.info("changing clipboard %s contents", clipboard)
        clipboard.set_text("HELLO WORLD %s" % time.time())
        cc = update_clipboard_change_count()
        log.info("new change count=%s", cc)
        log.info("any update to your clipboard should get logged (^C to exit)")
        while True:
            v = update_clipboard_change_count()
            if v!=cc:
                log.info("success! the clipboard change has been detected, new change count=%s", v)
            else:
                log.info(".")
            time.sleep(1)
        if v==cc:
            log.info("no clipboard change detected")
    finally:
        clean()
Пример #54
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()