[pygtk] Re: mark rows with pattern in treeview
John Dennis
jdennis at redhat.com
Wed Mar 7 05:07:24 WST 2007
On Tue, 2007-03-06 at 19:38 +0000, Fabian Braennstroem wrote:
> Hi Yuri,
>
> Yuri Pimenov schrieb am 03/06/2007 09:26 AM:
> > use TreeViewColumn's set_cell_data_func() to set attributes
> > the way you like.
>
> I think you misunderstood me; I am writing a small file manager
> based on the example from the tutorial and try to find a way to
> select (or mark) e.g. all files with the pdf-extension.
> One way would be to use a for loop to search in the 'list' for all
> pdf files and keep the corresponding row number; but I am not sure
> which function to use for selection!?
First get the selection object from the treeview:
selection = treeview.get_selection()
Then select the each path or iter (depending if you're using paths or
iters)
selection.select_path(some_path)
or
selection.select_iter(some_iter)
You'll probably end up with something like this:
selection.unselect_all()
iter = model.get_iter_first()
while iter:
value = model.get_value(iter, column)
if value is what I'm looking for:
selection.select_iter(iter)
iter = model.iter_next(iter)
HTH,
--
John Dennis <jdennis at redhat.com>
Learn. Network. Experience open source.
Red Hat Summit San Diego | May 9-11, 2007
Learn more: http://www.redhat.com/promo/summit/2007
More information about the pygtk
mailing list