[prev in list] [next in list] [prev in thread] [next in thread] 

List:       enlightenment-devel
Subject:    Re: [E-devel] Important change in python elementary
From:       morphis () gravedo ! de
Date:       2009-11-26 20:09:51
Message-ID: 20091126200951.GA3427 () nirvana
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Sun, Nov 22, 2009 at 10:28:59PM +0100, Boris 'billiob' Faure wrote:
> 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
> 

Great work. I even thought about implementing this but at the moment I
don't have much time to do any python-elementary related work. Maybe
things will change in the new year.

Keep up!

["signature.asc" (application/pgp-signature)]

------------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic