Tepl.Settings

g GObject.Object GObject.Object Tepl.Settings Tepl.Settings GObject.Object->Tepl.Settings

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

get_range_uint (settings, key)

class

get_singleton ()

get_selected_font ()

get_style_scheme_id ()

handle_theme_variant (theme_variant_settings, theme_variant_setting_key)

peek_desktop_interface_settings ()

provide_font_settings (font_settings, use_default_font_key, editor_font_key)

provide_style_scheme_settings (style_scheme_settings, key_for_light_theme_variant, key_for_dark_theme_variant)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

style-scheme-id

str

r

Signals

Inherited:

GObject.Object (1)

Name

Short Description

font-changed

The ::font-changed signal is emitted when the return value of Tepl.Settings.get_selected_font() has potentially changed.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Tepl.Settings(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Tepl.SettingsClass

classmethod get_range_uint(settings, key)
Parameters:
Returns:

whether the operation was successful.

min:

the minimum value allowed by the range.

max:

the maximum value allowed by the range.

Return type:

(bool, min: int, max: int)

This function introspects a Gio.Settings key to get its range, if the key as a “u” type (unsigned integer). False is returned if the introspection failed.

See Gio.SettingsSchemaKey.get_range() for more flexibility.

New in version 6.2.

classmethod get_singleton()
Returns:

the Tepl.Settings singleton instance.

Return type:

Tepl.Settings

New in version 6.2.

get_selected_font()
Returns:

the selected font name.

Return type:

str

If Tepl.Settings.provide_font_settings() has *not* been called, this function always returns the current value of the system’s fixed width (monospace) font.

If Tepl.Settings.provide_font_settings() *has* been called, this function returns the font name depending on the boolean value of use_default_font_key.

See also the Tepl.Settings ::font-changed signal, Tepl.utils_override_font_string() and Tepl.prefs_create_font_component().

New in version 6.2.

get_style_scheme_id()
Returns:

the value of the Tepl.Settings :style-scheme-id property.

Return type:

str or None

New in version 6.11.

handle_theme_variant(theme_variant_settings, theme_variant_setting_key)
Parameters:

This function permits to setup correctly the GTK theme variant to use.

If theme_variant_settings and theme_variant_setting_key are None, only the system’s settings will be taken into account.

If theme_variant_settings and theme_variant_setting_key are provided, they are taken into account according to Tepl.SettingsThemeVariant.

You should call this function only once, as subsequent calls are ignored (the setting used cannot be reconfigured).

New in version 6.10.

peek_desktop_interface_settings()
Returns:

the Gio.Settings for "org.gnome.desktop.interface".

Return type:

Gio.Settings

New in version 6.2.

provide_font_settings(font_settings, use_default_font_key, editor_font_key)
Parameters:
  • font_settings (Gio.Settings) – the Gio.Settings object containing the keys.

  • use_default_font_key (str) – a key of type boolean.

  • editor_font_key (str) – a key of type string.

This function can only be called once, to provide two keys:

  • use_default_font_key: must be of type boolean, to know whether to use the system’s font (the default font), or the editor font.

  • editor_font_key: must be of type string, containing the font name to have a different font for the text editor, rather than using the system’s font.

See Tepl.Settings.get_selected_font().

New in version 6.2.

provide_style_scheme_settings(style_scheme_settings, key_for_light_theme_variant, key_for_dark_theme_variant)
Parameters:
  • style_scheme_settings (Gio.Settings) – the Gio.Settings object containing the keys.

  • key_for_light_theme_variant (str) – a key of type string.

  • key_for_dark_theme_variant (str) – a key of type string.

This function can only be called once, to provide two keys:

  • key_for_light_theme_variant: must be of type string, containing the ID of a GtkSource.StyleScheme that should be used when the GTK theme variant is light.

  • key_for_dark_theme_variant: the same, but when the GTK theme variant is dark.

See Tepl.Settings.get_style_scheme_id().

New in version 6.11.

Signal Details

Tepl.Settings.signals.font_changed(settings)
Signal Name:

font-changed

Flags:

RUN_FIRST

Parameters:

settings (Tepl.Settings) – The object which received the signal

The ::font-changed signal is emitted when the return value of Tepl.Settings.get_selected_font() has potentially changed.

It takes into account the use_default_font_key provided with Tepl.Settings.provide_font_settings() to avoid unnecessary signal emission. In other words, for example if use_default_font_key is False, the signal is not emitted even if the default (system’s) font has been modified.

The relation between this signal and a potential zoom in and zoom out feature, to temporarily make the font larger or smaller (so the zoom level not being stored in Gio.Settings): when this signal is emitted, it means that the user has explicitly changed the font setting, and as such he or she probably wants to use that font instead. So the expected behavior in that case is to reset the zoom level. But it’s left as an exercise for another class, since Tepl.Settings is only for Gio.Settings.

New in version 6.2.

Property Details

Tepl.Settings.props.style_scheme_id
Name:

style-scheme-id

Type:

str

Default Value:

None

Flags:

READABLE

See Tepl.Settings.provide_style_scheme_settings().

The value of this property depends on whether the GTK theme is light or dark, and uses the corresponding Gio.Settings key.

New in version 6.11.