[E-devel] Important change in python elementary

Vaudano Luca vaudano at gmail.com
Mon Nov 23 10:17:53 CET 2009


The revisions affected by the change are from 43900.

Bye
Luca

On Mon, Nov 23, 2009 at 9:30 AM, Vaudano Luca <vaudano at gmail.com> wrote:
> Hi guys,
> I think that it's a good thing forward the following email here!
>
> Ciao
> Luca
>
>
> ---------- Forwarded message ----------
> From: Boris 'billiob' Faure <billiob at gmail.com>
> Date: Sun, Nov 22, 2009 at 10:28 PM
> Subject: [E-devel] Important change in python elementary
> To: enlightenment-devel at lists.sourceforge.net
>
>
> I've committed some changes to how callbacks are handled in python elementary.
> If you use it, your application is now broken, I'm sorry. However,
> it's better now than letter :)
>
> So, what have changed?
> You used to bind a callback to the "clicked" of a button this way:
> bt.clicked = my_func
> or
> bt.clicked = (my_func, my_data)
>
> The signature of the callback was always: my_func(obj, event, data)
> even if you had not set any data!
> What if you wanted to perform 2 actions? How could you remove the callback?
>
> Now, in order to connect a function to an event, let say 'clicked', you use:
> bt.callback_clicked_add(func, *args, **kwargs)
>
> The required signature is my_func(obj, *args, **kwargs) or
> my_func(obj, it, *args, **kwargs) if an item is given, for example
> when an item in a toolbar is clicked.
>
> If you want to disconnect this function to the event, you call:
> bt.callback_clicked_remove(func, *args, **kwargs)
> if func is None, all the events bound to 'clicked' are removed.
> args and kwargs must be the same as those given when the callback was set.
>
> Now, this is possible:
> def destroy(win, str1, str2, str3, str4):
>    print :str1='%s', str2='%s', str3='%s', str4='%s'" %(
>        str1, str2, str3, str4)
>
> win.callback_destroy_add(destroy, "test1", "test2", str3="test3", str4="test4")
>
>
>
> To sum up:
> when you used:
> obj.EVENT = XXX
> now you should use:
> obj.callback_EVENT_add(XXX)
>
>
> I've updated the testing file. I hope to have patched correctly editje.
> --
> Boris 'billiob' Faure
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>



More information about the community mailing list