[PATCH 4/4] Add dialog for configuring layout switching options

Brian C. Lane bcl at redhat.com
Mon Oct 22 17:18:14 UTC 2012


On Mon, Oct 22, 2012 at 06:29:46PM +0200, Vratislav Podzimek wrote:
> Resolves: rhbz#864785
> Resolves: rhbz#859606
> 
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
>  pyanaconda/ui/gui/spokes/keyboard.glade | 181 +++++++++++++++++++++++++++++++-
>  pyanaconda/ui/gui/spokes/keyboard.py    | 133 +++++++++++++++++++++++
>  2 files changed, 311 insertions(+), 3 deletions(-)
> 

> +    def refresh(self):
> +        itr = self._switchingOptsStore.get_iter_first()
> +        while itr:
> +            option = self._switchingOptsStore[itr][0]
> +            if option in self.data.keyboard.switch_options:
> +                self._switchingOptsStore.set_value(itr, 1, True)
> +            else:
> +                self._switchingOptsStore.set_value(itr, 1, False)
> +
> +            itr = self._switchingOptsStore.iter_next(itr)

I think you could use  itr in self._switchingOptsStore: instead of
manually iterating.

> +    @property
> +    def checked_options(self):
> +        """Property returning all checked options from the list"""
> +
> +        ret = []
> +        for row in self._switchingOptsSort:
> +            if row[1] and row[0]:
> +                ret.append(row[0])
> +
> +        return ret

You could use list comprehension here:
ret = [row[0] for row in self._switchingOptsSort if row[0] and row[1]]

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/anaconda-patches/attachments/20121022/1438c4c0/attachment.sig>


More information about the anaconda-patches mailing list