Re: [PATCH 4/4] Select the previous item when RemoveButton is clicked (KeyboardSpoke)

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

 



On Fri, 2012-01-20 at 10:17 -0500, Chris Lumens wrote:
> >          (store, itr) = selection.get_selected()
> > +        itr2 = store.get_iter_first()
> > +        #if the first item is selected, try to select the next one
> > +        if store.get_value(itr, 0) == store.get_value(itr2, 0):
> 
> I believe you can skip the get_value call and just do:  store[itr][0].
I've been fighting with a traceback when using TreeModelFilter (see
https://bugzilla.redhat.com/show_bug.cgi?id=783080 for more details) for
a while and using [itr][0] went to a bit confusing tracebacks. So I'm
using get_value(itr, 0) since that time. But I will change it.

> 
> > +            itr2 = store.iter_next(itr2)
> > +            if itr2:#next one existing
> 
> Please add some whitespace here.
Sure.

> 
> > +                selection.select_iter(itr2)
> > +            #nothing left to be selected
> > +            store.remove(itr)
> > +            return
> > +
> > +        #the selected item is not the first, select the previous one
> > +        #XXX: there is no model.iter_previous() so we have to find it this way
> > +        itr2 = store.iter_next(itr2)
> > +        while store.get_value(store.iter_next(itr2), 0) != store.get_value(itr, 0):
> 
> You should be able to do the subscripting thing here too.
> 
> - Chris

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux