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 ()

peek_desktop_interface_settings ()

provide_font_settings (font_settings, use_default_font_key, editor_font_key)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

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.

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.

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.