##// END OF EJS Templates
Add an input argument to *all* Display constructors....
walter.doerwald -
Show More
@@ -266,10 +266,7 b' else:'
266 266 yield (-1, True)
267 267 for info in self:
268 268 yield info
269 try:
270 269 ipipe.xrepr.when_type(Text)(xrepr_astyle_text)
271 except Exception:
272 pass
273 270
274 271
275 272 def streamstyle(stream, styled=None):
@@ -796,16 +796,14 b' class ibrowse(ipipe.Display):'
796 796 keymap.register("refresh", "r")
797 797 keymap.register("refreshfind", "R")
798 798
799 def __init__(self, input=None, attrs=None):
799 def __init__(self, input=None, *attrs):
800 800 """
801 801 Create a new browser. If ``attrs`` is not empty, it is the list
802 802 of attributes that will be displayed in the browser, otherwise
803 803 these will be determined by the objects on screen.
804 804 """
805 self.input = input
805 ipipe.Display.__init__(self, input)
806 806
807 if attrs is None:
808 attrs = ()
809 807 self.attrs = attrs
810 808
811 809 # Stack of browser levels
@@ -1102,13 +1102,10 b' class igrid(ipipe.Display):'
1102 1102 (which is curses-based) or ``idump`` (which simply does a print).
1103 1103 """
1104 1104
1105 def __init__(self, input=None):
1106 self.input = input
1107
1108 1105 if wx.VERSION < (2, 7):
1109 1106 def display(self):
1110 1107 try:
1111 # Try to create a "standalone" from. If this works we're probably
1108 # Try to create a "standalone" frame. If this works we're probably
1112 1109 # running with -wthread.
1113 1110 # Note that this sets the parent of the frame to None, but we can't
1114 1111 # pass a result object back to the shell anyway.
@@ -130,8 +130,6 b' except ImportError:'
130 130 genutils = None
131 131 ipapi = None
132 132
133 import astyle
134
135 133
136 134 __all__ = [
137 135 "ifile", "ils", "iglob", "iwalk", "ipwdentry", "ipwd", "igrpentry", "igrp",
@@ -1932,6 +1930,9 b' class Display(object):'
1932 1930 def __ror__(self, input):
1933 1931 return input | self()
1934 1932
1933 def __init__(self, input=None):
1934 self.input = input
1935
1935 1936 def __ror__(self, input):
1936 1937 self.input = input
1937 1938 return self
@@ -2069,6 +2070,9 b' def xformat(value, mode, maxlength):'
2069 2070 return (align, width, text)
2070 2071
2071 2072
2073
2074 import astyle
2075
2072 2076 class idump(Display):
2073 2077 # The approximate maximum length of a column entry
2074 2078 maxattrlength = 200
@@ -2076,7 +2080,8 b' class idump(Display):'
2076 2080 # Style for column names
2077 2081 style_header = astyle.Style.fromstr("white:black:bold")
2078 2082
2079 def __init__(self, *attrs):
2083 def __init__(self, input=None, *attrs):
2084 Display.__init__(self, input)
2080 2085 self.attrs = [upgradexattr(attr) for attr in attrs]
2081 2086 self.headerpadchar = " "
2082 2087 self.headersepchar = "|"
@@ -1,8 +1,10 b''
1 1 2008-01-19 Walter Doerwald <walter@livinglogic.de>
2 2
3 * IPython/Extensions/ibrowse.py, IPython/Extensions/igrid.py:
4 The input object can now be passed to the constructor of ibrowse/igrid.
3 * ibrowse.py, igrid.py, ipipe.py:
4 The input object can now be passed to the constructor of the display classes.
5 5 This makes it possible to use them with objects that implement __or__.
6 * ipipe.py: Importing astyle.py is done as late as possible to
7 avoid problems with circular imports.
6 8
7 9 2008-01-19 Ville Vainio <vivainio@gmail.com>
8 10
General Comments 0
You need to be logged in to leave comments. Login now