Skip to content

Service

class Signal (name: str | Callable[[Concatenate[G, P]], R], flags: Literal['run-last', 'run-first', 'run-cleanup', 'no-recurse', 'detailed', 'action', 'no-hooks', 'must-collect', 'deprecated', 'accumulator-first-run'] | SignalFlags = GObject.SignalFlags.RUN_FIRST, rtype: Any = None, arg_types: tuple = (), install: bool = True, **kwargs)

Section titled “ Signal ”

Bases: Generic[G, P, R]

attribute flags SignalFlags

Section titled “ flags ”

attribute install bool

Section titled “ install ”

attribute func Callable[[Concatenate[G, P]], R] | None

Section titled “ func ”

attribute name str

Section titled “ name ”

attribute arg_types tuple

Section titled “ arg_types ”

attribute rtype Any

Section titled “ rtype ”

def detail (detail_name)Signal[G, P, R]

Section titled “ detail ”

def serialize ()dict[str, tuple[SignalFlags, Any, tuple[Any]]]

Section titled “ serialize ”

static installer (klass)

Section titled “ installer ”

def Property (*_, **__)

Section titled “ Property ”

class Builder (parent: G)

Section titled “ Builder ”

Bases: Generic[G]

class Service (**kwargs)

Section titled “ Service ”

Bases: Object, Generic[P, T]

Base service class

Handles constructor connections, bindings and builders

Default service constructor (base constructor)

  • Parameters: **kwargs

    mapped to signal connections (e.g. on_clicked=lambda *_: … connects the given function to the signal “clicked”, notify_my_property=my_func connects the given function to the signal “notify::my-property”)

def build (callback: None = None, *args: typing.~P, **kwargs: typing.~P)fabric.core.service.Builder[Self]

Section titled “ build ”

def build (callback: collections.abc.Callable[[typing.Concatenate[typing.Self, fabric.core.service.Builder[typing.Self], ~P]], typing.Any] | collections.abc.Callable[[typing.Concatenate[typing.Self, ~P]], typing.Any] | collections.abc.Callable[[~P], typing.Any], *args: typing.~P, **kwargs: typing.~P)Self

Section titled “ build ”

def build (callback: ~collections.abc.Callable[[~typing.Concatenate[~typing.Self, ~fabric.core.service.Builder[~typing.Self], ~P]], ~typing.Any] | ~collections.abc.Callable[[~typing.Concatenate[~typing.Self, ~P]], ~typing.Any] | ~collections.abc.Callable[[~P], ~typing.Any] | None = None, *args: ~typing.~P, **kwargs: ~typing.~P)Builder[Self] | Self

Section titled “ build ”

Get an instance of a Builder that holds a reference to this service

Builders enable you of doing extra configuration after the initialization of a service with ease, it makes you able to either have a callback function that does all the extra setup or chain all your setup calls at once

Examples:

my_service = (
MyService()
.build()
# beginning of method chaining
.useful_method()
.other_useful_method()
.set_something("something")
.unwrap() # unwrap self (the service) and get a reference to it
)
# when passing a setup function it returns self by default
my_service = MyService().build(lambda self, builder: self.do_something())
my_service = MyService().build(
lambda self, builder: (
builder.useful_method()
.other_useful_method()
.set_something("something")
# no need to do `.unwrap()` since we don't really need the value of self
)
)
  • Parameters: callback (Optional *[*Callable *[*Concatenate *[*Self , Builder *[*Self ] , P ] , Any ] | Callable *[*Concatenate *[*Self , P ] , Any ] | Callable *[*P , Any ] ] , optional) — an optional callback to use instead of chaining method calls, defaults to None
  • Returns: a newly created builder (or a cached one if found)
  • Return type: Union[Builder[Self], Self]

def bind (source_property: str, target_property: str, target_object: Object, transform_to: Callable[[Binding, Any], Any] | None = None, transform_from: Callable[[Binding, Any], Any] | None = None, flags: Literal['default', 'bidirectional', 'sync-create', 'invert-boolean'] | BindingFlags = GObject.BindingFlags.DEFAULT)

Section titled “ bind ”

def emit (signal_name: str, *args, **kwargs)None

Section titled “ emit ”

def connect (signal_name: str, callback: Callable[[Concatenate[Self, P]], Any] | Callable, *args, ignore_missing: bool = True)int

Section titled “ connect ”

static filter_kwargs (kwargs: dict[str, Any])dict[str, Any]

Section titled “ filter_kwargs ”

static get_connectables_for_kwargs (kwargs: dict[str, Any])Generator[tuple[str, Callable[[...], Any]], None, None]

Section titled “ get_connectables_for_kwargs ”

def set_property (self, property_name: str, value: GObject.Value)

Section titled “ set_property ”

def get_property (self, property_name: str, value: GObject.Value)

Section titled “ get_property ”

def set_properties (*args, **kwargs)None

Section titled “ set_properties ”

def get_signal_names ()list[str]

Section titled “ get_signal_names ”

def get_signal_ids ()list[int]

Section titled “ get_signal_ids ”

def get_properties ()list[ParamSpec]

Section titled “ get_properties ”

def notify (self, property_name: str)

Section titled “ notify ”