Exemplo n.º 1
0
def main(argv=()):
    from xpra.os_util import POSIX, OSX
    from xpra.platform import program_context
    from xpra.platform.gui import init, set_default_icon
    with program_context("Xpra-Bug-Report", "Xpra Bug Report"):
        from xpra.log import enable_color
        enable_color()

        if POSIX and not OSX:
            from xpra.x11.gtk_x11.gdk_display_source import init_gdk_display_source
            init_gdk_display_source()

        set_default_icon("bugs.png")
        init()

        from xpra.log import enable_debug_for
        #logging init:
        if "-v" in argv:
            enable_debug_for("util")

        from xpra.client.gtk_base.bug_report import BugReport
        from xpra.gtk_common.gobject_compat import register_os_signals
        app = BugReport()
        app.close = app.quit
        app.init(True)
        register_os_signals(app.quit, "Bug Report")
        try:
            from xpra.platform.gui import ready as gui_ready
            gui_ready()
            app.show()
            app.run()
        except KeyboardInterrupt:
            pass
        return 0
Exemplo n.º 2
0
def main():
    from xpra.log import enable_color
    from xpra.platform.gui import init, set_default_icon
    with program_context("Clipboard-Test", "Clipboard Test Tool"):
        enable_color()

        set_default_icon("clipboard.png")
        init()

        w = ClipboardStateInfoWindow()
        GLib.idle_add(w.show_with_focus)
        Gtk.main()
Exemplo n.º 3
0
def main():
    from xpra.platform import program_context
    from xpra.log import enable_color
    from xpra.platform.gui import init, set_default_icon
    with program_context("Clipboard-Test", "Clipboard Test Tool"):
        enable_color()

        set_default_icon("clipboard.png")
        init()

        ClipboardStateInfoWindow()
        gtk.main()
Exemplo n.º 4
0
def main():
    from xpra.platform import program_context, command_error
    from xpra.platform.gui import init, set_default_icon
    with program_context("Webcam", "Webcam"):
        from xpra.log import Logger, add_debug_category
        log = Logger("webcam")
        for x in list(sys.argv):
            if x in ("-v", "--verbose"):
                sys.argv.remove(x)
                add_debug_category("webcam")
                log.enable_debug()

        set_default_icon("webcam.png")
        init()

        log("importing opencv")
        try:
            import cv2
        except ImportError as e:
            command_error("Error: no opencv support module: %s" % e)
            return 1
        log("cv2=%s", cv2)
        device = 0
        if len(sys.argv) == 2:
            try:
                device = int(sys.argv[1])
            except ValueError:
                command_error(
                    "Warning: failed to parse value as a device number: '%s'" %
                    sys.argv[1])
        log("opening %s with device=%s", cv2.VideoCapture,
            device)  # @UndefinedVariable
        try:
            cap = cv2.VideoCapture(device)  # @UndefinedVariable
        except Exception as e:
            command_error(
                "Error: failed to capture video using device %s:\n%s" %
                (device, e))
            return 1
        log.info("capture device for %i: %s", device, cap)
        while True:
            ret, frame = cap.read()
            if not ret:
                command_error("Error: frame capture failed using device %s" %
                              device)
                return 1
            cv2.imshow('frame', frame)  # @UndefinedVariable
            if cv2.waitKey(10) & 0xFF in (ord('q'), 27):  # @UndefinedVariable
                break
        cap.release()
        cv2.destroyAllWindows()  # @UndefinedVariable
    return 0
Exemplo n.º 5
0
def main():
    from xpra.platform.gui import init, set_default_icon
    set_default_icon("encoding.png")
    init()
    import signal

    def signal_handler(*_args):
        gtk.main_quit()

    signal.signal(signal.SIGINT, signal_handler)
    w = ColorGradientWindow()
    add_close_accel(w, gtk.main_quit)
    gtk.main()
Exemplo n.º 6
0
def main():
    from xpra.platform.gui import init, set_default_icon
    with program_context("colors", "Colors"):
        set_default_icon("encoding.png")
        init()

        from xpra.gtk_common.gobject_compat import register_os_signals
        def signal_handler(*_args):
            Gtk.main_quit()
        register_os_signals(signal_handler, "test window")
        w = AnimatedColorWindow()
        add_close_accel(w, Gtk.main_quit)
        GLib.idle_add(w.show_with_focus)
        Gtk.main()
        return 0
Exemplo n.º 7
0
def main():
    from xpra.platform.gui import init, set_default_icon
    with program_context("transparent-window", "Transparent Window"):
        set_default_icon("windows.png")
        init()

        from xpra.gtk_common.gobject_compat import register_os_signals
        def signal_handler(*_args):
            Gtk.main_quit()
        register_os_signals(signal_handler)
        w = TransparentWindow()
        add_close_accel(w, Gtk.main_quit)
        GLib.idle_add(w.show_with_focus)
        Gtk.main()
        return 0
Exemplo n.º 8
0
def main():
    from xpra.platform.gui import init, set_default_icon
    with program_context("colors-gradient", "Colors Gradient"):
        set_default_icon("encoding.png")
        init()

        import signal

        def signal_handler(*_args):
            Gtk.main_quit()

        signal.signal(signal.SIGINT, signal_handler)
        w = ColorGradientWindow()
        add_close_accel(w, Gtk.main_quit)
        GLib.idle_add(w.show_with_focus)
        Gtk.main()
Exemplo n.º 9
0
def main(options=None):  # pragma: no cover
    assert POSIX and not OSX
    from xpra.platform import program_context
    from xpra.log import enable_color
    from xpra.platform.gui import init, ready
    with program_context("xpra-start-gui", "Xpra Start GUI"):
        enable_color()
        init()
        gui = DesktopGreeter()
        register_os_signals(gui.app_signal)
        ready()
        gui.show()
        gui.present()
        Gtk.main()
        log("do_main() gui.exit_code=%s", gui.exit_code)
        return gui.exit_code
Exemplo n.º 10
0
def main():
    from xpra.log import enable_color
    from xpra.platform.gui import init, set_default_icon
    with program_context("Keyboard-Test", "Keyboard Test Tool"):
        enable_color()

        set_default_icon("keyboard.png")
        init()

        if POSIX and not OSX:
            from xpra.x11.gtk_x11.gdk_display_source import init_gdk_display_source
            init_gdk_display_source()
        w = KeyboardStateInfoWindow()
        GLib.idle_add(w.show_with_focus)
        Gtk.main()
    return 0
Exemplo n.º 11
0
def main():  # pragma: no cover
    from xpra.platform import program_context
    from xpra.log import enable_color
    from xpra.platform.gui import init, ready
    with program_context("xpra-start-gui", "Xpra Start GUI"):
        enable_color()
        init()
        gui = StartSession()
        register_os_signals(gui.app_signal)
        ready()
        gui.populate_menus()
        gui.show()
        gui.present()
        Gtk.main()
        log("do_main() gui.exit_code=%i", gui.exit_code)
        return 0
Exemplo n.º 12
0
def main():
    from xpra.platform import program_context
    from xpra.log import enable_color
    from xpra.platform.gui import init, ready, set_default_icon
    with program_context("Xpra-Toolbox", "Xpra Toolbox"):
        enable_color()

        set_default_icon("toolbox.png")
        init()

        gui = ToolboxGUI()
        register_os_signals(gui.app_signal, "Xpra Toolbox")
        ready()
        gui.show()
        Gtk.main()
        log("do_main() gui.exit_code=%i", gui.exit_code)
        return gui.exit_code
Exemplo n.º 13
0
def main():
    from xpra.log import enable_color
    from xpra.platform.gui import init, set_default_icon
    with program_context("Clipboard-Test", "Clipboard Test Tool"):
        enable_color()

        set_default_icon("clipboard.png")
        init()

        from xpra.gtk_common.gobject_compat import register_os_signals
        def signal_handler(*_args):
            Gtk.main_quit()
        register_os_signals(signal_handler, "test window")

        w = ClipboardStateInfoWindow()
        GLib.idle_add(w.show_with_focus)
        Gtk.main()
Exemplo n.º 14
0
def main():
    from xpra.platform.gui import init, set_default_icon
    with program_context("transparent-window", "Transparent Window"):
        set_default_icon("windows.png")
        init()

        import signal

        def signal_handler(*_args):
            Gtk.main_quit()

        signal.signal(signal.SIGINT, signal_handler)
        w = TransparentWindow()
        add_close_accel(w, Gtk.main_quit)
        GLib.idle_add(w.show_with_focus)
        Gtk.main()
        return 0
Exemplo n.º 15
0
def main(options=None): # pragma: no cover
    from xpra.platform import program_context
    from xpra.log import enable_color
    from xpra.platform.gui import init, ready
    with program_context("xpra-start-gui", "Xpra Start GUI"):
        enable_color()
        init()
        gui = StartSession(options)
        register_os_signals(gui.app_signal)
        ready()
        gui.session_toggled()
        if WIN32 or OSX:
            gui.remote_btn.set_active(True)
        gui.show()
        gui.present()
        Gtk.main()
        log("do_main() gui.exit_code=%s", gui.exit_code)
        return gui.exit_code
Exemplo n.º 16
0
def main():  # pragma: no cover
    from xpra.platform import program_context
    from xpra.log import enable_color
    from xpra.platform.gui import init, ready
    with program_context("xpra-gui", "Xpra GUI"):
        enable_color()
        init()
        gui = GUI()
        register_os_signals(gui.app_signal)
        ready()
        if OSX:
            from xpra.platform.darwin.gui import wait_for_open_handlers
            wait_for_open_handlers(gui.show, gui.open_file, gui.open_url)
        else:
            gui.show()
        Gtk.main()
        log("do_main() gui.exit_code=%i", gui.exit_code)
        return 0
Exemplo n.º 17
0
def main():
    from xpra.platform import program_context
    from xpra.log import enable_color
    from xpra.platform.gui import init, ready
    from xpra.gtk_common.quit import gtk_main_quit_on_fatal_exceptions_enable
    gtk_main_quit_on_fatal_exceptions_enable()
    with program_context("Xpra-GUI", "Xpra GUI"):
        enable_color()
        init()
        gui = GUI()
        register_os_signals(gui.app_signal)
        ready()
        if OSX:
            from xpra.platform.darwin.gui import wait_for_open_handlers
            wait_for_open_handlers(gui.show, gui.open_file, gui.open_url)
        else:
            gui.show()
        gtk_main()
        log("do_main() gui.exit_code=%i", gui.exit_code)
        return 0
Exemplo n.º 18
0
def do_main(opts):
    from xpra.platform import program_context, command_error
    from xpra.log import enable_color
    from xpra.platform.gui import init, set_default_icon
    with program_context("xpra-session-browser", "Xpra Session Browser"):
        enable_color()

        set_default_icon("mdns.png")
        init()

        if not get_listener_class():
            command_error("no mDNS support in this build")
            return 1
        mdns = opts.mdns
        if mdns:
            gui = mdns_sessions(opts)
        else:
            gui = SessionsGUI(opts)
        Gtk.main()
        return gui.exit_code
Exemplo n.º 19
0
def main():
    from xpra.log import enable_color
    from xpra.platform.gui import init, set_default_icon
    with program_context("Keyboard-Test", "Keyboard Test Tool"):
        enable_color()

        set_default_icon("keyboard.png")
        init()

        from xpra.gtk_common.gobject_compat import register_os_signals
        def signal_handler(*_args):
            Gtk.main_quit()
        register_os_signals(signal_handler, "test window")

        if POSIX and not OSX:
            from xpra.x11.gtk_x11.gdk_display_source import init_gdk_display_source
            init_gdk_display_source()
        w = KeyboardStateInfoWindow()
        GLib.idle_add(w.show_with_focus)
        Gtk.main()
    return 0