from gi.repository import Gio from .proxy import ProxyMixin from .request_name import RequestNameMixin from .bus_names import OwnMixin, WatchMixin from .subscription import SubscriptionMixin from .registration import RegistrationMixin from .publication import PublicationMixin def pydbus_property(self): try: return self._pydbus except AttributeError: self._pydbus = Bus(self) return self._pydbus Gio.DBusConnection.pydbus = property(pydbus_property) def bus_get(type): return Gio.bus_get_sync(type, None).pydbus def connect(address): c = Gio.DBusConnection.new_for_address_sync(address, Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT | Gio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION, None, None) c.pydbus.autoclose = True return c.pydbus class Bus(ProxyMixin, RequestNameMixin, OwnMixin, WatchMixin, SubscriptionMixin, RegistrationMixin, PublicationMixin): Type = Gio.BusType def __init__(self, gio_con): self.con = gio_con self.autoclose = False def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): if self.autoclose: self.con.close_sync(None) @property def dbus(self): try: return self._dbus except AttributeError: self._dbus = self.get(".DBus")[""] return self._dbus @property def polkit_authority(self): try: return self._polkit_authority except AttributeError: self._polkit_authority = self.get(".PolicyKit1", "Authority")[""] return self._polkit_authority def SystemBus(): return bus_get(Bus.Type.SYSTEM) def SessionBus(): return bus_get(Bus.Type.SESSION)
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
__init__.py | File | 148 B | 0644 |
|
_inspect3.py | File | 708 B | 0644 |
|
auto_names.py | File | 519 B | 0644 |
|
bus.py | File | 1.53 KB | 0644 |
|
bus_names.py | File | 3.45 KB | 0644 |
|
error.py | File | 2.52 KB | 0644 |
|
exitable.py | File | 982 B | 0644 |
|
generic.py | File | 2.53 KB | 0644 |
|
identifier.py | File | 383 B | 0644 |
|
method_call_context.py | File | 1.01 KB | 0644 |
|
proxy.py | File | 4.1 KB | 0644 |
|
proxy_method.py | File | 3.98 KB | 0644 |
|
proxy_property.py | File | 1.04 KB | 0644 |
|
proxy_signal.py | File | 2.06 KB | 0644 |
|
publication.py | File | 1.36 KB | 0644 |
|
registration.py | File | 5.58 KB | 0644 |
|
request_name.py | File | 883 B | 0644 |
|
subscription.py | File | 2.12 KB | 0644 |
|
timeout.py | File | 303 B | 0644 |
|