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]
attribute parent G
Section titled “ parent ”def unwrap ()G
Section titled “ unwrap ”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 defaultmy_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]