def __shortcut_button_clicked_cb(self, button, name, section, _name, entry): buttons = (_("_Cancel"), Gtk.ResponseType.CANCEL, _("_OK"), Gtk.ResponseType.OK) title1 = _("Select keyboard shortcut for %s") # Translators: Title of the window title2 = _("switching input methods") title = title1 % title2 dialog = keyboardshortcut.KeyboardShortcutSelectionDialog( title=title, transient_for=self.__window) dialog.add_buttons(*buttons) text = entry.get_text() if text: shortcuts = text.split("; ") else: shortcuts = None dialog.set_shortcuts(shortcuts) id = dialog.run() shortcuts = dialog.get_shortcuts() dialog.destroy() if id != Gtk.ResponseType.OK: return if section == 'panel/emoji': self.__settings_emoji.set_strv(name, shortcuts) else: self.__settings_hotkey.set_strv(name, shortcuts) text = "; ".join(shortcuts) entry.set_text(text) tooltip = "\n".join(shortcuts) tooltip += "\n" + \ _("Use shortcut with shift to switch to the previous input method") entry.set_tooltip_text(tooltip)
def __shortcut_button_clicked_cb(self, button, name, section, _name, entry): buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK) title = _("Select keyboard shortcut for %s") % \ _("switching input methods") dialog = keyboardshortcut.KeyboardShortcutSelectionDialog( buttons=buttons, title=title) text = entry.get_text() if text: shortcuts = text.split("; ") else: shortcuts = None dialog.set_shortcuts(shortcuts) id = dialog.run() shortcuts = dialog.get_shortcuts() dialog.destroy() if id != Gtk.ResponseType.OK: return self.__settings_hotkey.set_strv(name, shortcuts) text = "; ".join(shortcuts) entry.set_text(text) tooltip = "\n".join(shortcuts) tooltip += "\n" + \ _("Use shortcut with shift to switch to the previous input method") entry.set_tooltip_text(tooltip)
def __shortcut_button_clicked_cb(self, button, name, section, _name, entry): buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK) title = _("Select keyboard shortcut for %s") % _(name) dialog = keyboardshortcut.KeyboardShortcutSelectionDialog(buttons = buttons, title = title) text = entry.get_text() if text: shortcuts = text.split("; ") else: shortcuts = None dialog.set_shortcuts(shortcuts) id = dialog.run() shortcuts = dialog.get_shortcuts() dialog.destroy() if id != gtk.RESPONSE_OK: return self.__config.set_list(section, _name, shortcuts, "s") text = "; ".join(shortcuts) entry.set_text(text) entry.set_tooltip_text(text)
def __shortcut_button_clicked_cb(self, button, name, section, _name, entry): buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK) title = _("Select keyboard shortcut for %s") % _(name) dialog = keyboardshortcut.KeyboardShortcutSelectionDialog(buttons = buttons, title = title) text = entry.get_text() if text: shortcuts = text.split("; ") else: shortcuts = None dialog.set_shortcuts(shortcuts) id = dialog.run() shortcuts = dialog.get_shortcuts() dialog.destroy() if id != Gtk.ResponseType.OK: return self.__config.set_value(section, _name, GLib.Variant.new_strv(shortcuts)) text = "; ".join(shortcuts) entry.set_text(text) entry.set_tooltip_text(text)