def setUpClass(cls): from xpra.scripts.server import find_log_dir os.environ["XPRA_LOG_DIR"] = find_log_dir() cls.default_config = get_defaults() cls.display_start = 100 cls.dotxpra = DotXpra("/tmp", ["/tmp"]) cls.default_xpra_args = ["--systemd-run=no", "--pulseaudio=no", "--socket-dirs=/tmp", "--speaker=no", "--microphone=no"] ServerTestUtil.existing_displays = cls.displays() ServerTestUtil.processes = [] xpra_list = cls.run_xpra(["list"]) assert pollwait(xpra_list, 15) is not None, "xpra list returned %s" % xpra_list.poll()
def setUpClass(cls): from xpra.server.server_util import find_log_dir cls.xauthority_temp = None #tempfile.NamedTemporaryFile(prefix="xpra-test.", suffix=".xauth", delete=False) #cls.xauthority_temp.close() #os.environ["XAUTHORITY"] = os.path.expanduser(cls.xauthority_temp.name) os.environ["XPRA_LOG_DIR"] = find_log_dir() os.environ["XPRA_NOTTY"] = "1" os.environ["XPRA_WAIT_FOR_INPUT"] = "0" os.environ["XPRA_FLATTEN_INFO"] = "0" os.environ["XPRA_NOTTY"] = "1" cls.default_env = os.environ.copy() cls.default_config = get_defaults() cls.display_start = 100
def setUpClass(cls): cls.display_start = 100 cls.temp_files = [] cls.processes = [] cls.xauthority_temp = None #tempfile.NamedTemporaryFile(prefix="xpra-test.", suffix=".xauth", delete=False) #cls.xauthority_temp.close() #os.environ["XAUTHORITY"] = os.path.expanduser(cls.xauthority_temp.name) cls.default_env = os.environ.copy() cls.default_env.update({ "XPRA_LOG_DIR": tempfile.gettempdir(), "XPRA_NOTTY": "1", "XPRA_WAIT_FOR_INPUT": "0", "XPRA_FLATTEN_INFO": "0", }) cls.default_config = get_defaults() log("setUpClass(%s) default_env=%s", cls, cls.default_env)
def setUpClass(cls): from xpra.server.server_util import find_log_dir cls.xauthority_temp = tempfile.NamedTemporaryFile(prefix="xpra-test.", suffix=".xauth", delete=False) cls.xauthority_temp.close() os.environ["XAUTHORITY"] = os.path.expanduser(cls.xauthority_temp.name) os.environ["XPRA_LOG_DIR"] = find_log_dir() os.environ["XPRA_NOTTY"] = "1" os.environ["XPRA_WAIT_FOR_INPUT"] = "0" os.environ["XPRA_FLATTEN_INFO"] = "0" os.environ["XPRA_NOTTY"] = "1" cls.default_env = os.environ.copy() cls.default_config = get_defaults() cls.display_start = 100+sys.version_info[0] cls.dotxpra = DotXpra("/tmp", ["/tmp"]) cls.default_xpra_args = ["--speaker=no", "--microphone=no"] if not WIN32: cls.default_xpra_args += ["--systemd-run=no", "--pulseaudio=no", "--socket-dirs=/tmp"] cls.existing_displays = cls.displays() cls.processes = []
def __init__(self, options): self.set_options(options) self.exit_code = None self.options_window = None self.default_config = get_defaults() #log("default_config=%s", self.default_config) #log("options=%s (%s)", options, type(options)) super().__init__() self.set_border_width(20) self.set_title("Start Xpra Session") self.set_position(Gtk.WindowPosition.CENTER) self.set_size_request(640, 300) icon = get_icon_pixbuf("xpra.png") if icon: self.set_icon(icon) self.connect("delete-event", self.quit) add_close_accel(self, self.quit) vbox = Gtk.VBox(False, 0) vbox.set_spacing(10) # choose the session type: hbox = Gtk.HBox(True, 40) def rb(sibling=None, label="", cb=None, tooltip_text=None): btn = Gtk.RadioButton.new_with_label_from_widget(sibling, label) if cb: btn.connect("toggled", cb) if tooltip_text: btn.set_tooltip_text(tooltip_text) sf(btn, "sans 16") hbox.add(btn) return btn self.seamless_btn = rb(None, "Seamless Session", self.session_toggled, "Forward an application window(s) individually, seamlessly") self.desktop_btn = rb(self.seamless_btn, "Desktop Session", self.session_toggled, "Forward a full desktop environment, contained in a window") self.shadow_btn = rb(self.seamless_btn, "Shadow Session", self.session_toggled, "Forward an existing desktop session, shown in a window") vbox.pack_start(hbox, False) vbox.pack_start(Gtk.HSeparator(), True, False) options_box = Gtk.VBox(False, 10) vbox.pack_start(options_box, True, False, 20) # select host: host_box = Gtk.HBox(True, 20) options_box.pack_start(host_box, False) self.host_label = l("Host:") hbox = Gtk.HBox(True, 0) host_box.pack_start(self.host_label, True) host_box.pack_start(hbox, True, True) self.localhost_btn = rb(None, "Local System", self.host_toggled) self.remote_btn = rb(self.localhost_btn, "Remote") self.remote_btn.set_tooltip_text("Start sessions on a remote system") self.address_box = Gtk.HBox(False, 0) options_box.pack_start(xal(self.address_box), True, True) self.mode_combo = sf(Gtk.ComboBoxText()) self.address_box.pack_start(xal(self.mode_combo), False) for mode in ("SSH", "TCP", "SSL", "WS", "WSS"): self.mode_combo.append_text(mode) self.mode_combo.set_active(0) self.mode_combo.connect("changed", self.mode_changed) self.username_entry = sf(Gtk.Entry()) self.username_entry.set_width_chars(12) self.username_entry.set_placeholder_text("Username") self.username_entry.set_max_length(255) self.address_box.pack_start(xal(self.username_entry), False) self.address_box.pack_start(l("@"), False) self.host_entry = sf(Gtk.Entry()) self.host_entry.set_width_chars(24) self.host_entry.set_placeholder_text("Hostname or IP address") self.host_entry.set_max_length(255) self.address_box.pack_start(xal(self.host_entry), False) self.address_box.pack_start(Gtk.Label(":"), False) self.port_entry = sf(Gtk.Entry()) self.port_entry.set_text("22") self.port_entry.set_width_chars(5) self.port_entry.set_placeholder_text("Port") self.port_entry.set_max_length(5) self.address_box.pack_start(xal(self.port_entry, 0), False) self.display_box = Gtk.HBox(True, 20) options_box.pack_start(self.display_box, False, True, 20) self.display_label = l("Display:") self.display_entry = sf(Gtk.Entry()) self.display_entry.connect('changed', self.display_changed) self.display_entry.set_width_chars(10) self.display_entry.set_placeholder_text("optional") self.display_entry.set_max_length(10) self.display_entry.set_tooltip_text("To use a specific X11 display number") self.display_combo = sf(Gtk.ComboBoxText()) self.display_box.pack_start(self.display_label, True) self.display_box.pack_start(self.display_entry, True, False) self.display_box.pack_start(self.display_combo, True, False) # Label: self.entry_box = Gtk.HBox(True, 20) options_box.pack_start(self.entry_box, False, True, 20) self.entry_label = l("Command:") self.entry = sf(Gtk.Entry()) self.entry.set_max_length(255) self.entry.set_width_chars(32) #self.entry.connect('activate', self.run_command) self.entry.connect('changed', self.entry_changed) self.entry_box.pack_start(self.entry_label, True) self.entry_box.pack_start(self.entry, True, False) # or use menus if we have xdg data: self.category_box = Gtk.HBox(True, 20) options_box.pack_start(self.category_box, False) self.category_label = l("Category:") self.category_combo = sf(Gtk.ComboBoxText()) self.category_box.pack_start(self.category_label, True) self.category_box.pack_start(self.category_combo, True, True) self.category_combo.connect("changed", self.category_changed) self.categories = {} self.command_box = Gtk.HBox(True, 20) options_box.pack_start(self.command_box, False) self.command_label = l("Command:") self.command_combo = sf(Gtk.ComboBoxText()) self.command_box.pack_start(self.command_label, True) self.command_box.pack_start(self.command_combo, True, True) self.command_combo.connect("changed", self.command_changed) self.commands = {} self.xsessions = None self.desktop_entry = None # start options: hbox = Gtk.HBox(False, 20) options_box.pack_start(hbox, False) self.exit_with_children_cb = sf(Gtk.CheckButton()) self.exit_with_children_cb.set_label("exit with application") hbox.add(xal(self.exit_with_children_cb, 0.5)) self.exit_with_children_cb.set_active(True) self.exit_with_client_cb = sf(Gtk.CheckButton()) self.exit_with_client_cb.set_label("exit with client") hbox.add(xal(self.exit_with_client_cb, 0.5)) self.exit_with_client_cb.set_active(False) # session options: hbox = Gtk.HBox(False, 12) hbox.pack_start(l("Options:"), True, False) for label_text, icon_name, tooltip_text, cb in ( ("Features", "features.png", "Session features", self.configure_features), ("Network", "connect.png", "Network options", self.configure_network), ("Display", "display.png", "Display settings", self.configure_display), ("Encodings", "encoding.png", "Picture compression", self.configure_encoding), ("Keyboard", "keyboard.png", "Keyboard layout and options", self.configure_keyboard), ("Audio", "speaker.png", "Audio forwarding options", self.configure_audio), ("Webcam", "webcam.png", "Webcam forwarding options", self.configure_webcam), ("Printing", "printer.png", "Printer forwarding options", self.configure_printing), ): icon = get_icon_pixbuf(icon_name) ib = imagebutton("", icon=icon, tooltip=label_text or tooltip_text, clicked_callback=cb, icon_size=32, label_font=Pango.FontDescription("sans 14")) hbox.pack_start(ib, True, False) options_box.pack_start(hbox, True, False) # Action buttons: hbox = Gtk.HBox(False, 20) vbox.pack_start(hbox, False, True, 20) def btn(label, tooltip, callback, default=False): ib = imagebutton(label, tooltip=tooltip, clicked_callback=callback, icon_size=32, default=default, label_font=Pango.FontDescription("sans 16")) hbox.pack_start(ib) return ib self.cancel_btn = btn("Cancel", "", self.quit) self.run_btn = btn("Start", "Start the xpra session", self.run_command) self.runattach_btn = btn("Start & Attach", "Start the xpra session and attach to it", self.runattach_command, True) self.runattach_btn.set_sensitive(False) vbox.show_all() self.display_combo.hide() self.add(vbox) #load encodings in the background: self.load_codecs_thread = start_thread(self.load_codecs, "load-codecs", daemon=True) #poll the list of X11 displays in the background: self.display_list = () if not OSX: self.load_displays_thread = start_thread(self.load_displays, "load-displays", daemon=True)