Re: [pygtk] Avoiding signal emission on changes from the backend
Thanks for ur replies, Johan and Christian, As Johan suggested, I think the best possible way is to use a flag such as 'ignore_signals' and set it while manipulating the value from background. I can not use seperate functions as suggested by Christian because, the ultimate goal is to _display_ the value in the GUI widget, and the widget class triggers the value_changed signal, whenever the widget is updated to a different value, i.e. whenever a new value is _displayed_ in the widget. - Chetan Original Message: - From: [EMAIL PROTECTED] (Christian Reis) Use separate functions for the two things; in fact, have the on_value_changed handler _call_ set_value when it needs to, and then do its own specific thing. You don't need any particular GTK+ features for this, and simpler code is better code. mail2web - Check your email from the web at http://mail2web.com/ . ___ 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/
Re: [pygtk] Avoiding signal emission on changes from the backend
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chetan Dandekar wrote: 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. Try to save it by modifying the auto connection mechamisn, if it's not possible, just use a variable to block it manually. Johan -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCQtPTvOdKxkYdUWQRAjZ9AJsHYYbSj6GIaYRCzz59zjKijkDbGQCeIwKN fBaKzVPx1OfS8ZYXUfMpMgE= =gYF3 -END PGP SIGNATURE- ___ 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/
Re: [pygtk] Avoiding signal emission on changes from the backend
On Thu, Mar 24, 2005 at 09:44:02AM -0500, Chetan Dandekar wrote: 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. Use separate functions for the two things; in fact, have the on_value_changed handler _call_ set_value when it needs to, and then do its own specific thing. You don't need any particular GTK+ features for this, and simpler code is better code. Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331 ___ 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/