[gnome-tweaks/ewlsh/remove-compose: 2/2] Remove Compose tweak and dialog
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweaks/ewlsh/remove-compose: 2/2] Remove Compose tweak and dialog
- Date: Wed, 16 Feb 2022 06:06:43 +0000 (UTC)
commit a083d7136ebdf4cd8dc131aa1efb654e7cc15e1c
Author: Evan Welsh <contact evanwelsh com>
Date: Tue Feb 15 21:58:31 2022 -0800
Remove Compose tweak and dialog
This was added to Settings in GNOME/gnome-control-center!785
gtweak/tweaks/tweak_group_keymouse.py | 150 ----------------------------------
1 file changed, 150 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_keymouse.py b/gtweak/tweaks/tweak_group_keymouse.py
index 02da8bc..f0ebfff 100644
--- a/gtweak/tweaks/tweak_group_keymouse.py
+++ b/gtweak/tweaks/tweak_group_keymouse.py
@@ -34,155 +34,6 @@ class KeyThemeSwitcher(GSettingsSwitchTweakValue):
self.settings.set_string(self.key_name, "Default")
-class ComposeDialogLauncher(Gtk.Box, _GSettingsTweak):
-
- def __init__(self, **options):
- name = _("Compose Key")
- Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=18)
- _GSettingsTweak.__init__(self, name, "org.gnome.desktop.input-sources", "xkb-options", **options)
-
- key_values = ["compose:sclk", "compose:prsc", "compose:menu", "compose:ralt", "compose:rctrl",
"compose:rwin", "compose:caps", "compose:lctrl"]
- key_names = [_("Scroll Lock"), _("PrtScn"), _("Menu"), _("Right Alt"), _("Right Ctrl"), _("Right
Super"), _("Caps Lock"), _("Left Ctrl")]
-
- button = Gtk.Button(_("Disabled"), halign=Gtk.Align.END)
- button.set_relief(Gtk.ReliefStyle.NONE)
- button.connect("clicked", self.on_button_clicked, self.settings)
-
- desc = _("Allows entering additional characters.")
-
- vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
- vbox.props.spacing = UI_BOX_SPACING
-
- lbl = Gtk.Label(name)
- lbl.props.xalign = 0.0
- lbl_desc = Gtk.Label()
- lbl_desc.set_line_wrap(True)
- lbl_desc.get_style_context().add_class("dim-label")
- lbl_desc.set_markup("<span size='small'>"+GLib.markup_escape_text(desc)+"</span>")
-
- vbox.pack_start(lbl, False, False, 0)
- vbox.pack_start(lbl_desc, False, False, 0)
- self.pack_start(vbox, False, False, 0)
- self.pack_end(button, True, True, 0)
-
- for index, item in enumerate(key_values):
- if self.settings.setting_is_in_list("xkb-options", item):
- button.set_label(key_names[index])
- # We only support one Compose key so drop any one other set keys
- for extra in key_values:
- self.settings.setting_remove_from_list("xkb-options", extra)
- self.settings.setting_add_to_list("xkb-options", item)
-
- def on_button_clicked(self, widget, settings):
- a = ComposeDialog(self.main_window, widget, settings)
- resp = a.run()
- a.destroy()
-
-
-class ComposeDialog(Gtk.Dialog, Gtk.Button):
- key_values = ["compose:sclk", "compose:prsc", "compose:menu", "compose:ralt", "compose:rctrl",
"compose:rwin", "compose:caps", "compose:lctrl"]
- key_names = [_("Scroll Lock"), _("PrtScn"), _("Menu"), _("Right Alt"), _("Right Ctrl"), _("Right
Super"), _("Caps Lock"), _("Left Ctrl")]
-
- def __init__(self, parent, parent_button, settings):
- Gtk.Dialog.__init__(self)
-
- geometry = Gdk.Geometry()
- geometry.max_width = 500
- self.set_geometry_hints(None, geometry, Gdk.WindowHints.MAX_SIZE)
- self.set_modal(True)
- self.set_transient_for(parent)
- self.set_size_request(500,-1)
-
- btn_sclk = Gtk.RadioButton.new_with_label_from_widget(None, _("Scroll Lock"))
- btn_prsc = Gtk.RadioButton.new_with_label_from_widget(btn_sclk, _("PrtScn"))
- btn_menu = Gtk.RadioButton.new_with_label_from_widget(btn_sclk, _("Menu"))
- btn_ralt = Gtk.RadioButton.new_with_label_from_widget(btn_sclk, _("Right Alt"))
- btn_rctrl = Gtk.RadioButton.new_with_label_from_widget(btn_sclk, _("Right Ctrl"))
- btn_rwin = Gtk.RadioButton.new_with_label_from_widget(btn_sclk, _("Right Super"))
- btn_caps = Gtk.RadioButton.new_with_label_from_widget(btn_sclk, _("Caps Lock"))
- btn_lctrl = Gtk.RadioButton.new_with_label_from_widget(btn_sclk, _("Left Ctrl"))
- compose_buttons= [btn_sclk, btn_prsc, btn_menu, btn_ralt, btn_rctrl, btn_rwin, btn_caps, btn_lctrl]
-
- hb = Gtk.HeaderBar()
- hb.set_show_close_button(True)
- hb.props.title = _("Compose Key")
- self.set_titlebar(hb)
-
- switch = Gtk.Switch()
- compose_enabled = False
- for item in self.key_values:
- if settings.setting_is_in_list("xkb-options", item):
- compose_enabled = True
- switch.set_active(compose_enabled)
- for button in compose_buttons:
- button.set_sensitive(compose_enabled)
- switch.connect("notify::active", self._on_switch_changed, parent_button, compose_buttons, settings)
-
- hb.pack_start(switch)
-
- grid = Gtk.Grid()
- grid.props.border_width = 18
- label = Gtk.Label(None)
- label.set_markup(_("The compose key allows a wide variety of characters to be entered. To use it,
press the compose key and then a sequence of characters.\n\n"
- "Many unusual characters can be entered by combining standard ones. For example, compose key
followed by <b>C</b> and <b>o</b> will enter <b>©</b>, <b>a</b> followed by <b>'</b> will enter <b>á</b>.\n"))
- label.set_line_wrap(True)
- self.get_content_area().pack_start(grid, True, True, 0)
-
- grid.attach(label, 0, 0, 4, 1)
- grid.attach(btn_sclk, 1, 1, 1, 1)
- grid.attach(btn_prsc, 1, 2, 1, 1)
- grid.attach(btn_menu, 1, 3, 1, 1)
- grid.attach(btn_ralt, 2, 1, 1, 1)
- grid.attach(btn_rctrl, 2, 2, 1, 1)
- grid.attach(btn_rwin, 2, 3, 1, 1)
- grid.attach(btn_caps, 3, 1, 1, 1)
- grid.attach(btn_lctrl, 3, 2, 1, 1)
-
- if settings.setting_is_in_list("xkb-options", "compose:sclk"):
- btn_sclk.set_active(True)
- elif settings.setting_is_in_list("xkb-options", "compose:prsc"):
- btn_prsc.set_active(True)
- elif settings.setting_is_in_list("xkb-options", "compose:menu"):
- btn_menu.set_active(True)
- elif settings.setting_is_in_list("xkb-options", "compose:ralt"):
- btn_ralt.set_active(True)
- elif settings.setting_is_in_list("xkb-options", "compose:rctrl"):
- btn_rctrl.set_active(True)
- elif settings.setting_is_in_list("xkb-options", "compose:rwin"):
- btn_rwin.set_active(True)
- elif settings.setting_is_in_list("xkb-options", "compose:caps"):
- btn_caps.set_active(True)
- elif settings.setting_is_in_list("xkb-options", "compose:lctrl"):
- btn_lctrl.set_active(True)
-
- for index, button in enumerate(compose_buttons):
- button.set_sensitive(compose_enabled)
- button.connect("toggled", self.on_button_toggled, index, parent_button, settings)
-
- self.show_all()
-
- def on_button_toggled(self, button, index, parent_button, settings):
- for item in self.key_values:
- settings.setting_remove_from_list("xkb-options", item)
- settings.setting_add_to_list("xkb-options", self.key_values[index])
- parent_button.set_label(self.key_names[index])
-
- def _on_switch_changed(self, switch, param, parent_button, compose_buttons, settings):
- compose_enabled = switch.get_active()
- for button in compose_buttons:
- button.set_sensitive(compose_enabled)
- # Until we implement storing the old Compose key setting somewhere,
- # just force the key to Scroll Lock since it's first in the list.
- if compose_enabled:
- settings.setting_add_to_list("xkb-options", "compose:sclk")
- parent_button.set_label(_("Scroll Lock"))
- else:
- compose_buttons[0].set_active(True)
- for item in self.key_values:
- settings.setting_remove_from_list("xkb-options", item)
- parent_button.set_label(_("Disabled"))
-
-
class OverviewShortcutTweak(Gtk.Box, _GSettingsTweak):
def __init__(self, **options):
@@ -367,7 +218,6 @@ TWEAK_GROUPS = [
desc=_("Increases the choice of input sources in the Settings application."),
logout_required=True,),
KeyThemeSwitcher(),
- ComposeDialogLauncher(),
OverviewShortcutTweak(),
AdditionalLayoutButton(),
Title(_("Mouse"), ""),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]