dbus.gi_service module

Support code for implementing D-Bus services via PyGI.

class dbus.gi_service.ExportedGObject(conn=None, object_path=None, **kwargs)

Bases: gi.overrides.GObject.Object, dbus.service.Object

A GObject which is exported on D-Bus.

Introspect(object_path, connection)

Return a string of XML encoding this object’s supported interfaces, methods and signals.

SUPPORTS_MULTIPLE_CONNECTIONS = False
SUPPORTS_MULTIPLE_OBJECT_PATHS = False
add_to_connection(connection, path)

Make this object accessible via the given D-Bus connection and object path.

Parameters
connectiondbus.connection.Connection

Export the object on this connection. If the class attribute SUPPORTS_MULTIPLE_CONNECTIONS is False (default), this object can only be made available on one connection; if the class attribute is set True by a subclass, the object can be made available on more than one connection.

pathdbus.ObjectPath or other str

Place the object at this object path. If the class attribute SUPPORTS_MULTIPLE_OBJECT_PATHS is False (default), this object can only be made available at one object path; if the class attribute is set True by a subclass, the object can be made available with more than one object path.

Raises ValueError

if the object’s class attributes do not allow the object to be exported in the desired way.

Since

0.82.0

bind_property()
bind_property_full(*args, **kargs)
chain()
compat_control(*args, **kargs)
connect()
connect_after()
connect_data(detailed_signal, handler, *data, **kwargs)

Connect a callback to the given signal with optional user data.

Parameters
  • detailed_signal (str) – A detailed signal to connect to.

  • handler (callable) – Callback handler to connect to the signal.

  • *data

    Variable data which is passed through to the signal handler.

  • connect_flags (GObject.ConnectFlags) – Flags used for connection options.

Returns

A signal id which can be used with disconnect.

connect_object()
connect_object_after()
property connection

The Connection on which this object is available. Access raises AttributeError if there is no Connection, or more than one Connection.

Changed in 0.82.0: AttributeError can be raised.

disconnect()

signal_handler_disconnect(instance:GObject.Object, handler_id:int)

disconnect_by_func()
emit()
emit_stop_by_name(detailed_signal)

Deprecated, please use stop_emission_by_name.

classmethod find_property(self, property_name:str) → GObject.ParamSpec
force_floating(*args, **kargs)
freeze_notify()

Freezes the object’s property-changed notification queue.

Returns

A context manager which optionally can be used to automatically thaw notifications.

This will freeze the object so that “notify” signals are blocked until the thaw_notify() method is called.

with obj.freeze_notify():
    pass
property g_type_instance
get_data(*args, **kargs)
get_properties()
get_property()
get_qdata(*args, **kargs)
getv = gi.FunctionInfo(getv)
handler_block(handler_id)

Blocks the signal handler from being invoked until handler_unblock() is called.

Parameters
  • obj (GObject.Object) – Object instance to block handlers for.

  • handler_id (int) – Id of signal to block.

Returns

A context manager which optionally can be used to automatically unblock the handler:

with GObject.signal_handler_block(obj, id):
    pass
handler_block_by_func()
handler_disconnect()

signal_handler_disconnect(instance:GObject.Object, handler_id:int)

handler_is_connected()

signal_handler_is_connected(instance:GObject.Object, handler_id:int) -> bool

handler_unblock()

signal_handler_unblock(instance:GObject.Object, handler_id:int)

handler_unblock_by_func()
classmethod install_properties(self, pspecs:list)
classmethod install_property(self, property_id:int, pspec:GObject.ParamSpec)
interface_find_property(*args, **kargs)
interface_install_property(*args, **kargs)
interface_list_properties(*args, **kargs)
is_floating = gi.FunctionInfo(is_floating)
classmethod list_properties(self) → list, n_properties:int
property locations

An iterable over tuples representing locations at which this object is available.

Each tuple has at least two items, but may have more in future versions of dbus-python, so do not rely on their exact length. The first two items are the dbus.connection.Connection and the object path.

Since

0.82.0

newv = gi.FunctionInfo(newv)
notify = gi.FunctionInfo(notify)
notify_by_pspec(*args, **kargs)
classmethod override_property(self, property_id:int, name:str)
props = <gi._gi.GProps object>
property qdata
ref(*args, **kargs)
property ref_count
ref_sink(*args, **kargs)
remove_from_connection(connection=None, path=None)

Make this object inaccessible via the given D-Bus connection and object path. If no connection or path is specified, the object ceases to be accessible via any connection or path.

Parameters
connectiondbus.connection.Connection or None

Only remove the object from this Connection. If None, remove from all Connections on which it’s exported.

pathdbus.ObjectPath or other str, or None

Only remove the object from this object path. If None, remove from all object paths.

Raises LookupError

if the object was not exported on the requested connection or path, or (if both are None) was not exported at all.

Since

0.81.1

replace_data(*args, **kargs)
replace_qdata(*args, **kargs)
run_dispose(*args, **kargs)
set_data(*args, **kargs)
set_properties()
set_property()
steal_data(*args, **kargs)
steal_qdata(*args, **kargs)
stop_emission(detailed_signal)

Deprecated, please use stop_emission_by_name.

stop_emission_by_name()

signal_stop_emission_by_name(instance:GObject.Object, detailed_signal:str)

thaw_notify = gi.FunctionInfo(thaw_notify)
unref(*args, **kargs)
watch_closure(*args, **kargs)
weak_ref()