Changeset 1367
- Timestamp:
- 06/16/06 07:51:43 (2 years ago)
- Files:
-
- ipython/trunk/IPython/Extensions/ibrowse.py (modified) (6 diffs)
- ipython/trunk/doc/ChangeLog (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ipython/trunk/IPython/Extensions/ibrowse.py
r1364 r1367 4 4 5 5 import astyle, ipipe 6 7 8 # Python 2.3 compatibility 9 try: 10 set 11 except NameError: 12 import sets 13 set = sets.Set 6 14 7 15 … … 96 104 Sort the objects (in descending order) using the attribute under the cursor as 97 105 the sort key. 106 107 hideattr 108 Hide the attribute under the cursor. 109 110 unhideattrs 111 Make all attributes visible again. 98 112 99 113 goto … … 237 251 # Maps attribute names to column widths 238 252 self.colwidths = {} 253 254 # Set of hidden attributes 255 self.hiddenattrs = set() 239 256 240 257 # This takes care of all the caches etc. … … 257 274 # Calculate which attributes are available from the objects that are 258 275 # currently visible on screen (and store it in ``self.displayattrs``) 276 259 277 attrnames = set() 260 # If the browser object specifies a fixed list of attributes, 261 # simply use it. 278 self.displayattrs = [] 262 279 if self.attrs: 263 self.displayattrs = self.attrs 264 else: 265 self.displayattrs = [] 280 # If the browser object specifies a fixed list of attributes, 281 # simply use it (removing hidden attributes). 282 for attrname in self.attrs: 283 if attrname not in attrnames and attrname not in self.hiddenattrs: 284 self.displayattrs.append(attrname) 285 attrnames.add(attrname) 286 else: 266 287 endy = min(self.datastarty+self.mainsizey, len(self.items)) 267 288 for i in xrange(self.datastarty, endy): 268 289 for attrname in ipipe.xattrs(self.items[i].item, "default"): 269 if attrname not in attrnames :290 if attrname not in attrnames and attrname not in self.hiddenattrs: 270 291 self.displayattrs.append(attrname) 271 292 attrnames.add(attrname) … … 745 766 curses.KEY_BACKSPACE: "leave", 746 767 ord("x"): "leave", 747 ord("h"): "help", 768 ord("h"): "hideattr", 769 ord("H"): "unhideattrs", 770 ord("?"): "help", 748 771 ord("e"): "enter", 749 772 ord("E"): "enterattr", … … 1237 1260 1238 1261 self.enter(_BrowserHelp(self), "default") 1262 1263 def cmd_hideattr(self): 1264 level = self.levels[-1] 1265 if level.displayattr[0] is None: 1266 self.beep() 1267 else: 1268 self.report("hideattr") 1269 level.hiddenattrs.add(level.displayattr[1]) 1270 level.moveto(level.curx, level.cury, refresh=True) 1271 1272 def cmd_unhideattrs(self): 1273 level = self.levels[-1] 1274 self.report("unhideattrs") 1275 level.hiddenattrs.clear() 1276 level.moveto(level.curx, level.cury, refresh=True) 1239 1277 1240 1278 def _dodisplay(self, scr): ipython/trunk/doc/ChangeLog
r1366 r1367 1 2006-06-16 Walter Doerwald <walter@livinglogic.de> 2 3 * IPython/Extensions/ibrowse.py: Add two new commands to 4 ibrowse: hideattr (mapped to "h") hides the attribute under 5 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden 6 attributes again. Remapped the help command to "?". 7 8 1 9 2006-06-15 Ville Vainio <vivainio@gmail.com> 2 10
