ia64/xen-unstable

changeset 8787:859c8d66b203

Fix pygrub to handle timeout of -1 (wait forever).
Only call use_default_colors() if it's available.

Signed-off-by: John Levon <john.levon@sun.com>
author john.levon@sun.com
date Tue Feb 07 20:46:13 2006 +0000 (2006-02-07)
parents e9d78d8bd568
children dcc2beb8a1d2
files tools/pygrub/src/pygrub
line diff
     1.1 --- a/tools/pygrub/src/pygrub	Tue Feb 07 20:38:44 2006 +0000
     1.2 +++ b/tools/pygrub/src/pygrub	Tue Feb 07 20:46:13 2006 +0000
     1.3 @@ -29,7 +29,8 @@ PYGRUB_VER = 0.3
     1.4  
     1.5  def draw_window():
     1.6      stdscr = curses.initscr()
     1.7 -    curses.use_default_colors()
     1.8 +    if hasattr(curses, 'use_default_colors'):
     1.9 +        curses.use_default_colors()
    1.10      try:
    1.11          curses.curs_set(0)
    1.12      except _curses.error:
    1.13 @@ -152,15 +153,16 @@ def get_entry_idx(cf, entry):
    1.14  
    1.15  def main(cf = None):
    1.16      mytime = 0
    1.17 +    timeout = int(cf.timeout)
    1.18  
    1.19      (stdscr, win) = draw_window()
    1.20      stdscr.timeout(1000)
    1.21      selected = cf.default
    1.22      
    1.23 -    while (mytime < int(cf.timeout)):
    1.24 -        if cf.timeout != -1 and mytime != -1: 
    1.25 +    while (timeout == -1 or mytime < int(timeout)):
    1.26 +        if timeout != -1 and mytime != -1: 
    1.27              stdscr.addstr(20, 5, "Will boot selected entry in %2d seconds"
    1.28 -                          %(int(cf.timeout) - mytime))
    1.29 +                          %(int(timeout) - mytime))
    1.30          else:
    1.31              stdscr.addstr(20, 5, " " * 80)
    1.32