GObject#

class ignis.gobject.IgnisGObject(*args: Any, **kwargs: Any)#

Bases: GObject.Object

A base class for all services and widgets (and some utils). Mainly, it is the same GObject.Object, but with some improvements.

  1. It provides support for Binding.

  2. It offers easier control over properties (without the need for the .props attribute).

notify_all(without: list[str] | str | None = None) None#

Notify all properties.

Parameters:

without (list[str] | str | None, default: None) -- A property or a list of properties that will not be notified.

Return type:

None

notify_list(*args) None#

Notify list of properties. You can pass unlimited number of property names as arguments.

Return type:

None

bind_property2(source_property: str, target: gi.repository.GObject.Object, target_properties: list[str], transform: Callable | None = None) None#

Bind source_property on self with target_properties on target.

Parameters:
  • source_property (str) -- The property on self to bind.

  • target (Object) -- the target GObject.Object.

  • target_properties (list[str]) -- the properties on target to bind.

  • transform (Callable | None, default: None) -- The function that accepts a new property value and returns the processed value.

Return type:

None

bind(property_name: str, transform: Callable | None = None) Binding#

Creates Binding from property name on self.

Parameters:
  • property_name (str) -- Property name of self.

  • transform (Callable | None, default: None) -- The function that accepts a new property value and returns the processed value.

Return type:

Binding

Returns:

Binding

bind_many(property_names: list[str], transform: Callable) Binding#

Creates Binding from property names on self.

Parameters:
  • property_names (list[str]) -- List of property names of self.

  • transform (Callable) -- The function that accepts a new property values and returns the processed value. The values will be passed according to the order in property_names.

Return type:

Binding

Returns:

Binding

class ignis.gobject.Binding(target: gi.repository.GObject.Object, target_properties: list[str], transform: Callable | None = None)#

An object that describe binding.

Parameters:
  • target (Object) -- The target GObject.

  • target_properties (list[str]) -- The properties on the target GObject to bind.

  • transform (Callable | None, default: None) -- The function that accepts a new property value and returns the processed value.

target() gi.repository.GObject.Object#

The target GObject.

Return type:

Object

target_properties() list[str]#

The properties on the target GObject to bind.

Return type:

list[str]

transform() Callable | None#

The function that accepts a new property value and returns the processed value.

Return type:

Callable | None

class ignis.gobject.IgnisProperty(*args, **kwargs)#

Bases: Property.

Like GObject.Property, but determines the property type automatically based on the return type of the getter. You can override this behaviour by explicitly passing type argument to the constructor. Arguments for the constructor are the same as for GObject.Property.

class ignis.gobject.IgnisSignal(*args, **kwargs)#

Bases: Signal.

The same as GObject.Signal, nothing special. This class is needed only for the correct determination of signals when building docs.

class ignis.gobject.DataGObject(data: dict[str, Any] | None = None, match_dict: dict[str, str] | None = None)#

A GObject that can synchronize its properties with a simple Python dictionary.

Parameters:
  • data (dict[str, Any] | None, default: None) -- The dictionary to synchronize with.

  • match_dict (dict[str, str] | None, default: None) -- The match dictionary between a key in the data and the property on self.

You have to define attributes from data in init. The actual attributes from data must be protected (prefixed with _). All other attributes must be private (prefixed with __).

gproperty data: dict[str, Any]#
  • read-only

The current data collected from protected class attributes.

gproperty latest_synced_data: dict[str, Any]#
  • read-only

The latest synced data.

gproperty match_dict: dict[str, str]#
  • read-only

The match dictionary.

sync(data: dict[str, Any]) None#

Perform the property synchronization.

Parameters:

data (dict[str, Any]) -- The dictionary to synchronize with.

Return type:

None