I am trying to insert a row into a Gtk.TreeStore, for which I have to pass the selected row number from Gtk.TreeView. I found the solution for PyGTK but not for PyGObject.
For PyGTK the insert function looks like this (http://www.pygtk.org/pygtk2reference/class-gtktreestore.html#method-gtktreestore--insert):
def insert(parent, position, row=None)
The position can be queried like this:
treeview = Gtk.TreeView()
selection = treeview.get_selection()
model, iter = selection.get_selected()
path = iter.get_selected_rows()[0]
index = path.get_indices()[0]
But in PyGObject I get the error:
self.index = self.path.get_indices()[0]
AttributeError: 'LayerDataStore' object has no attribute 'get_indices'
How can I get the integer value of the row number? Am I approaching the problem in a weird way? It seems like the solution should be simpler and have less code.
Further Reading:
This is the description of the insert function in GTK3:
Similar question for PyGTK:
Similar question for C++: