【发布时间】:2015-08-19 09:56:28
【问题描述】:
我已经设置了一段读取 dbus 消息的代码:
def nf(bus, message):
print(message)
args = message.get_args_list()
for arg in message.get_args_list():
print("arg:" + arg)
DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()
bus.add_match_string_non_blocking("interface='org.freedesktop.Notifications',eavesdrop='true',member='Notify'")
bus.add_message_filter(nf)
mainloop = gobject.MainLoop()
mainloop.run()
当我启动它时,我会收到启动消息 <dbus.lowlevel.SignalMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: NameAcquired, dest: :1.215> 和参数 1.215。
但是当我使用notify-send 发送消息时,我也会收到消息<dbus.lowlevel.MethodCallMessage path: /org/freedesktop/Notifications, iface: org.freedesktop.Notifications, member: Notify dest: :1.212>,但我没有得到任何参数。当我用 dbus-monitor 尝试这个时,我得到了所有的论点。我错过了什么?
【问题讨论】: