From: Jeremy Katz Subject: [PATCH] Fix pygrub with "many" kernels Date: Wed, 04 Oct 2006 17:57:06 -0400 Message-ID: <1159999027.25209.30.camel@orodruin.boston.redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-rM1F1FF8WuxDvLP4JLfl" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=-rM1F1FF8WuxDvLP4JLfl Content-Type: text/plain Content-Transfer-Encoding: 7bit Attached fixes running pygrub with many kernels to do proper scrolling Signed-off-by: Jeremy Katz --=-rM1F1FF8WuxDvLP4JLfl Content-Disposition: attachment; filename=pygrub-manykernels.patch Content-Type: text/x-patch; name=pygrub-manykernels.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: --=-rM1F1FF8WuxDvLP4JLfl Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-rM1F1FF8WuxDvLP4JLfl--