WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-3.1-testing] Fix pygrub handling of many kernels

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.1-testing] Fix pygrub handling of many kernels
From: "Xen patchbot-3.1-testing" <patchbot-3.1-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Jan 2008 06:30:22 -0800
Delivery-date: Thu, 10 Jan 2008 06:31:11 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1198794866 0
# Node ID 851d07920758adcb08a9f551e147be5279155e88
# Parent  ec1278e6de790767c767a2cc8f20add1d8345b78
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@xxxxxxxxxx>
xen-unstable changeset:   16668:50bd5d2c15cf
xen-unstable date:        Thu Dec 27 12:56:32 2007 +0000
---
 tools/pygrub/src/pygrub |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff -r ec1278e6de79 -r 851d07920758 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub   Thu Dec 27 22:33:47 2007 +0000
+++ b/tools/pygrub/src/pygrub   Thu Dec 27 22:34:26 2007 +0000
@@ -27,7 +27,7 @@ import grub.GrubConf
 import grub.GrubConf
 import grub.LiloConf
 
-PYGRUB_VER = 0.5
+PYGRUB_VER = 0.6
 
 def enable_cursor(ison):
     if ison:
@@ -228,15 +228,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):
@@ -416,6 +423,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: 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.1-testing] Fix pygrub handling of many kernels, Xen patchbot-3.1-testing <=