Skip to contentSkip to conversation

fix two pygrub problems

PATCH RESEND In review John Levon 2 participants 2 messages Feb 7, 2006

lore
Share & tools
lore

John Levon

author
#0 lore raw

PATCH RESEND 1/1 fix two pygrub problems

# HG changeset patch
# User [email protected]
# Node ID d68796f82e99e68750a2212fef57d61e65f9afb9 # Parent 5b004f4e76cf90ef6f7155a4822e63b9e33cf7d8 Fix pygrub to handle timeout of -1 (wait forever). Only call use_default_colors() if it's available.

tools/pygrub/src/pygrub +6 -4
diff -r 5b004f4e76cf -r d68796f82e99 tools/pygrub/src/pygrub
@@ -29,7 +29,8 @@
 
 def draw_window():
     stdscr = curses.initscr()
-    curses.use_default_colors()
+    if hasattr(curses, 'use_default_colors'):
+        curses.use_default_colors()
     try:
         curses.curs_set(0)
     except _curses.error:
@@ -152,15 +153,16 @@
 
 def main(cf = None):
     mytime = 0
+    timeout = int(cf.timeout)
 
     (stdscr, win) = draw_window()
     stdscr.timeout(1000)
     selected = cf.default
     
-    while (mytime < int(cf.timeout)):
-        if cf.timeout != -1 and mytime != -1: 
+    while (timeout == -1 or mytime < int(timeout)):
+        if timeout != -1 and mytime != -1: 
             stdscr.addstr(20, 5, "Will boot selected entry in %2d seconds"
-                          %(int(cf.timeout) - mytime))
+                          %(int(timeout) - mytime))
         else:
             stdscr.addstr(20, 5, " " * 80)
#1 lore raw

Thanks!

Quoted 49 lines · John Levon

# HG changeset patch
# User [email protected]
# Node ID d68796f82e99e68750a2212fef57d61e65f9afb9 # Parent 5b004f4e76cf90ef6f7155a4822e63b9e33cf7d8 Fix pygrub to handle timeout of -1 (wait forever). Only call use_default_colors() if it's available.

diff -r 5b004f4e76cf -r d68796f82e99 tools/pygrub/src/pygrub

tools/pygrub/src/pygrub Thu Jan 26 06:24:50 2006 -0800 renamed from tools/pygrub/src/pygrub Wed Jan 25 23:35:22 2006 +0100 +6 -4
@@ -29,7 +29,8 @@
 
 def draw_window():
    stdscr = curses.initscr()
-    curses.use_default_colors()
+    if hasattr(curses, 'use_default_colors'):
+        curses.use_default_colors()
    try:
        curses.curs_set(0)
    except _curses.error:
@@ -152,15 +153,16 @@
 
 def main(cf = None):
    mytime = 0
+    timeout = int(cf.timeout)
 
    (stdscr, win) = draw_window()
    stdscr.timeout(1000)
    selected = cf.default
 
-    while (mytime < int(cf.timeout)):
-        if cf.timeout != -1 and mytime != -1:
+    while (timeout == -1 or mytime < int(timeout)):
+        if timeout != -1 and mytime != -1:
            stdscr.addstr(20, 5, "Will boot selected entry in %2d seconds"
-                          %(int(cf.timeout) - mytime))
+                          %(int(timeout) - mytime))
        else:
            stdscr.addstr(20, 5, " " * 80)
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel