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
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
def do_main(argv): from xpra.os_util import SIGNAMES from xpra.scripts.main import InitExit, InitInfo from xpra.platform.gui import init as gui_init, ready as gui_ready if POSIX and not OSX: from xpra.x11.gtk_x11.gdk_display_source import init_gdk_display_source init_gdk_display_source() gui_init() try: from xpra.scripts.parsing import parse_cmdline, fixup_debug_option options, args = parse_cmdline(argv) debug = fixup_debug_option(options.debug) if debug: for x in debug.split(","): enable_debug_for(x) except InitInfo as e: print(str(e)) return 0 except InitExit as e: return e.status except Exception: exception_dialog("Error parsing command line") return 1 #allow config to be debugged: from xpra.scripts import config config.debug = log.debug try: app = ApplicationWindow() def handle_signal(signum): app.show() client = app.client if client: client.cleanup() else: Gtk.main_quit() GLib.timeout_add(1000, app.set_info_text, "got signal %s" % SIGNAMES.get(signum, signum)) GLib.timeout_add(1000, app.set_info_color, True) register_os_signals(handle_signal, "Client Launcher") has_file = len(args) == 1 if has_file: app.update_options_from_file(args[0]) #the compressors and packet encoders cannot be changed from the UI #so apply them now: configure_network(app.config) debug = fixup_debug_option(app.config.debug) if debug: for x in debug.split(","): enable_debug_for(x) app.create_window_with_config() except Exception: exception_dialog("Error creating launcher form") return 1 try: if app.config.autoconnect: #file says we should connect, #do that only (not showing UI unless something goes wrong): GLib.idle_add(app.do_connect) if not has_file: app.reset_errors() if not app.config.autoconnect or app.config.debug: if OSX: from xpra.platform.darwin.gui import wait_for_open_handlers, force_focus if has_file: force_focus() app.show() else: def open_file(filename): log("open_file(%s)", filename) app.update_options_from_file(filename) #the compressors and packet encoders cannot be changed from the UI #so apply them now: configure_network(app.config) app.update_gui_from_config() if app.config.autoconnect: app.__osx_open_signal = True GLib.idle_add(app.do_connect) else: force_focus() app.show() def open_URL(url): log("open_URL(%s)", url) app.__osx_open_signal = True app.update_options_from_URL(url) #the compressors and packet encoders cannot be changed from the UI #so apply them now: configure_network(app.config) app.update_gui_from_config() GLib.idle_add(app.do_connect) wait_for_open_handlers(app.show, open_file, open_URL) else: app.show() gui_ready() app.run() except KeyboardInterrupt: pass return 0
def do_main(argv): from xpra.os_util import SIGNAMES from xpra.scripts.main import InitExit, InitInfo from xpra.gtk_common.quit import gtk_main_quit_on_fatal_exceptions_enable gtk_main_quit_on_fatal_exceptions_enable() from xpra.platform.gui import ready as gui_ready gui_init() try: from xpra.scripts.parsing import parse_cmdline, fixup_debug_option options, args = parse_cmdline(argv) debug = fixup_debug_option(options.debug) if debug: for x in debug.split(","): enable_debug_for(x) except InitInfo as e: print(str(e)) return 0 except InitExit as e: return e.status except Exception: exception_dialog("Error parsing command line") return 1 #allow config to be debugged: from xpra.scripts import config config.debug = log.debug try: app = ApplicationWindow() def app_signal(signum, _frame): print("") log("got signal %s" % SIGNAMES.get(signum, signum)) def show_signal(): app.show() app.client.cleanup() glib.timeout_add( 1000, app.set_info_text, "got signal %s" % SIGNAMES.get(signum, signum)) glib.timeout_add(1000, app.set_info_color, True) #call from UI thread: glib.idle_add(show_signal) if sys.version_info[0] < 3: #breaks GTK3.. signal.signal(signal.SIGINT, app_signal) signal.signal(signal.SIGTERM, app_signal) has_file = len(args) == 1 if has_file: app.update_options_from_file(args[0]) #the compressors and packet encoders cannot be changed from the UI #so apply them now: configure_network(app.config) debug = fixup_debug_option(app.config.debug) if debug: for x in debug.split(","): enable_debug_for(x) app.create_window_with_config() except Exception: exception_dialog("Error creating launcher form") return 1 try: if app.config.autoconnect: #file says we should connect, #do that only (not showing UI unless something goes wrong): glib.idle_add(app.do_connect) if not has_file: app.reset_errors() if not app.config.autoconnect or app.config.debug: if OSX and not has_file: from xpra.platform.darwin.gui import wait_for_open_handlers, show_with_focus_workaround def open_file(filename): log("open_file(%s)", filename) app.update_options_from_file(filename) #the compressors and packet encoders cannot be changed from the UI #so apply them now: configure_network(app.config) app.update_gui_from_config() if app.config.autoconnect: app.__osx_open_signal = True glib.idle_add(app.do_connect) else: show_with_focus_workaround(app.show) def open_URL(url): log("open_URL(%s)", url) app.__osx_open_signal = True app.update_options_from_URL(url) #the compressors and packet encoders cannot be changed from the UI #so apply them now: configure_network(app.config) app.update_gui_from_config() glib.idle_add(app.do_connect) wait_for_open_handlers(app.show, open_file, open_URL) else: app.show() gui_ready() app.run() except KeyboardInterrupt: pass return 0