On Wed, Sep 30, 2009 at 10:36 PM, Enlightenment SVN
<[email protected]> wrote:
> Log:
> Bunch-O-Things by billiob
>
> - Added separator
> - Changed how callbacks work internally
...
> +cdef void _anchorblock_callback(void *cbt, c_evas.Evas_Object *o, void
> *event_info) with gil:
> + cdef Elm_Entry_Anchorblock_Info *ei
> + try:
> + (event, obj, callback, data) = <object>cbt
> + if not callable(callback):
> + raise TypeError("callback is not callable")
> + if event_info is NULL:
> + av = None
> + else:
> + ei = <Elm_Entry_Anchorblock_Info*>event_info
> + av = AnchorBlockInfo()
> + av.name = ei.name
> + av.button = ei.button
> + av.hover = Hover(None, <object>ei.hover);
> + av.anchor = (ei.anchor.x, ei.anchor.y,
> + ei.anchor.w, ei.anchor.h)
> + av.hover_parent = (ei.hover_parent.x, ei.hover_parent.y,
> + ei.hover_parent.w, ei.hover_parent.h)
> + av.hover_left = ei.hover_left
> + av.hover_right = ei.hover_right
> + av.hover_top = ei.hover_top
> + av.hover_bottom = ei.hover_bottom
> + #Use old parameters order not to break existing programs
> + callback(obj, av, data)
> + # should be: callback(data, obj, <long>event_info)
> + except Exception, e:
> + traceback.print_exc()
okay, I'm happy that callbacks got improved in elm, but the comment is
wrong. This is not Pythonic and is now how other parts of Python-EFL
works.
All callbacks should be converted to pythonic way:
callback(obj, standard-params, *args, **kargs)
For those that don't know, this will expand args to a positional list
of parameters and kargs to key=value pairs, then connection is like:
def cb(x, y, a, b):
print x, y, a, b
obj.bla_callback_add(cb, 1, 2, b=123, a="xyz")
that will print 1 2 xyz 123
Always using one single and forced "data" is required in C, but it's
not in Python and it's now how most libs work, so why add this? :-)
--
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: [email protected]
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel