Commit 34ec61b7 authored by John Stowers's avatar John Stowers

Add font tweaks

parent 9594c231
from gi.repository import Gtk
from gtweak.tweakmodel import TweakGroup
from gtweak.widgets import GSettingsFontButtonTweak
TWEAK_GROUPS = (
TweakGroup(
"Fonts",
GSettingsFontButtonTweak("org.gnome.desktop.interface", "font-name"),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "document-font-name"),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "monospace-font-name")),
)
......@@ -30,21 +30,25 @@ def build_combo_box_text(selected, *values):
return combo
class GSettingsSwitch(Gtk.HBox):
def __init__(self, settings, key):
Gtk.HBox.__init__(self)
self._settings = settings
class _GSettingsTweak(Tweak):
def __init__(self, schema_name, key_name):
self.settings = GSettingsSetting(schema_name)
Tweak.__init__(self, self.settings.schema_get_summary(key_name), self.settings.schema_get_description(key_name))
self._sw = Gtk.Switch()
self._settings.bind(key, self._sw, "active", Gio.SettingsBindFlags.DEFAULT)
class GSettingsSwitchTweak(_GSettingsTweak):
def __init__(self, schema_name, key_name):
_GSettingsTweak.__init__(self, schema_name, key_name)
build_label_beside_widget(self._settings.schema_get_summary(key), self._sw, self)
self.show_all()
w = Gtk.Switch()
self.settings.bind(key_name, w, "active", Gio.SettingsBindFlags.DEFAULT)
self.widget = build_label_beside_widget(self.settings.schema_get_summary(key_name), w)
class GSettingsSwitchTweak(Tweak):
class GSettingsFontButtonTweak(_GSettingsTweak):
def __init__(self, schema_name, key_name):
settings = GSettingsSetting(schema_name)
Tweak.__init__(self, settings.schema_get_summary(key_name), settings.schema_get_description(key_name))
self.widget = GSettingsSwitch(settings, key_name)
_GSettingsTweak.__init__(self, schema_name, key_name)
w = Gtk.FontButton()
self.settings.bind(key_name, w, "font-name", Gio.SettingsBindFlags.DEFAULT)
self.widget = build_label_beside_widget(self.settings.schema_get_summary(key_name), w)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment