Problem editing treeview cell from popup menu



I have a treeview which has files and folder. Folders are editable,
files are not. This is set using the "editable" attribute on the
treeview column. So users can click-to-edit the folders. Now I also
have a popup menu with "Rename" which should start editing the folder.
This is the code that does that:

def _begin_edit_at_iter(self, model, tree_iter):
    path = model.get_path(tree_iter)
    parent_iter = model.iter_parent(tree_iter)
    if parent_iter:
        self._treeview.expand_to_path(path)
    column = self._treeview.get_column(0)
    self._treeview.grab_focus()
    self._treeview.set_cursor(path, column, True)

This does not work until a cell has been edited once using the
click-to-edit method. Once any cell has been edited once, only then
does the Rename menu work. And it works on any cell throughout the
lifetime of the application. Any ideas why it does not work initially?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]