##// 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 237 # Maps attribute names to column widths
238 238 self.colwidths = {}
239 239
240 self.fetch(mainsizey)
241 self.calcdisplayattrs()
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()
240 # This takes care of all the caches etc.
241 self.moveto(0, 0, refresh=True)
247 242
248 243 def fetch(self, count):
249 244 # Try to fill ``self.items`` with at least ``count`` objects.
@@ -296,11 +291,11 b' class _BrowserLevel(object):'
296 291 return row
297 292
298 293 def calcwidths(self):
299 # Recalculate the displayed fields and their width.
294 # Recalculate the displayed fields and their widths.
300 295 # ``calcdisplayattrs()'' must have been called and the cache
301 296 # for attributes of the objects on screen (``self.displayrows``)
302 297 # must have been filled. This returns a dictionary mapping
303 # colmn names to width.
298 # column names to widths.
304 299 self.colwidths = {}
305 300 for row in self.displayrows:
306 301 for attrname in self.displayattrs:
@@ -314,7 +309,7 b' class _BrowserLevel(object):'
314 309 newwidth = max(self.colwidths[attrname], length)
315 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 313 self.numbersizex = len(str(self.datastarty+self.mainsizey-1))
319 314 # How must space have we got to display data?
320 315 self.mainsizex = self.browser.scrsizex-self.numbersizex-3
@@ -322,7 +317,7 b' class _BrowserLevel(object):'
322 317 self.datasizex = sum(self.colwidths.itervalues()) + len(self.colwidths)
323 318
324 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 321 # information in ``self.displayattr``.
327 322 pos = 0
328 323 for (i, attrname) in enumerate(self.displayattrs):
@@ -352,7 +347,8 b' class _BrowserLevel(object):'
352 347 # Make sure that the cursor didn't leave the main area vertically
353 348 if y < 0:
354 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 352 if y >= len(self.items):
357 353 y = max(0, len(self.items)-1)
358 354
@@ -807,9 +803,6 b' class ibrowse(ipipe.Display):'
807 803 # e.g. normal browsing or entering an argument for a command
808 804 self.mode = "default"
809 805
810 # The partially entered row number for the goto command
811 self.goto = ""
812
813 806 def nextstepx(self, step):
814 807 """
815 808 Accelerate horizontally.
@@ -1469,7 +1462,7 b' class ibrowse(ipipe.Display):'
1469 1462 else:
1470 1463 scr.move(self.scrsizey-1, 0)
1471 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 1466 pass
1474 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 8 2006-06-12 Ville Vainio <vivainio@gmail.com>
2 9
3 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