Commit a7eaa2f4 authored by John Stowers's avatar John Stowers

[tweak] support text-scaling-factor

parent e9210207
from gi.repository import Gtk
from gtweak.tweakmodel import TweakGroup
from gtweak.widgets import GSettingsFontButtonTweak, build_horizontal_sizegroup
from gtweak.widgets import GSettingsRangeTweak, GSettingsFontButtonTweak, build_horizontal_sizegroup
sg = build_horizontal_sizegroup()
TWEAK_GROUPS = (
TweakGroup(
"Fonts",
GSettingsRangeTweak("org.gnome.desktop.interface", "text-scaling-factor", adjustment_step=0.1, size_group=sg),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "font-name", size_group=sg),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "document-font-name", size_group=sg),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "monospace-font-name", size_group=sg)),
......
......@@ -61,3 +61,15 @@ class GSettingsFontButtonTweak(_GSettingsTweak):
self.widget = build_label_beside_widget(self.settings.schema_get_summary(key_name), w)
self.widget_for_size_group = w
class GSettingsRangeTweak(_GSettingsTweak):
def __init__(self, schema_name, key_name, **options):
_GSettingsTweak.__init__(self, schema_name, key_name, **options)
#returned variant is range:(min, max)
_min, _max = self.settings.get_range(key_name)[1]
w = Gtk.HScale.new_with_range(_min, _max, options.get('adjustment_step', 1))
self.settings.bind(key_name, w.get_adjustment(), "value", Gio.SettingsBindFlags.DEFAULT)
self.widget = build_label_beside_widget(self.settings.schema_get_summary(key_name), w)
self.widget_for_size_group = 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