title: Create DBus signal dynamically in python
body: <p>I've read some topics related to dynamically create python methods, and I followed their instructions, but it does not work. I do not know if it is because I use decorator <code>@</code> or something else.</p>
  
  <p>The code is here, very simple.</p>
  
  <p>When running this code, no error occurred, but when I use <code>D-feet</code>(A tool to check dbus informations), I could not find new signals I created.</p>
  
  <pre><code>#!/usr/bin/python
  
  import dbus
  import dbus.service
  import dbus.glib
  import gobject
  from dbus.mainloop.glib import DBusGMainLoop
  
  import psutil
  
  class EventServer(dbus.service.Object):
      i = 0
  
      @dbus.service.signal('com.github.bxshi.event')
      def singal_example(self,msg):
          """ example of singals
          """
          print msg
  
      def __init__(self):
          bus_name = dbus.service.BusName('com.github.bxshi.event', bus=dbus.SessionBus())
          dbus.service.Object.__init__(self, bus_name, '/com/github/bxshi/event')
  
      def create(self):
          self.i +=1
          setattr(self.__class__, 'signal_'+str(self.i), self.singal_example)
  
  
  if __name__ == "__main__":
      DBusGMainLoop(set_as_default=True)
      bus = dbus.SessionBus()
      eventserver = EventServer()
      gobject.timeout_add(1000,eventserver.create)
      loop = gobject.MainLoop()
      loop.run() 
  </code></pre>