mansrz / pymt

Automatically exported from code.google.com/p/pymt
0 stars 0 forks source link

Migrate from literal string event names to 'constant' variable event names #343

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
i.e., instead of:
    animobj.connect('on_animation_complete', myhandler)

we do this:
    from pymt.events import ON_ANIMATION_COMPLETE
    animobj.connect(ON_ANIMATION_COMPLETE, myhandler)

And for backwards compatibility, in pymt/events.py:
    ON_ANIMATION_COMPLETE = 'on_animation_complete'

Why all this? The interpreter will let us know immediately if we misspelled the 
event name, e.g. ON_ANIMATOIN_COMPLETE would immediately raise an error, but 
'on_animatoin_complete' would only ever surface at runtime.

Original issue reported on code.google.com by dennd...@gmail.com on 12 Oct 2010 at 10:58