def callback(retval): if _config['use-plasma']: plasma = \ dbus.session_bus().get_object(*self.plasma_overlay_path) d = plasma.call(b'quit', b'org.kde.plasmaoverlay.App') return d.addCallbacks(callbackFinal, errback) else: return callbackFinal(retval)
def remote_call_dbus(self, bus, bus_name, object_path, iface_name, method, args): def callback(retval): _log.debug('DBus call {0} returned result: {1}'.format(method, retval)) def errback(failure): _log.debug('DBus call {0} returned failure: {1}'.format(method, failure)) if bus == 'system': bus = dbus.system_bus() elif bus == 'session': bus = dbus.session_bus() else: _log.warning('Unknown DBus bys type: {0}'.format(bus)) return d = bus.get_object(bus_name, object_path).call(method, iface_name, *args) return d.addCallbacks(callback, errback)
def __init__(self): object = dbus.session_bus().get_object(*self.screensaver_path) self.screensaver = object.get_interface(b'org.freedesktop.ScreenSaver')