def __init__(self, title="Xpra"): self.exit_code = 0 self.start_session = None gtk.Window.__init__(self) self.set_title(title) self.set_border_width(10) self.set_resizable(True) self.set_decorated(True) self.set_position(WIN_POS_CENTER) icon = get_pixbuf("xpra") if icon: self.set_icon(icon) add_close_accel(self, self.quit) add_window_accel(self, 'F1', self.show_about) self.connect("delete_event", self.quit) self.vbox = gtk.VBox(False, 10) self.add(self.vbox) #with most window managers, #the window's title bar already shows "Xpra" #title_label = gtk.Label(title) #title_label.modify_font(pango.FontDescription("sans 14")) #self.vbox.add(title_label) self.widgets = [] label_font = pango.FontDescription("sans 16") if has_client: icon = get_pixbuf("browse.png") self.browse_button = imagebutton( "Browse", icon, "Browse and connect to local sessions", clicked_callback=self.browse, icon_size=48, label_font=label_font) self.widgets.append(self.browse_button) icon = get_pixbuf("connect.png") self.connect_button = imagebutton( "Connect", icon, "Connect to a session", clicked_callback=self.show_launcher, icon_size=48, label_font=label_font) self.widgets.append(self.connect_button) if has_server: icon = get_pixbuf("server-connected.png") self.shadow_button = imagebutton( "Shadow", icon, "Start a shadow server", clicked_callback=self.start_shadow, icon_size=48, label_font=label_font) if not has_shadow: set_tooltip_text( self.shadow_button, "This build of Xpra does not support starting sessions") self.shadow_button.set_sensitive(False) self.widgets.append(self.shadow_button) icon = get_pixbuf("windows.png") self.start_button = imagebutton("Start", icon, "Start a session", clicked_callback=self.start, icon_size=48, label_font=label_font) #not all builds and platforms can start sessions: if OSX or WIN32: set_tooltip_text( self.start_button, "Starting sessions is not supported on %s" % platform_name(sys.platform)) self.start_button.set_sensitive(False) elif not has_server: set_tooltip_text( self.start_button, "This build of Xpra does not support starting sessions") self.start_button.set_sensitive(False) self.widgets.append(self.start_button) assert len(self.widgets) % 2 == 0 table = gtk.Table(len(self.widgets) // 2, 2, True) for i, widget in enumerate(self.widgets): table.attach(widget, i % 2, i % 2 + 1, i // 2, i // 2 + 1, xpadding=10, ypadding=10) self.vbox.add(table) self.vbox.show_all() self.set_size_request(640, 100 + 100 * len(self.widgets) // 2) def focus_in(window, event): log("focus_in(%s, %s)", window, event) def focus_out(window, event): log("focus_out(%s, %s)", window, event) self.reset_cursors() self.connect("focus-in-event", focus_in) self.connect("focus-out-event", focus_out)
def __init__(self, title="Xpra"): self.exit_code = 0 self.start_session = None Gtk.Window.__init__(self) hb = Gtk.HeaderBar() hb.set_show_close_button(True) hb.props.title = "Xpra" self.set_titlebar(hb) hb.add(self.button("About", "help-about", about)) try: from xpra.client.gtk_base.toolbox import ToolboxGUI except ImportError: pass else: def show(): w = None def hide(*_args): w.hide() ToolboxGUI.quit = hide w = ToolboxGUI() w.show() hb.add(self.button("Toolbox", "applications-utilities", show)) hb.show_all() self.set_title(title) self.set_border_width(10) self.set_resizable(True) self.set_decorated(True) self.set_position(Gtk.WindowPosition.CENTER) icon = get_icon_pixbuf("xpra.png") if icon: self.set_icon(icon) add_close_accel(self, self.quit) add_window_accel(self, 'F1', self.show_about) self.connect("delete_event", self.quit) self.set_wmclass("xpra-gui", "Xpra-GUI") self.vbox = Gtk.VBox(False, 10) self.add(self.vbox) #with most window managers, #the window's title bar already shows "Xpra" #title_label = Gtk.Label(title) #title_label.modify_font(pango.FontDescription("sans 14")) #self.vbox.add(title_label) self.widgets = [] label_font = Pango.FontDescription("sans 16") if has_client: icon = get_icon_pixbuf("browse.png") self.browse_button = imagebutton( "Browse", icon, "Browse and connect to local sessions", clicked_callback=self.browse, icon_size=48, label_font=label_font) self.widgets.append(self.browse_button) icon = get_icon_pixbuf("connect.png") self.connect_button = imagebutton( "Connect", icon, "Connect to a session", clicked_callback=self.show_launcher, icon_size=48, label_font=label_font) self.widgets.append(self.connect_button) if has_server: icon = get_icon_pixbuf("server-connected.png") self.shadow_button = imagebutton( "Shadow", icon, "Start a shadow server", clicked_callback=self.start_shadow, icon_size=48, label_font=label_font) if not has_shadow: self.shadow_button.set_tooltip_text( "This build of Xpra does not support starting sessions") self.shadow_button.set_sensitive(False) self.widgets.append(self.shadow_button) icon = get_icon_pixbuf("windows.png") self.start_button = imagebutton("Start", icon, "Start a session", clicked_callback=self.start, icon_size=48, label_font=label_font) #not all builds and platforms can start sessions: if OSX or WIN32: self.start_button.set_tooltip_text( "Starting sessions is not supported on %s" % platform_name(sys.platform)) self.start_button.set_sensitive(False) elif not has_server: self.start_button.set_tooltip_text( "This build of Xpra does not support starting sessions") self.start_button.set_sensitive(False) self.widgets.append(self.start_button) assert len(self.widgets) % 2 == 0 table = Gtk.Table(len(self.widgets) // 2, 2, True) for i, widget in enumerate(self.widgets): table.attach(widget, i % 2, i % 2 + 1, i // 2, i // 2 + 1, xpadding=10, ypadding=10) self.vbox.add(table) self.vbox.show_all() self.set_size_request(640, 100 + 100 * len(self.widgets) // 2) def focus_in(window, event): log("focus_in(%s, %s)", window, event) def focus_out(window, event): log("focus_out(%s, %s)", window, event) self.reset_cursors() self.connect("focus-in-event", focus_in) self.connect("focus-out-event", focus_out)