Dear All,

Let me describe this issue with an example. I have a gtk.SpinButton and a signal handler function 'on_value_changed' which is triggered by the signal 'value_changed'. I want this handler to be invoked if a user changes the SpinButton value using the input devices. However, I don't want it to be invoked when I set the SpinButton value using 'set_value' function from the backend.

I know a couple of ways to achieve something similar:

1) using handler_block and handler_unblock functions of GObject class:
I can not use these functions because, they need an integer id of the handler function. Since my signal handler is being 'auto-connected' by a parent class, I don't have the handler_id available.


2) having an attribute flag 'ignore_value_changed' in my class. setting it only while changing the value from the backend and checking for the flag every time the signal handler is called:
sounds like a hack!


Is there any better way? What I really wish to have are some functions similar to 'GObject.[freeze | thaw]notify' for blocking and unblocking any signal, not just 'notify'.


- Chetan

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to