##// END OF EJS Templates
Show the input object of the igrid browser as the window tile....
walter.doerwald -
r546:83b88ca6
parent child
Show More
@@ -224,6 +224,7 class IGridGrid(wx.grid.Grid):
224 self.EnableEditing(False)
224 self.EnableEditing(False)
225 self.Bind(wx.EVT_KEY_DOWN, self.key_pressed)
225 self.Bind(wx.EVT_KEY_DOWN, self.key_pressed)
226 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.cell_doubleclicked)
226 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.cell_doubleclicked)
227 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.cell_leftclicked)
227 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_DCLICK, self.label_doubleclicked)
228 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_DCLICK, self.label_doubleclicked)
228 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_label_leftclick)
229 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_label_leftclick)
229 self.Bind(wx.grid.EVT_GRID_RANGE_SELECT, self._on_selected_range)
230 self.Bind(wx.grid.EVT_GRID_RANGE_SELECT, self._on_selected_range)
@@ -265,7 +266,12 class IGridGrid(wx.grid.Grid):
265 curitem = self.table.items[row] # Remember where the cursor is now
266 curitem = self.table.items[row] # Remember where the cursor is now
266 # Sort items
267 # Sort items
267 def realkey(item):
268 def realkey(item):
268 return key(item)
269 try:
270 return key(item)
271 except (KeyboardInterrupt, SystemExit):
272 raise
273 except Exception:
274 return None
269 try:
275 try:
270 self.table.items = ipipe.deque(sorted(self.table.items, key=realkey, reverse=reverse))
276 self.table.items = ipipe.deque(sorted(self.table.items, key=realkey, reverse=reverse))
271 except TypeError, exc:
277 except TypeError, exc:
@@ -283,7 +289,7 class IGridGrid(wx.grid.Grid):
283 Sort in ascending order; sorting criteria is the current attribute
289 Sort in ascending order; sorting criteria is the current attribute
284 """
290 """
285 col = self.GetGridCursorCol()
291 col = self.GetGridCursorCol()
286 attr = self.table._displayattrs[col]
292 attr = self.table._displvayattrs[col]
287 frame = self.GetParent().GetParent().GetParent()
293 frame = self.GetParent().GetParent().GetParent()
288 if attr is ipipe.noitem:
294 if attr is ipipe.noitem:
289 self.error_output("no column under cursor")
295 self.error_output("no column under cursor")
@@ -450,6 +456,32 class IGridGrid(wx.grid.Grid):
450 self.sortattrdesc()
456 self.sortattrdesc()
451 else:
457 else:
452 self.sortattrasc()
458 self.sortattrasc()
459 elif keycode == wx.WXK_DOWN:
460 row = self.GetGridCursorRow()
461 try:
462 item = self.table.items[row+1]
463 except IndexError:
464 item = self.table.items[row]
465 self.set_footer(item)
466 event.Skip()
467 elif keycode == wx.WXK_UP:
468 row = self.GetGridCursorRow()
469 if row >= 1:
470 item = self.table.items[row-1]
471 else:
472 item = self.table.items[row]
473 self.set_footer(item)
474 event.Skip()
475 elif keycode == wx.WXK_RIGHT:
476 row = self.GetGridCursorRow()
477 item = self.table.items[row]
478 self.set_footer(item)
479 event.Skip()
480 elif keycode == wx.WXK_LEFT:
481 row = self.GetGridCursorRow()
482 item = self.table.items[row]
483 self.set_footer(item)
484 event.Skip()
453 else:
485 else:
454 event.Skip()
486 event.Skip()
455
487
@@ -501,6 +533,10 class IGridGrid(wx.grid.Grid):
501 else:
533 else:
502 self._doenter(value)
534 self._doenter(value)
503
535
536 def set_footer(self, item):
537 frame = self.GetParent().GetParent().GetParent()
538 frame.SetStatusText(" ".join([str(text) for (style, text) in ipipe.xformat(item, "footer", 20)[2]]))
539
504 def enter(self, row):
540 def enter(self, row):
505 try:
541 try:
506 value = self.table.items[row]
542 value = self.table.items[row]
@@ -545,7 +581,14 class IGridGrid(wx.grid.Grid):
545
581
546 def cell_doubleclicked(self, event):
582 def cell_doubleclicked(self, event):
547 self.enterattr(event.GetRow(), event.GetCol())
583 self.enterattr(event.GetRow(), event.GetCol())
584 event.Skip()
548
585
586 def cell_leftclicked(self, event):
587 row = event.GetRow()
588 item = self.table.items[row]
589 self.set_footer(item)
590 event.Skip()
591
549 def pick(self, row):
592 def pick(self, row):
550 """
593 """
551 pick a single row and return to the IPython prompt
594 pick a single row and return to the IPython prompt
@@ -622,7 +665,8 class IGridFrame(wx.Frame):
622 maxtitlelen = 30
665 maxtitlelen = 30
623
666
624 def __init__(self, parent, input):
667 def __init__(self, parent, input):
625 wx.Frame.__init__(self, None, title="IGrid", size=(640, 480))
668 title = " ".join([str(x[1]) for x in ipipe.xformat(input, "header", 20)[2]])
669 wx.Frame.__init__(self, None, title=title, size=(640, 480))
626 self.menubar = wx.MenuBar()
670 self.menubar = wx.MenuBar()
627 self.menucounter = 100
671 self.menucounter = 100
628 self.m_help = wx.Menu()
672 self.m_help = wx.Menu()
@@ -2,6 +2,9
2
2
3 * setup.py: Add the igrid help files to the list of data files
3 * setup.py: Add the igrid help files to the list of data files
4 to be installed alongside igrid.
4 to be installed alongside igrid.
5 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
6 Show the input object of the igrid browser as the window tile.
7 Show the object the cursor is on in the statusbar.
5
8
6 2007-03-15 Ville Vainio <vivainio@gmail.com>
9 2007-03-15 Ville Vainio <vivainio@gmail.com>
7
10
General Comments 0
You need to be logged in to leave comments. Login now