* PATCH: Fix pygrub handling of many kernels
@ 2007-12-21 22:34 Daniel P. Berrange
0 siblings, 0 replies; only message in thread
From: Daniel P. Berrange @ 2007-12-21 22:34 UTC (permalink / raw)
To: xen-devel; +Cc: Jeremy Katz
[-- Attachment #1: Type: text/plain, Size: 877 bytes --]
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.
This patch was originally written by Jeremy Katz and has been tested in
Fedora for a long time, but somehow got missed for sending upstream in
the past.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
CC: Jeremy Katz <katzj@redhat.com>
pygrub | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
Regards,
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
[-- Attachment #2: pygrub-manykernels.patch --]
[-- Type: text/plain, Size: 1669 bytes --]
diff -r a5a3f48e92c9 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub Wed Oct 04 19:00:11 2006 +0100
+++ b/tools/pygrub/src/pygrub Wed Oct 04 17:55:19 2006 -0400
@@ -25,7 +25,7 @@ import grub.GrubConf
import grub.GrubConf
import grub.fsys
-PYGRUB_VER = 0.5
+PYGRUB_VER = 0.6
def enable_cursor(ison):
if ison:
@@ -167,15 +167,22 @@ class Grub:
def fill_entry_list(self):
self.entry_win.clear()
self.entry_win.box()
- for y in range(0, len(self.cf.images)):
+
+ maxy = self.entry_win.getmaxyx()[0]-3 # maxy - 2 for the frame + index
+ if self.selected_image > self.start_image + maxy:
+ self.start_image = self.selected_image
+ if self.selected_image < self.start_image:
+ self.start_image = self.selected_image
+
+ for y in range(self.start_image, len(self.cf.images)):
i = self.cf.images[y]
- if (0, y) > self.entry_win.getmaxyx():
+ if y > self.start_image + maxy:
break
if y == self.selected_image:
attr = curses.A_REVERSE
else:
attr = 0
- self.entry_win.addstr(y + 1, 2, i.title.ljust(70), attr)
+ self.entry_win.addstr(y + 1 - self.start_image, 2, i.title.ljust(70), attr)
self.entry_win.refresh()
def edit_entry(self, origimg):
@@ -364,6 +371,7 @@ class Grub:
# now loop until we hit the timeout or get a go from the user
mytime = 0
+ self.start_image = 0
while (timeout == -1 or mytime < int(timeout)):
draw()
if timeout != -1 and mytime != -1:
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-12-21 22:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-21 22:34 PATCH: Fix pygrub handling of many kernels Daniel P. Berrange
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.