direct-io.hg
changeset 11666:be78be7009c5
[PYGRUB] Enable showing the cursor in pygrub when it's relevant to do so.
Signed-off-by: Jeremy Katz <katzj@redhat.com>
Signed-off-by: Jeremy Katz <katzj@redhat.com>
author | kfraser@localhost.localdomain |
---|---|
date | Fri Sep 29 11:22:24 2006 +0100 (2006-09-29) |
parents | dea06c7fd19d |
children | bcd0e18f7881 |
files | tools/pygrub/src/pygrub |
line diff
1.1 --- a/tools/pygrub/src/pygrub Fri Sep 29 11:21:02 2006 +0100 1.2 +++ b/tools/pygrub/src/pygrub Fri Sep 29 11:22:24 2006 +0100 1.3 @@ -25,7 +25,18 @@ sys.path = [ '/usr/lib/python' ] + sys.p 1.4 import grub.GrubConf 1.5 import grub.fsys 1.6 1.7 -PYGRUB_VER = 0.4 1.8 +PYGRUB_VER = 0.5 1.9 + 1.10 +def enable_cursor(ison): 1.11 + if ison: 1.12 + val = 2 1.13 + else: 1.14 + val = 0 1.15 + 1.16 + try: 1.17 + curses.curs_set(val) 1.18 + except _curses.error: 1.19 + pass 1.20 1.21 def is_disk_image(file): 1.22 fd = os.open(file, os.O_RDONLY) 1.23 @@ -141,10 +152,7 @@ class Grub: 1.24 self.screen.timeout(1000) 1.25 if hasattr(curses, 'use_default_colors'): 1.26 curses.use_default_colors() 1.27 - try: 1.28 - curses.curs_set(0) 1.29 - except _curses.error: 1.30 - pass 1.31 + enable_cursor(False) 1.32 self.entry_win = curses.newwin(10, 74, 2, 1) 1.33 self.text_win = curses.newwin(10, 70, 12, 5) 1.34 1.35 @@ -247,6 +255,7 @@ class Grub: 1.36 self.screen.refresh() 1.37 1.38 t = GrubLineEditor(self.screen, 5, 2, line) 1.39 + enable_cursor(True) 1.40 ret = t.edit() 1.41 if ret: 1.42 return ret 1.43 @@ -262,6 +271,7 @@ class Grub: 1.44 lines = [] 1.45 while 1: 1.46 t = GrubLineEditor(self.screen, y, 2) 1.47 + enable_cursor(True) 1.48 ret = t.edit() 1.49 if ret: 1.50 if ret in ("quit", "return"):