GNOME Bugzilla – Bug 464574
please wrap the 'input' signal for spinbutton
Last modified: 2018-08-17 13:42:10 UTC
I was trying to write a clock (hh:mm:ss) by subclass spinbutton. If I cound not handle the 'input' signal, the spinbutton always pickups the first digits (hh) and updates adjustment with it. I need a way to pass back different digits depending on the cursor location. Could you add a SpinButton.connect_signal_input(pyobject, ...) function which connect to the 'input' signal. User can pass back the calculated value using the pyobject.value attribute. Or using some other smarter tricks.
Created attachment 93441 [details] [review] patch with example how this could be done This patch only allows to handle 'input' signal with default handler (do_input), I cannot figure out how to do this for other handlers. Seems like this is impossible with current PyGObject infrastructure...
Created attachment 93442 [details] example, showing new do_input in action Note that _on_input() (handler to be connected) still uses current semantics and is therefore useless. But do_input() becomes useful with the patch above.
Created attachment 93540 [details] example with value_obj.value API What's in my mind is something like do_input(self, value_obj) and the actual value was assigned to value_obj.value. That way, the do_input can still return boolean. Anyway, since only the default handler can be override, I guess returning boolean is not much meaningful.
pygtk is not under active development anymore and had its last code changes in 2013. Its codebase has been archived: https://gitlab.gnome.org/Archive/pygtk/commits/master PyGObject at https://gitlab.gnome.org/GNOME/pygobject is its successor. See https://pygobject.readthedocs.io/en/latest/guide/porting.html for porting info. Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Feel free to open a task in GNOME Gitlab if the issue described in this task still applies to a recent version of PyGObject. Thanks!