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