GNOME Bugzilla – Bug 698711
Gtk.TreePath.get_indices() returns [0] ?
Last modified: 2013-09-12 08:06:54 UTC
Just as the title said, the code snippet listed as follows >>> from gi.repository import Gtk >>> Gtk.TreePath().get_indices() [0] Besides, there is another example of empty TreePath returns [] >>> Gtk.TreePath.new().get_indices() [] The real problem I encountered is that I want to judge whether a TreePath is empty. For now I use >>> if p and p.get_indices(): >>> pass Was it the proper way to do that?
Currently I'm working on porting liblarch [1] from pyGTK to Gtk3 and the recent work I am dealing with is to solve the bugs related to Gtk.TreePath migration. The ideal situation we want to implement is that we can both support pyGtk and Gtk3 smoothly. The detailed progress can be found here [2]. Any advices are welcome. [1] https://live.gnome.org/liblarch [2] https://github.com/liblarch/liblarch/pull/8
Having an implicit default of [0] is a bit unfortunate. There is a patch which deprecates this in bug 705810. Please use the class methods Gtk.TreePath.new and new_from_string explicitly to get what you want. Eventually, Gtk.TreePath() should either return an empty path or require an explicit array all the time. *** This bug has been marked as a duplicate of bug 705810 ***