Need help to set a cursor/focus on treeview row!




I am learning, so please bear with me!

I have the following code:

    def expandHome(self, model, iter=None, defaultHome=None):
        ''' expand user's home directory '''
        if not defaultHome:
            return
        ran = model.iter_n_children(iter)
        for i in range(ran):
            iter_n_child = model.iter_nth_child(iter, i)
            path = model.get_path(iter_n_child)
            pn = model[path][1]
            idx = defaultHome.find(pn)
            if idx > -1:
                Dbg.dPrint(" + File=%s" % pn)
                StoreTools.append_path(model, iter=iter_n_child)
                Display.tv.expand_row(path, False)
                self.expandHome(model, iter_n_child, defaultHome)
        # Set cursor selection to the homepath here
        Display.tv.set_cursor(path, focus_column=None, start_editing=False)

The treestore is saved into a treeview, and the
treeview is saved into a scrolledwindow.

The above code expands the treeview on the user's
home directory and it works, and the last step is to
set the cursor or focus on the user's home directory
of which I am not able to do.  The code:

Display.tv.set_cursor(path, focus_column=None, start_editing=False)

is a feeble attempt to do that and it is not working for
me.

Please advise?

Thanks!
Dan




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