debuggers.hg
changeset 16706:50bd5d2c15cf
Fix pygrub handling of many kernels
If there are a large number of kernel images configured in grub.conf
there will be too many to fit in the limited size pygrub display. This
patch fixes this so that the list of kernels scrolls as needed.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
If there are a large number of kernel images configured in grub.conf
there will be too many to fit in the limited size pygrub display. This
patch fixes this so that the list of kernels scrolls as needed.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Thu Dec 27 12:56:32 2007 +0000 (2007-12-27) |
parents | 9bf8b152df9f |
children | 7fbc521b07a9 |
files | tools/pygrub/src/pygrub |
line diff
1.1 --- a/tools/pygrub/src/pygrub Thu Dec 27 12:53:57 2007 +0000 1.2 +++ b/tools/pygrub/src/pygrub Thu Dec 27 12:56:32 2007 +0000 1.3 @@ -27,7 +27,7 @@ import fsimage 1.4 import grub.GrubConf 1.5 import grub.LiloConf 1.6 1.7 -PYGRUB_VER = 0.5 1.8 +PYGRUB_VER = 0.6 1.9 1.10 def enable_cursor(ison): 1.11 if ison: 1.12 @@ -228,15 +228,22 @@ class Grub: 1.13 def fill_entry_list(self): 1.14 self.entry_win.clear() 1.15 self.entry_win.box() 1.16 - for y in range(0, len(self.cf.images)): 1.17 + 1.18 + maxy = self.entry_win.getmaxyx()[0]-3 # maxy - 2 for the frame + index 1.19 + if self.selected_image > self.start_image + maxy: 1.20 + self.start_image = self.selected_image 1.21 + if self.selected_image < self.start_image: 1.22 + self.start_image = self.selected_image 1.23 + 1.24 + for y in range(self.start_image, len(self.cf.images)): 1.25 i = self.cf.images[y] 1.26 - if (0, y) > self.entry_win.getmaxyx(): 1.27 + if y > self.start_image + maxy: 1.28 break 1.29 if y == self.selected_image: 1.30 attr = curses.A_REVERSE 1.31 else: 1.32 attr = 0 1.33 - self.entry_win.addstr(y + 1, 2, i.title.ljust(70), attr) 1.34 + self.entry_win.addstr(y + 1 - self.start_image, 2, i.title.ljust(70), attr) 1.35 self.entry_win.refresh() 1.36 1.37 def edit_entry(self, origimg): 1.38 @@ -416,6 +423,7 @@ class Grub: 1.39 1.40 # now loop until we hit the timeout or get a go from the user 1.41 mytime = 0 1.42 + self.start_image = 0 1.43 while (timeout == -1 or mytime < int(timeout)): 1.44 draw() 1.45 if timeout != -1 and mytime != -1: