[PATCH] Only the Summary TUI hub wants to accept 'b' to continue (#1077546)

Samantha N. Bueno sbueno+anaconda at redhat.com
Tue Mar 18 14:15:47 UTC 2014


On Tue, Mar 18, 2014 at 09:24:01AM -0400, Samantha N. Bueno wrote:
> On Tue, Mar 18, 2014 at 11:28:32AM +0100, Vratislav Podzimek wrote:
> > Instead of making all TUI hubs continuing when 'b' is entered instead of 'c'
> > move the code to the Summary hub that is the only one really wanting such
> > behaviour.
> > 
> > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > ---
> >  pyanaconda/ui/tui/hubs/__init__.py | 11 ++---------
> >  pyanaconda/ui/tui/hubs/summary.py  | 28 ++++++++++++++++++++++++++++
> >  2 files changed, 30 insertions(+), 9 deletions(-)
> > 
> > diff --git a/pyanaconda/ui/tui/hubs/__init__.py b/pyanaconda/ui/tui/hubs/__init__.py
> > index 905de25..b637f94 100644
> > --- a/pyanaconda/ui/tui/hubs/__init__.py
> > +++ b/pyanaconda/ui/tui/hubs/__init__.py
> > @@ -105,18 +105,11 @@ class TUIHub(TUIObject, common.Hub):
> >          except (ValueError, KeyError):
> >              # If we get a continue, check for unfinished spokes.  If unfinished
> >              # don't continue
> > -            # TRANSLATORS: 'b' to begin installation
> > -            if key == _('b'):
> > +            # TRANSLATORS: 'c' to continue
> > +            if key == _('c'):
> >                  for spoke in self._spokes.values():
> >                      if not spoke.completed and spoke.mandatory:
> >                          print(_("Please complete all spokes before continuing"))
> >                          return False
> 
> Since only the summary hub controls whether you proceed with
> installation, I think the check for whether each mandatory spoke is
> completed is no longer necessary here. We can just return key.

Hrm, just re-read through the bug mentioned. It looks like this has to
be left in for initial-setup to function properly, so I take back my
comment above.

That said, ack on the patch, and thanks for fixing my mistake. I forgot
to push my patch for this to master branch, so I just won't now.
 
> > -                if self.app._screens:
> > -                    self.app.close_screen()
> > -                    return True
> > -            # Kind of a hack, but we want to ignore if anyone presses 'c'
> > -            # which is the global TUI key to close the current screen
> > -            elif key == _('c'):
> > -                return False
> >  
> >              return key
> > diff --git a/pyanaconda/ui/tui/hubs/summary.py b/pyanaconda/ui/tui/hubs/summary.py
> > index 4074997..c0ea6db 100644
> > --- a/pyanaconda/ui/tui/hubs/summary.py
> > +++ b/pyanaconda/ui/tui/hubs/summary.py
> > @@ -77,3 +77,31 @@ class SummaryHub(TUIHub):
> >          # override the default prompt since we want to offer the 'b' to begin
> >          # installation option here
> >          return _("  Please make your choice from above ['q' to quit | 'b' to begin installation |\n  'r' to refresh]: ")
> > +
> > +    def input(self, args, key):
> > +        """Handle user input. Numbers are used to show a spoke, the rest is passed
> > +        to the higher level for processing."""
> > +        try:
> > +            number = int(key)
> > +            self.app.switch_screen_with_return(self._keys[number])
> > +            return None
> > +
> > +        except (ValueError, KeyError):
> > +            # If we get a continue, check for unfinished spokes.  If unfinished
> > +            # don't continue
> > +            # TRANSLATORS: 'b' to begin installation
> > +            if key == _('b'):
> > +                for spoke in self._spokes.values():
> > +                    if not spoke.completed and spoke.mandatory:
> > +                        print(_("Please complete all spokes before continuing"))
> > +                        return False
> > +                if self.app._screens:
> > +                    self.app.close_screen()
> > +                    return True
> > +            # TRANSLATORS: 'c' to continue
> > +            elif key == _('c'):
> > +                # Kind of a hack, but we want to ignore if anyone presses 'c'
> > +                # which is the global TUI key to close the current screen
> > +                return False
> > +            else:
> > +                super(SummaryHub, self).input(args, key)
> > -- 
> > 1.8.5.3
> > 
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches


More information about the anaconda-patches mailing list