def win32_bonjour_download_warning(gui): from xpra.gtk_common.gobject_compat import import_pango from xpra.gtk_common.gtk_util import DIALOG_MODAL, DESTROY_WITH_PARENT gtk = import_gtk() dialog = gtk.Dialog("Bonjour not found", gui, DIALOG_MODAL | DESTROY_WITH_PARENT) RESPONSE_CANCEL = 1 RESPONSE_DOWNLOAD = 2 dialog.add_button(gtk.STOCK_CANCEL, RESPONSE_CANCEL) dialog.add_button("Download Bonjour", RESPONSE_DOWNLOAD) def add(widget, padding=0): a = gtk.Alignment() a.set(0.5, 0.5, 1, 1) a.add(widget) a.set_padding(padding, padding, padding, padding) dialog.vbox.pack_start(a) pango = import_pango() title = gtk.Label("Bonjour support not found") title.modify_font(pango.FontDescription("sans 14")) add(title, 16) info = gtk.Label("To automatically discover xpra sessions via mDNS,\n" + "you can install 'Bonjour'.\n\n") add(info, 10) dialog.vbox.show_all() def handle_response(dialog, response): dialog.destroy() if response == RESPONSE_DOWNLOAD: import webbrowser webbrowser.open("https://support.apple.com/kb/DL999") dialog.connect("response", handle_response) dialog.show()
#!/usr/bin/env python # This file is part of Xpra. # Copyright (C) 2011-2014 Antoine Martin <*****@*****.**> from xpra.gtk_common.gobject_compat import import_gtk, import_gdk, is_gtk3, import_pango, import_gobject from xpra.gtk_common.gtk_util import SHIFT_MASK, LOCK_MASK, CONTROL_MASK, MOD1_MASK, MOD2_MASK, MOD3_MASK, MOD4_MASK, MOD5_MASK import sys gtk = import_gtk() gdk = import_gdk() pango = import_pango() gobject = import_gobject() from xpra.deque import maxdeque from xpra.platform.paths import get_icon from xpra.gtk_common import gtk_util assert gtk_util, "cannot load compat class" modifier_names = { SHIFT_MASK : "Shift", LOCK_MASK : "Lock", CONTROL_MASK : "Control", MOD1_MASK : "mod1", MOD2_MASK : "mod2", MOD3_MASK : "mod3", MOD4_MASK : "mod4", MOD5_MASK : "mod5" } short_modifier_names = { SHIFT_MASK : "S",
window_defaults, color_parse, is_gtk3, WIN_POS_CENTER, WINDOW_POPUP, STATE_NORMAL, ) from xpra.platform.gui import force_focus from xpra.platform.paths import get_icon_dir from xpra.os_util import get_util_logger log = get_util_logger() gtk = import_gtk() glib = import_glib() pango = import_pango() class ConfirmDialogWindow(object): def __init__(self, title="Title", prompt="", info=(), icon="", buttons=()): if is_gtk3(): self.window = gtk.Window(type=WINDOW_POPUP) else: self.window = gtk.Window(WINDOW_POPUP) window_defaults(self.window) self.window.set_position(WIN_POS_CENTER) self.window.connect("delete-event", self.quit) self.window.set_default_size(400, 150) self.window.set_title(title) #self.window.set_modal(True)