After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 340475 - gtk.Treeview.set_select_function callback wrong
gtk.Treeview.set_select_function callback wrong
Status: RESOLVED FIXED
Product: pygtk
Classification: Bindings
Component: gtk
2.8.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2006-05-02 23:19 UTC by Wouter Bolsterlee (uws)
Modified: 2006-07-19 01:04 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Wouter Bolsterlee (uws) 2006-05-02 23:19:12 UTC
The callback for gtk.Treeview.set_select_function is not consistent with the docs. It's also not consistent with the GTK+ docs.


# set the select function from another method
self.previews_treeview.get_selection().set_select_function(self.some_select_function)

# define the select function
def some_select_function(self, *args): print args

Output is something like this: ((1,),)

http://www.pygtk.org/pygtk2reference/class-gtktreeselection.html#method-gtktreeselection--set-select-function tells me the select function should also have model and is_selected parameters instead of just a path.
Comment 1 John Finlay 2006-05-03 00:21:04 UTC
At a minimum the docs have to be changed. The current signature is really:

def func(info):

where info is a tuple containing a path or a path and user_data depending if user_data was passed to the set_select_function() method.

The question is whether this is enough to be useful. I'm guessing that it isn't since it would be useful to know if the path is currently selected and convenient to have the model and selection info available.
Comment 2 Wouter Bolsterlee (uws) 2006-05-03 08:50:02 UTC
Why not just follow the docs? GTK+ itself uses the same type of callback, which has all info available. A tuple argument looks like a hack to me: other methods use perfectly clean signatures... why shouldn't this one?
Comment 3 Johan (not receiving bugmail) Dahlin 2006-05-03 11:55:51 UTC
I agree that gtk.Treeview.set_select_function is broken. However, due to API stability concern, it's also unfixable in the current form.

I propose the addition of a new method, with an alternative name which should be used instead of set_select_function, in which all arguments are passed into the callback.
Comment 4 Gustavo Carneiro 2006-05-03 12:22:29 UTC
An alternative would be to keep the same method but add a new optional kwarg, like: 
  treeview.set_select_function(func, data, extended_signature=True)
Comment 5 John Finlay 2006-05-03 12:36:36 UTC
Since it's just the callback that is broken, not the method, and since it would seem that no one has ever used this method I think that the callback could be fixed for 2.10 and the method left alone. I see no advantage to leaving it with a broken callback and adding more cruft.
Comment 6 John Finlay 2006-07-19 01:04:26 UTC
Fixed following Gustavo's suggestion.

	(_wrap_gtk_tree_selection_set_select_function): Optionally provide full
	info to callback. #340475 (Wouter Bolsterlee)

Checking in gtk/gtktreeview.override;
/cvs/gnome/pygtk/gtk/gtktreeview.override,v  <--  gtktreeview.override
new revision: 1.71; previous revision: 1.70
done