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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel