I thought I got this right...

I subclassed my events from dEvent like this:

   class OpenFile(dEvents.dEvent):
       pass

and then raise it from a button Hit handler like this:

   self.raiseEvent(events.OpenFile, filename=self.FileName.Value)

Some handler object that inherits from EventMixin and is bound in the  
Application's afterInit, binds to the event in its __init__ method  
like this:

   self.bindEvent(events.OpenFile, self.onOpenFile)

The method goes like this:

   def onOpenFile(self, evt):
       pprint.pprint(evt)

The button Hit handler gets called, and there's no error, so I guess  
the event gets sent. But it's never received.

What could be wrong? I found no documentation about dabo events, and  
from the sources and some mailing list posts this looks right to me.

Another of my "own" events does work, but it's bound in the App's  
afterInit, so I guess the problem ist with my non-GUI object.  
Shouldn't it be enough that it inherits from EventMixin?


BTW: The sample code in eventMixin.py is broken:

$ python eventMixin.py
EventBindings: []
EventBindings: [(<class '__main__.TestEvent'>, <function testFunc at  
0x121f6b0>, False)]
Traceback (most recent call last):
   File "eventMixin.py", line 360, in <module>
     o.raiseEvent(TestEvent)
   File "eventMixin.py", line 81, in raiseEvent
     eventData=eventData, *args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'eventData'

I guess TestEvent should inherit from dEvent or at least allow  
eventData (plus *args and **kwargs).


Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to