[PATCH 2/2] Don't let user hit Add button if no new layouts are selected

Vratislav Podzimek vpodzime at redhat.com
Wed Sep 12 08:17:02 UTC 2012


On Tue, 2012-09-11 at 11:29 -0400, Chris Lumens wrote:
> > diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
> > index d350967..4fc07cb 100644
> > --- a/pyanaconda/ui/gui/spokes/keyboard.py
> > +++ b/pyanaconda/ui/gui/spokes/keyboard.py
> > @@ -106,6 +106,16 @@ class AddLayoutDialog(GUIObject):
> >          for layout in self._xkl_wrapper.get_available_layouts():
> >              self._addLayout(self._store, layout)
> >  
> > +        self._confirmAddButton = self.builder.get_object("confirmAddButton")
> > +
> > +        self._newLayoutSelection = self.builder.get_object("newLayoutSelection")
> > +        selected = self._newLayoutSelection.count_selected_rows()
> > +        if selected:
> > +            self._confirmAddButton.set_sensitive(True)
> > +        else:
> > +            self._confirmAddButton.set_sensitive(False)
> > +
> > +
> 
> If you're not planning on adding more code here, the bottom part could
> just be:
> 
>     self._confirmAddButton.set_sensitive(selected)
> 
> > @@ -124,6 +134,13 @@ class AddLayoutDialog(GUIObject):
> >              itr = store.get_iter(path)
> >              self._chosen_layouts.append(store[itr][0])
> >  
> > +    def on_add_layout_selection_changed(self, selection):
> > +        selected = selection.count_selected_rows()
> > +        if not selected:
> > +            self._confirmAddButton.set_sensitive(False)
> > +        else:
> > +            self._confirmAddButton.set_sensitive(True)
> > +
> >      def on_cancel_clicked(self, *args):
> >          print "CANCELING"
> 
> Likewise, but with a not.
Good catch, thanks. This is a left-over from the older version of the
patch that tried to always have something selected. I'll change it
before pushing.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list