##// END OF EJS Templates
Change _BrowserLevel.moveto() so that the call to fetch() always tries to...
walter.doerwald -
Show More
@@ -237,13 +237,8 b' class _BrowserLevel(object):'
237 # Maps attribute names to column widths
237 # Maps attribute names to column widths
238 self.colwidths = {}
238 self.colwidths = {}
239
239
240 self.fetch(mainsizey)
240 # This takes care of all the caches etc.
241 self.calcdisplayattrs()
241 self.moveto(0, 0, refresh=True)
242 # formatted attributes for the items on screen
243 # (i.e. self.items[self.datastarty:self.datastarty+self.mainsizey])
244 self.displayrows = [self.getrow(i) for i in xrange(len(self.items))]
245 self.calcwidths()
246 self.calcdisplayattr()
247
242
248 def fetch(self, count):
243 def fetch(self, count):
249 # Try to fill ``self.items`` with at least ``count`` objects.
244 # Try to fill ``self.items`` with at least ``count`` objects.
@@ -296,11 +291,11 b' class _BrowserLevel(object):'
296 return row
291 return row
297
292
298 def calcwidths(self):
293 def calcwidths(self):
299 # Recalculate the displayed fields and their width.
294 # Recalculate the displayed fields and their widths.
300 # ``calcdisplayattrs()'' must have been called and the cache
295 # ``calcdisplayattrs()'' must have been called and the cache
301 # for attributes of the objects on screen (``self.displayrows``)
296 # for attributes of the objects on screen (``self.displayrows``)
302 # must have been filled. This returns a dictionary mapping
297 # must have been filled. This returns a dictionary mapping
303 # colmn names to width.
298 # column names to widths.
304 self.colwidths = {}
299 self.colwidths = {}
305 for row in self.displayrows:
300 for row in self.displayrows:
306 for attrname in self.displayattrs:
301 for attrname in self.displayattrs:
@@ -314,7 +309,7 b' class _BrowserLevel(object):'
314 newwidth = max(self.colwidths[attrname], length)
309 newwidth = max(self.colwidths[attrname], length)
315 self.colwidths[attrname] = newwidth
310 self.colwidths[attrname] = newwidth
316
311
317 # How many characters do we need to paint the item number?
312 # How many characters do we need to paint the largest item number?
318 self.numbersizex = len(str(self.datastarty+self.mainsizey-1))
313 self.numbersizex = len(str(self.datastarty+self.mainsizey-1))
319 # How must space have we got to display data?
314 # How must space have we got to display data?
320 self.mainsizex = self.browser.scrsizex-self.numbersizex-3
315 self.mainsizex = self.browser.scrsizex-self.numbersizex-3
@@ -322,7 +317,7 b' class _BrowserLevel(object):'
322 self.datasizex = sum(self.colwidths.itervalues()) + len(self.colwidths)
317 self.datasizex = sum(self.colwidths.itervalues()) + len(self.colwidths)
323
318
324 def calcdisplayattr(self):
319 def calcdisplayattr(self):
325 # Find out on which attribute the cursor is on and store this
320 # Find out which attribute the cursor is on and store this
326 # information in ``self.displayattr``.
321 # information in ``self.displayattr``.
327 pos = 0
322 pos = 0
328 for (i, attrname) in enumerate(self.displayattrs):
323 for (i, attrname) in enumerate(self.displayattrs):
@@ -352,7 +347,8 b' class _BrowserLevel(object):'
352 # Make sure that the cursor didn't leave the main area vertically
347 # Make sure that the cursor didn't leave the main area vertically
353 if y < 0:
348 if y < 0:
354 y = 0
349 y = 0
355 self.fetch(y+scrollbordery+1) # try to get more items
350 # try to get enough items to fill the screen
351 self.fetch(max(y+scrollbordery+1, self.mainsizey))
356 if y >= len(self.items):
352 if y >= len(self.items):
357 y = max(0, len(self.items)-1)
353 y = max(0, len(self.items)-1)
358
354
@@ -807,9 +803,6 b' class ibrowse(ipipe.Display):'
807 # e.g. normal browsing or entering an argument for a command
803 # e.g. normal browsing or entering an argument for a command
808 self.mode = "default"
804 self.mode = "default"
809
805
810 # The partially entered row number for the goto command
811 self.goto = ""
812
813 def nextstepx(self, step):
806 def nextstepx(self, step):
814 """
807 """
815 Accelerate horizontally.
808 Accelerate horizontally.
@@ -1469,7 +1462,7 b' class ibrowse(ipipe.Display):'
1469 else:
1462 else:
1470 scr.move(self.scrsizey-1, 0)
1463 scr.move(self.scrsizey-1, 0)
1471 except curses.error:
1464 except curses.error:
1472 # Protect against error from writing to the last line
1465 # Protect against errors from writing to the last line
1473 pass
1466 pass
1474 scr.clrtoeol()
1467 scr.clrtoeol()
1475
1468
@@ -1,3 +1,10 b''
1 2006-06-15 Walter Doerwald <walter@livinglogic.de>
2
3 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
4 the call to fetch() always tries to fetch enough data for at least one
5 full screen. This makes it possible to simply call moveto(0,0,True) in
6 the constructor. Fix typos and removed the obsolete goto attribute.
7
1 2006-06-12 Ville Vainio <vivainio@gmail.com>
8 2006-06-12 Ville Vainio <vivainio@gmail.com>
2
9
3 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
10 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
General Comments 0
You need to be logged in to leave comments. Login now