##// END OF EJS Templates
IPython/Extensions/ipipe.py: Added a Table ihist that can be used to...
walter.doerwald -
Show More
@@ -2,6 +2,8 b''
2
2
3 import curses, fcntl, signal, struct, tty, textwrap, inspect
3 import curses, fcntl, signal, struct, tty, textwrap, inspect
4
4
5 from IPython import ipapi
6
5 import astyle, ipipe
7 import astyle, ipipe
6
8
7
9
@@ -773,6 +775,8 b' class ibrowse(ipipe.Display):'
773 keymap.register("pickallattrs", "C")
775 keymap.register("pickallattrs", "C")
774 keymap.register("pickmarked", "m")
776 keymap.register("pickmarked", "m")
775 keymap.register("pickmarkedattr", "M")
777 keymap.register("pickmarkedattr", "M")
778 keymap.register("pickinput", "i")
779 keymap.register("pickinputattr", "I")
776 keymap.register("hideattr", "h")
780 keymap.register("hideattr", "h")
777 keymap.register("unhideattrs", "H")
781 keymap.register("unhideattrs", "H")
778 keymap.register("help", "?")
782 keymap.register("help", "?")
@@ -1159,6 +1163,40 b' class ibrowse(ipipe.Display):'
1159 self.returnvalue = result
1163 self.returnvalue = result
1160 return True
1164 return True
1161
1165
1166 def cmd_pickinput(self):
1167 """
1168 Use the object under the cursor (i.e. the row the cursor is on) as
1169 the next input line. This leaves the browser and puts the picked object
1170 in the input.
1171 """
1172 level = self.levels[-1]
1173 value = level.items[level.cury].item
1174 self.returnvalue = None
1175 api = ipapi.get()
1176 api.set_next_input(str(value))
1177 return True
1178
1179 def cmd_pickinputattr(self):
1180 """
1181 Use the attribute under the cursor i.e. the row/column the cursor is on)
1182 as the next input line. This leaves the browser and puts the picked
1183 object in the input.
1184 """
1185 level = self.levels[-1]
1186 attr = level.displayattr[1]
1187 if attr is ipipe.noitem:
1188 curses.beep()
1189 self.report(CommandError("no column under cursor"))
1190 return
1191 value = attr.value(level.items[level.cury].item)
1192 if value is ipipe.noitem:
1193 curses.beep()
1194 self.report(AttributeError(attr.name()))
1195 self.returnvalue = None
1196 api = ipapi.get()
1197 api.set_next_input(str(value))
1198 return True
1199
1162 def cmd_markrange(self):
1200 def cmd_markrange(self):
1163 """
1201 """
1164 Mark all objects from the last marked object before the current cursor
1202 Mark all objects from the last marked object before the current cursor
@@ -135,8 +135,8 b' import astyle'
135
135
136 __all__ = [
136 __all__ = [
137 "ifile", "ils", "iglob", "iwalk", "ipwdentry", "ipwd", "igrpentry", "igrp",
137 "ifile", "ils", "iglob", "iwalk", "ipwdentry", "ipwd", "igrpentry", "igrp",
138 "icsv", "ix", "ichain", "isort", "ifilter", "ieval", "ienum", "ienv",
138 "icsv", "ix", "ichain", "isort", "ifilter", "ieval", "ienum",
139 "idump", "iless"
139 "ienv", "ihist", "idump", "iless"
140 ]
140 ]
141
141
142
142
@@ -1568,6 +1568,28 b' class ienv(Table):'
1568 yield (astyle.style_default, repr(self))
1568 yield (astyle.style_default, repr(self))
1569
1569
1570
1570
1571 class ihist(Table):
1572 """
1573 IPython input history
1574
1575 Example:
1576
1577 >>> ihist
1578 >>> ihist(True) (raw mode)
1579 """
1580 def __init__(self, raw=False):
1581 self.raw = raw
1582
1583 def __iter__(self):
1584 api = ipapi.get()
1585 if self.raw:
1586 for line in api.IP.input_hist_raw:
1587 yield line.rstrip("\n")
1588 else:
1589 for line in api.IP.input_hist:
1590 yield line.rstrip("\n")
1591
1592
1571 class icsv(Pipe):
1593 class icsv(Pipe):
1572 """
1594 """
1573 This ``Pipe`` lists turn the input (with must be a pipe outputting lines
1595 This ``Pipe`` lists turn the input (with must be a pipe outputting lines
@@ -1,3 +1,13 b''
1 2007-05-24 Walter Doerwald <walter@livinglogic.de>
2
3 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
4 browse the IPython input history
5
6 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
7 (mapped to "i") can be used to put the object under the curser in the input
8 line. pickinputattr (mapped to "I") does the same for the attribute under
9 the cursor.
10
1 2007-05-24 Ville Vainio <vivainio@gmail.com>
11 2007-05-24 Ville Vainio <vivainio@gmail.com>
2
12
3 * Grand magic cleansing (changeset [2380]):
13 * Grand magic cleansing (changeset [2380]):
General Comments 0
You need to be logged in to leave comments. Login now