All pastes #1907221 Raw Edit

Python Dbus Example

public python v1 · immutable
#1907221 ·published 2010-07-23 23:19 UTC
rendered paste body
import dbus, dbus.serviceimport gobjectfrom dbus.mainloop.glib import DBusGMainLoopclass SysTrayService(dbus.service.Object):    def __init__(self):	DBusGMainLoop(set_as_default=True)	bus_name = dbus.service.BusName("org.freedesktop.Notifications", bus=dbus.SessionBus())	dbus.service.Object.__init__(self, bus_name, "/org/freedesktop/Notifications")        @dbus.service.method("org.freedesktop.Notifications")    def Notify(self, app_name, replaces_id, app_icon,			summary, body, actions, hints,			expire_timeout):	print(app_name)	print(summary + "\n" + body)if __name__ == "__main__":    systray = SysTrayService()    loop = gobject.MainLoop()    loop.run()