[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.0.3-testing] [PYGRUB] Enable showing the cursor in pygrub when it's relevant to do so.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1159525344 -3600
# Node ID be78be7009c55c1f8bbaf0cb90283d1aa71627fb
# Parent  dea06c7fd19d5174ee4ff489e8c75ef88cd3cd43
[PYGRUB] Enable showing the cursor in pygrub when it's relevant to do so.
Signed-off-by: Jeremy Katz <katzj@xxxxxxxxxx>
---
 tools/pygrub/src/pygrub |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff -r dea06c7fd19d -r be78be7009c5 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub   Fri Sep 29 11:21:02 2006 +0100
+++ b/tools/pygrub/src/pygrub   Fri Sep 29 11:22:24 2006 +0100
@@ -25,7 +25,18 @@ import grub.GrubConf
 import grub.GrubConf
 import grub.fsys
 
-PYGRUB_VER = 0.4
+PYGRUB_VER = 0.5
+
+def enable_cursor(ison):
+    if ison:
+        val = 2
+    else:
+        val = 0
+        
+    try:
+        curses.curs_set(val)
+    except _curses.error:
+        pass
 
 def is_disk_image(file):
     fd = os.open(file, os.O_RDONLY)
@@ -141,10 +152,7 @@ class Grub:
             self.screen.timeout(1000)
             if hasattr(curses, 'use_default_colors'):
                 curses.use_default_colors()
-            try:
-                curses.curs_set(0)
-            except _curses.error:
-                pass
+            enable_cursor(False)
             self.entry_win = curses.newwin(10, 74, 2, 1)
             self.text_win = curses.newwin(10, 70, 12, 5)
             
@@ -247,6 +255,7 @@ class Grub:
         self.screen.refresh()
 
         t = GrubLineEditor(self.screen, 5, 2, line)
+        enable_cursor(True)
         ret = t.edit()
         if ret:
             return ret
@@ -262,6 +271,7 @@ class Grub:
         lines = []
         while 1:
             t = GrubLineEditor(self.screen, y, 2)
+            enable_cursor(True)            
             ret = t.edit()
             if ret:
                 if ret in ("quit", "return"):

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.