ia64/xen-unstable

changeset 13552:6ce3b486f0d4

[PYGRUB] Don't redraw the interactive menu screen if it doesn't need it.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Mon Jan 22 11:49:05 2007 +0000 (2007-01-22)
parents 7c455af5998a
children 51ff40839470
files tools/pygrub/src/pygrub
line diff
     1.1 --- a/tools/pygrub/src/pygrub	Sun Jan 21 17:10:58 2007 +0000
     1.2 +++ b/tools/pygrub/src/pygrub	Mon Jan 22 11:49:05 2007 +0000
     1.3 @@ -400,14 +400,20 @@ class Grub:
     1.4                                     %(int(timeout) - mytime))
     1.5              else:
     1.6                  self.screen.addstr(20, 5, " " * 80)
     1.7 +            self.fill_entry_list()
     1.8  
     1.9 -            self.fill_entry_list()
    1.10              c = self.screen.getch()
    1.11 -            if mytime != -1:
    1.12 -                mytime += 1
    1.13 -                if mytime >= int(timeout):
    1.14 -                    self.isdone = True
    1.15 -                    break
    1.16 +            if c == -1:
    1.17 +                # Timed out waiting for a keypress
    1.18 +                if mytime != -1:
    1.19 +                    mytime += 1
    1.20 +                    if mytime >= int(timeout):
    1.21 +                        self.isdone = True
    1.22 +                        break
    1.23 +            else:
    1.24 +                # received a keypress: stop the timer
    1.25 +                mytime = -1
    1.26 +                self.screen.timeout(-1)
    1.27  
    1.28              # handle keypresses
    1.29              if c == ord('c'):
    1.30 @@ -432,10 +438,8 @@ class Grub:
    1.31                  self.isdone = True
    1.32                  break
    1.33              elif c == curses.KEY_UP:
    1.34 -                mytime = -1
    1.35                  self.selected_image -= 1
    1.36              elif c == curses.KEY_DOWN:
    1.37 -                mytime = -1
    1.38                  self.selected_image += 1
    1.39  #            elif c in (ord('q'), 27): # 27 == esc
    1.40  #                self.selected_image = -1